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