• 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 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 typedef struct MountSharedTemplate {
30     const char *sandboxPath;
31     const char *permission;
32 } MountSharedTemplate;
33 
34 enum {
35     EL2 = 0,
36     EL3,
37     EL4,
38     EL5,
39     ELX_MAX
40 };
41 
42 typedef struct DataGroupSandboxPathTemplate {
43     const char *elxName;
44     uint32_t category;
45     const char *sandboxPath;
46     const char *permission;
47 } DataGroupSandboxPathTemplate;
48 
49 typedef struct {
50     const char *srcPath;
51     const char *destPath;
52     const char *fsType;
53     unsigned long mountFlags;
54     const char *options;
55     mode_t mountSharedFlag;
56 } SharedMountArgs;
57 
58 bool IsValidDataGroupItem(nlohmann::json &item);
59 int GetElxInfoFromDir(const char *path);
60 const DataGroupSandboxPathTemplate *GetDataGroupArgTemplate(uint32_t category);
61 void *GetEl1BundleMountCount(void);
62 int MountToShared(AppSpawnMgr *content, const AppSpawningCtx *property);
63 
64 #ifdef __cplusplus
65 }
66 #endif
67 #endif  // SANDBOX_SHARED_MOUNT_H
68