1 /* 2 * Copyright (c) 2023 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 /** 17 * @file common_mapped_file_errors.h 18 * 19 * @brief Provides the values of the <b>Code</b> segment in <b>ErrCode</b> 20 * for the MappedFile module in the commonlibrary subsystem. 21 */ 22 23 #ifndef UTILS_COMMON_TIMER_ERRORS_H 24 #define UTILS_COMMON_TIMER_ERRORS_H 25 26 #include <cerrno> 27 #include "errors.h" 28 #include "common_errors.h" 29 30 namespace OHOS { 31 namespace Utils { 32 33 /** 34 * ErrCode layout 35 * 36 * +-----+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 37 * | Bit |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|09|08|07|06|05|04|03|02|01|00| 38 * +-----+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 39 * |Field|Reserved| Subsystem | Module | Code | 40 * +-----+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 41 * 42 * In this file, the subsystem is "SUBSYS_COMMON", and the module is 43 * "MODULE_MAPPED_FILE". 44 */ 45 46 using ErrCode = int; 47 48 // The error codes can be used only for the MappedFile module. 49 /** 50 * @brief Provides the base error codes of the MappedFile module 51 * in the commonlibrary subsystem. 52 */ 53 constexpr ErrCode COMMON_MAPPED_FILE_ERR_OFFSET = ErrCodeOffset(SUBSYS_COMMON, MODULE_MAPPED_FILE); 54 55 enum { 56 MAPPED_FILE_ERR_OK = COMMON_MAPPED_FILE_ERR_OFFSET + 0, 57 MAPPED_FILE_ERR_FAILED = COMMON_MAPPED_FILE_ERR_OFFSET + 1, 58 }; 59 60 } // Utils 61 } // OHOS 62 63 #endif 64