• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 = 0;
24 const int MAX_USER_ID = 10738; // user id range is (0, 10737]
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 int32_t USER_ID_BASE = 200000;
30 const int32_t APP_UID = 20000000;
31 const int32_t ZERO_USER_MIN_UID = 20000;
32 const int32_t ZERO_USER_MAX_UID = 65535;
33 const int MAX_APP_INDEX = 5;
34 const int PRIORITY_LEVEL = -20;
35 }
36 
37 namespace StorageDaemon {
38 constexpr uint32_t GLOBAL_USER_ID = 0;
39 constexpr uint32_t USER_ID_SIZE_VALUE = 16;
40 constexpr char FILE_SEPARATOR_CHAR = '/';
41 static const std::string FILE_CONTENT_SEPARATOR = ";";
42 static const std::string WILDCARD_DEFAULT_INCLUDE = "*";
43 static const std::string BACKUP_PATH_PREFIX = "/data/service/el2/";
44 static const std::string BACKUP_PATH_SURFFIX = "/backup/backup_sa/";
45 static const std::string BACKUP_INCEXC_SYMBOL = "incExc_";
46 static const std::string BACKUP_STAT_SYMBOL = "stat_";
47 static const std::string BACKUP_INCLUDE = "INCLUDES";
48 static const std::string BACKUP_EXCLUDE = "EXCLUDES";
49 static const std::string DEFAULT_PATH_WITH_WILDCARD = "haps/*";
50 static const std::string BASE_EL1 = "/data/storage/el1/base/";
51 static const std::string BASE_EL2 = "/data/storage/el2/base/";
52 static const std::string PHY_APP = "/data/app/";
53 static const std::string BASE = "/base/";
54 static const std::string DEFAULT_INCLUDE_PATH_IN_HAP_FILES = "files";
55 static const std::string DEFAULT_INCLUDE_PATH_IN_HAP_DATABASE = "database";
56 static const std::string DEFAULT_INCLUDE_PATH_IN_HAP_PREFERENCE = "preferences";
57 static const std::string URI_PREFIX = "file://";
58 static const std::string NORMAL_SAND_PREFIX = "/data/storage";
59 static const std::string FILE_SAND_PREFIX = "/storage/Users";
60 static const std::string MEDIA_CLOUD_SAND_PREFIX = "/storage/cloud";
61 static const std::string MEDIA_SAND_PREFIX = "/storage/media";
62 static const std::string FILE_AUTHORITY = "docs";
63 static const std::string MEDIALIBRARY_NAME = "com.ohos.medialibrary.medialibrarydata";
64 static const std::string MEDIA_FUSE_EL2 = "/data/storage/el2/media/";
65 
66 // backup stat file version
67 static const std::string VER_10_LINE1 = "version=1.0&attrNum=8";
68 static const std::string VER_10_LINE2 = "path;mode;dir;size;mtime;hash;isIncremental;encodeFlag";
69 
70 static const std::string EL1 = "el1";
71 static const std::string EL2 = "el2";
72 static const std::string EL3 = "el3";
73 static const std::string EL4 = "el4";
74 static const std::string EL5 = "el5";
75 
76 static const std::string UN_REACHABLE = "(unreachable)";
77 static const std::string PID_CWD = "cwd";
78 static const std::string PID_EXE = "exe";
79 static const std::string PID_ROOT = "root";
80 static const std::string PID_FD = "fd";
81 static const std::string PID_PROC = "/proc";
82 
83 enum KeyType {
84     EL1_KEY = 1,
85     EL2_KEY = 2,
86     EL3_KEY = 3,
87     EL4_KEY = 4,
88     EL5_KEY = 5,
89 };
90 static std::map<std::string, KeyType> EL_DIR_MAP = {
91     {EL1, EL1_KEY},
92     {EL2, EL2_KEY},
93     {EL3, EL3_KEY},
94     {EL4, EL4_KEY},
95     {EL5, EL5_KEY},
96 };
97 
98 enum QuotaIdType {
99     USRID,
100     GRPID,
101     PRJID
102 };
103 
104 enum IStorageDaemonEnum {
105     CRYPTO_FLAG_EL1 = 1,
106     CRYPTO_FLAG_EL2 = 2,
107     CRYPTO_FLAG_EL3 = 4,
108     CRYPTO_FLAG_EL4 = 8,
109     CRYPTO_FLAG_EL5 = 16,
110 };
111 }
112 }
113 
114 #endif // STORAGE_SERVICE_CONSTANTS_H