1 /*
2  * Copyright (c) 2021 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 int32_t USER_ID_BASE = 200000;
30 const int MAX_APP_INDEX = 5;
31 }
32 
33 namespace StorageDaemon {
34 constexpr uint32_t GLOBAL_USER_ID = 0;
35 constexpr uint32_t USER_ID_SIZE_VALUE = 16;
36 
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 
61 // backup stat file version
62 static const std::string VER_10_LINE1 = "version=1.0&attrNum=8";
63 static const std::string VER_10_LINE2 = "path;mode;dir;size;mtime;hash;isIncremental;encodeFlag";
64 
65 static const std::string EL1 = "el1";
66 static const std::string EL2 = "el2";
67 static const std::string EL3 = "el3";
68 static const std::string EL4 = "el4";
69 static const std::string EL5 = "el5";
70 
71 enum KeyType {
72     EL1_KEY = 1,
73     EL2_KEY = 2,
74     EL3_KEY = 3,
75     EL4_KEY = 4,
76     EL5_KEY = 5,
77 };
78 static std::map<std::string, KeyType> EL_DIR_MAP = {
79     {EL1, EL1_KEY},
80     {EL2, EL2_KEY},
81     {EL3, EL3_KEY},
82     {EL4, EL4_KEY},
83     {EL5, EL5_KEY},
84 };
85 
86 enum QuotaIdType {
87     USRID,
88     GRPID,
89     PRJID
90 };
91 }
92 }
93 
94 #endif // STORAGE_SERVICE_CONSTANTS_H