• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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 
16 #ifndef SANDBOX_SHARED_MOUNT_H
17 #define SANDBOX_SHARED_MOUNT_H
18 
19 #include "appspawn.h"
20 #include "appspawn_hook.h"
21 #include "appspawn_manager.h"
22 #include "appspawn_utils.h"
23 #include "list.h"
24 #include "json_utils.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 typedef struct MountSharedTemplate {
31     const char *sandboxPath;
32     const char *permission;
33 } MountSharedTemplate;
34 
35 enum {
36     EL2 = 0,
37     EL3,
38     EL4,
39     EL5,
40     ELX_MAX
41 };
42 
43 typedef struct DataGroupSandboxPathTemplate {
44     const char *elxName;
45     uint32_t category;
46     const char *sandboxPath;
47     const char *permission;
48 } DataGroupSandboxPathTemplate;
49 
50 struct SharedMountArgs {
51     const char *srcPath;
52     const char *destPath;
53     const char *fsType = "";
54     unsigned long mountFlags = MS_REC | MS_BIND;
55     const char *options = "";
56     mode_t mountSharedFlag = MS_SLAVE;
57 };
58 
59 bool IsValidDataGroupItem(cJSON *item);
60 int GetElxInfoFromDir(const char *path);
61 const DataGroupSandboxPathTemplate *GetDataGroupArgTemplate(uint32_t category);
62 void *GetEl1BundleMountCount(void);
63 int MountToShared(AppSpawnMgr *content, const AppSpawningCtx *property);
64 
65 #ifdef __cplusplus
66 }
67 #endif
68 #endif  // SANDBOX_SHARED_MOUNT_H
69