1f0bfeaa8Sopenharmony_ci/*
2f0bfeaa8Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
3f0bfeaa8Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4f0bfeaa8Sopenharmony_ci * you may not use this file except in compliance with the License.
5f0bfeaa8Sopenharmony_ci * You may obtain a copy of the License at
6f0bfeaa8Sopenharmony_ci *
7f0bfeaa8Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8f0bfeaa8Sopenharmony_ci *
9f0bfeaa8Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10f0bfeaa8Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11f0bfeaa8Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12f0bfeaa8Sopenharmony_ci * See the License for the specific language governing permissions and
13f0bfeaa8Sopenharmony_ci * limitations under the License.
14f0bfeaa8Sopenharmony_ci */
15f0bfeaa8Sopenharmony_ci
16f0bfeaa8Sopenharmony_ci#ifndef OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_STATE_C_H
17f0bfeaa8Sopenharmony_ci#define OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_STATE_C_H
18f0bfeaa8Sopenharmony_ci
19f0bfeaa8Sopenharmony_ci#ifdef __cplusplus
20f0bfeaa8Sopenharmony_ci#if __cplusplus
21f0bfeaa8Sopenharmony_ciextern "C" {
22f0bfeaa8Sopenharmony_ci#endif /* End of #if __cplusplus */
23f0bfeaa8Sopenharmony_ci#endif /* End of #ifdef __cplusplus */
24f0bfeaa8Sopenharmony_ci
25f0bfeaa8Sopenharmony_ci/*
26f0bfeaa8Sopenharmony_ci * PMState: Inner state.
27f0bfeaa8Sopenharmony_ci * It may be used in C or CPP code, so using "typedef enum" for common cases.
28f0bfeaa8Sopenharmony_ci */
29f0bfeaa8Sopenharmony_citypedef enum {
30f0bfeaa8Sopenharmony_ci    PM_OK = 0,
31f0bfeaa8Sopenharmony_ci    PM_BUILDER_NULL,
32f0bfeaa8Sopenharmony_ci    PM_MMAP_PURG_FAIL,
33f0bfeaa8Sopenharmony_ci    PM_MMAP_UXPT_FAIL,
34f0bfeaa8Sopenharmony_ci    PM_UNMAP_PURG_SUCC,
35f0bfeaa8Sopenharmony_ci    PM_UNMAP_PURG_FAIL,
36f0bfeaa8Sopenharmony_ci    PM_UNMAP_UXPT_FAIL,
37f0bfeaa8Sopenharmony_ci    PM_UXPT_OUT_RANGE,
38f0bfeaa8Sopenharmony_ci    PM_UXPT_PRESENT_DATA_PURGED,
39f0bfeaa8Sopenharmony_ci    PM_UXPT_NO_PRESENT,
40f0bfeaa8Sopenharmony_ci    PM_LOCK_INIT_FAIL,
41f0bfeaa8Sopenharmony_ci    PM_LOCK_READ_SUCC,
42f0bfeaa8Sopenharmony_ci    PM_LOCK_READ_FAIL,
43f0bfeaa8Sopenharmony_ci    PM_LOCK_WRITE_FAIL,
44f0bfeaa8Sopenharmony_ci    PM_UNLOCK_READ_FAIL,
45f0bfeaa8Sopenharmony_ci    PM_UNLOCK_WRITE_FAIL,
46f0bfeaa8Sopenharmony_ci    PM_DATA_PURGED,
47f0bfeaa8Sopenharmony_ci    PM_DATA_NO_PURGED,
48f0bfeaa8Sopenharmony_ci    PMB_BUILD_ALL_SUCC,
49f0bfeaa8Sopenharmony_ci    PMB_BUILD_ALL_FAIL,
50f0bfeaa8Sopenharmony_ci    PMB_DESTORY_FAIL, /* builder destory failed */
51f0bfeaa8Sopenharmony_ci    PM_ERR_TYPES,
52f0bfeaa8Sopenharmony_ci} PMState; /* purgeable mem errno */
53f0bfeaa8Sopenharmony_ci
54f0bfeaa8Sopenharmony_ci/*
55f0bfeaa8Sopenharmony_ci * PMStateName: Inner func, get name of PMState @state.
56f0bfeaa8Sopenharmony_ci * Input:   @state: PMState.
57f0bfeaa8Sopenharmony_ci * Return:  the name of PMState @state.
58f0bfeaa8Sopenharmony_ci */
59f0bfeaa8Sopenharmony_ciconst char *GetPMStateName(PMState state);
60f0bfeaa8Sopenharmony_ci
61f0bfeaa8Sopenharmony_ci#ifdef __cplusplus
62f0bfeaa8Sopenharmony_ci#if __cplusplus
63f0bfeaa8Sopenharmony_ci}
64f0bfeaa8Sopenharmony_ci#endif /* End of #if __cplusplus */
65f0bfeaa8Sopenharmony_ci#endif /* End of #ifdef __cplusplus */
66f0bfeaa8Sopenharmony_ci
67f0bfeaa8Sopenharmony_ci#endif /* OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_STATE_C_H */
68