1 /* 2 * Copyright (c) 2021-2025 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 #ifndef STORAGE_SERVICE_CONSTANTS_H 16 #define STORAGE_SERVICE_CONSTANTS_H 17 18 #include <map> 19 #include <sys/types.h> 20 21 namespace OHOS { 22 namespace StorageService { 23 const int START_USER_ID = 100; 24 const int MAX_USER_ID = 10736; // Int32 maximum value divided by 200000 25 const int START_APP_CLONE_USER_ID = 219; 26 const int MAX_APP_CLONE_USER_ID = 239; 27 const int ZERO_USER = 0; 28 const int UID_FILE_MANAGER = 1006; 29 const uid_t USER_ID_BASE = 200000; 30 const int MAX_APP_INDEX = 5; 31 const int PRIORITY_LEVEL = -20; 32 } 33 34 namespace StorageDaemon { 35 constexpr uint32_t GLOBAL_USER_ID = 0; 36 constexpr uint32_t USER_ID_SIZE_VALUE = 16; 37 constexpr char FILE_SEPARATOR_CHAR = '/'; 38 static const std::string FILE_CONTENT_SEPARATOR = ";"; 39 static const std::string WILDCARD_DEFAULT_INCLUDE = "*"; 40 static const std::string BACKUP_PATH_PREFIX = "/data/service/el2/"; 41 static const std::string BACKUP_PATH_SURFFIX = "/backup/backup_sa/"; 42 static const std::string BACKUP_INCEXC_SYMBOL = "incExc_"; 43 static const std::string BACKUP_STAT_SYMBOL = "stat_"; 44 static const std::string BACKUP_INCLUDE = "INCLUDES"; 45 static const std::string BACKUP_EXCLUDE = "EXCLUDES"; 46 static const std::string DEFAULT_PATH_WITH_WILDCARD = "haps/*"; 47 static const std::string BASE_EL1 = "/data/storage/el1/base/"; 48 static const std::string BASE_EL2 = "/data/storage/el2/base/"; 49 static const std::string PHY_APP = "/data/app/"; 50 static const std::string BASE = "/base/"; 51 static const std::string DEFAULT_INCLUDE_PATH_IN_HAP_FILES = "files"; 52 static const std::string DEFAULT_INCLUDE_PATH_IN_HAP_DATABASE = "database"; 53 static const std::string DEFAULT_INCLUDE_PATH_IN_HAP_PREFERENCE = "preferences"; 54 static const std::string URI_PREFIX = "file://"; 55 static const std::string NORMAL_SAND_PREFIX = "/data/storage"; 56 static const std::string FILE_SAND_PREFIX = "/storage/Users"; 57 static const std::string MEDIA_CLOUD_SAND_PREFIX = "/storage/cloud"; 58 static const std::string MEDIA_SAND_PREFIX = "/storage/media"; 59 static const std::string FILE_AUTHORITY = "docs"; 60 static const std::string MEDIALIBRARY_NAME = "com.ohos.medialibrary.medialibrarydata"; 61 static const std::string MEDIA_FUSE_EL2 = "/data/storage/el2/media/"; 62 63 // backup stat file version 64 static const std::string VER_10_LINE1 = "version=1.0&attrNum=8"; 65 static const std::string VER_10_LINE2 = "path;mode;dir;size;mtime;hash;isIncremental;encodeFlag"; 66 67 static const std::string EL1 = "el1"; 68 static const std::string EL2 = "el2"; 69 static const std::string EL3 = "el3"; 70 static const std::string EL4 = "el4"; 71 static const std::string EL5 = "el5"; 72 73 enum KeyType { 74 EL1_KEY = 1, 75 EL2_KEY = 2, 76 EL3_KEY = 3, 77 EL4_KEY = 4, 78 EL5_KEY = 5, 79 }; 80 static std::map<std::string, KeyType> EL_DIR_MAP = { 81 {EL1, EL1_KEY}, 82 {EL2, EL2_KEY}, 83 {EL3, EL3_KEY}, 84 {EL4, EL4_KEY}, 85 {EL5, EL5_KEY}, 86 }; 87 88 enum QuotaIdType { 89 USRID, 90 GRPID, 91 PRJID 92 }; 93 } 94 } 95 96 #endif // STORAGE_SERVICE_CONSTANTS_H