Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
fa8aafa5
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
大约 1 年 前同步成功
通知
3
Star
37
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Startup Init Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
fa8aafa5
编写于
4月 19, 2022
作者:
O
openharmony_ci
提交者:
Gitee
4月 19, 2022
浏览文件
操作
浏览文件
下载
差异文件
!532 optimize sandbox global variable as const
Merge pull request !532 from handy/0419
上级
d273f671
93516c8d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
8 addition
and
8 deletion
+8
-8
interfaces/innerkits/sandbox/sandbox.c
interfaces/innerkits/sandbox/sandbox.c
+8
-8
未找到文件。
interfaces/innerkits/sandbox/sandbox.c
100644 → 100755
浏览文件 @
fa8aafa5
...
@@ -53,7 +53,7 @@ struct SandboxMountFlags {
...
@@ -53,7 +53,7 @@ struct SandboxMountFlags {
unsigned
long
value
;
unsigned
long
value
;
};
};
struct
SandboxMountFlags
g_flags
[]
=
{
st
atic
const
st
ruct
SandboxMountFlags
g_flags
[]
=
{
{
{
.
flag
=
"bind"
,
.
flag
=
"bind"
,
.
value
=
MS_BIND
,
.
value
=
MS_BIND
,
...
@@ -84,7 +84,7 @@ struct SandboxMap {
...
@@ -84,7 +84,7 @@ struct SandboxMap {
const
char
*
configfile
;
const
char
*
configfile
;
};
};
struct
SandboxMap
g_map
[]
=
{
st
atic
const
st
ruct
SandboxMap
g_map
[]
=
{
{
{
.
name
=
"system"
,
.
name
=
"system"
,
.
sandbox
=
&
g_systemSandbox
,
.
sandbox
=
&
g_systemSandbox
,
...
@@ -276,7 +276,7 @@ static int ParseSandboxConfig(sandbox_t *sandbox, const char *sandboxConfig)
...
@@ -276,7 +276,7 @@ static int ParseSandboxConfig(sandbox_t *sandbox, const char *sandboxConfig)
return
0
;
return
0
;
}
}
static
struct
SandboxMap
*
GetSandboxMapByName
(
const
char
*
name
)
static
const
struct
SandboxMap
*
GetSandboxMapByName
(
const
char
*
name
)
{
{
if
(
name
==
NULL
)
{
if
(
name
==
NULL
)
{
BEGET_LOGE
(
"Failed get sandbox map name is NULL."
);
BEGET_LOGE
(
"Failed get sandbox map name is NULL."
);
...
@@ -445,7 +445,7 @@ int PrepareSandbox(const char *name)
...
@@ -445,7 +445,7 @@ int PrepareSandbox(const char *name)
{
{
BEGET_ERROR_CHECK
(
name
!=
NULL
,
return
-
1
,
"Prepare sandbox name is NULL."
);
BEGET_ERROR_CHECK
(
name
!=
NULL
,
return
-
1
,
"Prepare sandbox name is NULL."
);
BEGET_ERROR_CHECK
(
getuid
()
==
0
,
return
-
1
,
"Current process uid is not root, exit."
);
BEGET_ERROR_CHECK
(
getuid
()
==
0
,
return
-
1
,
"Current process uid is not root, exit."
);
struct
SandboxMap
*
map
=
GetSandboxMapByName
(
name
);
const
struct
SandboxMap
*
map
=
GetSandboxMapByName
(
name
);
BEGET_ERROR_CHECK
(
map
!=
NULL
,
return
-
1
,
"Failed get sandbox map by name %s."
,
name
);
BEGET_ERROR_CHECK
(
map
!=
NULL
,
return
-
1
,
"Failed get sandbox map by name %s."
,
name
);
sandbox_t
*
sandbox
=
map
->
sandbox
;
sandbox_t
*
sandbox
=
map
->
sandbox
;
BEGET_CHECK
(
IsValidSandbox
(
sandbox
)
==
true
,
return
-
1
);
BEGET_CHECK
(
IsValidSandbox
(
sandbox
)
==
true
,
return
-
1
);
...
@@ -549,7 +549,7 @@ bool InitSandboxWithName(const char *name)
...
@@ -549,7 +549,7 @@ bool InitSandboxWithName(const char *name)
BEGET_LOGE
(
"Init sandbox name is NULL."
);
BEGET_LOGE
(
"Init sandbox name is NULL."
);
return
isFound
;
return
isFound
;
}
}
struct
SandboxMap
*
map
=
GetSandboxMapByName
(
name
);
const
struct
SandboxMap
*
map
=
GetSandboxMapByName
(
name
);
if
(
map
!=
NULL
)
{
if
(
map
!=
NULL
)
{
InitSandbox
(
map
->
sandbox
,
map
->
configfile
,
name
);
InitSandbox
(
map
->
sandbox
,
map
->
configfile
,
name
);
isFound
=
true
;
isFound
=
true
;
...
@@ -567,7 +567,7 @@ void DestroySandbox(const char *name)
...
@@ -567,7 +567,7 @@ void DestroySandbox(const char *name)
BEGET_LOGE
(
"Destroy sandbox name is NULL."
);
BEGET_LOGE
(
"Destroy sandbox name is NULL."
);
return
;
return
;
}
}
struct
SandboxMap
*
map
=
GetSandboxMapByName
(
name
);
const
struct
SandboxMap
*
map
=
GetSandboxMapByName
(
name
);
if
(
map
==
NULL
)
{
if
(
map
==
NULL
)
{
BEGET_LOGE
(
"Failed get sandbox map by name %s."
,
name
);
BEGET_LOGE
(
"Failed get sandbox map by name %s."
,
name
);
return
;
return
;
...
@@ -597,7 +597,7 @@ int EnterSandbox(const char *name)
...
@@ -597,7 +597,7 @@ int EnterSandbox(const char *name)
BEGET_LOGE
(
"Sandbox name is NULL."
);
BEGET_LOGE
(
"Sandbox name is NULL."
);
return
-
1
;
return
-
1
;
}
}
struct
SandboxMap
*
map
=
GetSandboxMapByName
(
name
);
const
struct
SandboxMap
*
map
=
GetSandboxMapByName
(
name
);
if
(
map
==
NULL
)
{
if
(
map
==
NULL
)
{
BEGET_LOGE
(
"Failed to get sandbox map by name %s."
,
name
);
BEGET_LOGE
(
"Failed to get sandbox map by name %s."
,
name
);
return
-
1
;
return
-
1
;
...
@@ -629,7 +629,7 @@ void DumpSandboxByName(const char *name)
...
@@ -629,7 +629,7 @@ void DumpSandboxByName(const char *name)
BEGET_LOGE
(
"Init sandbox name is NULL."
);
BEGET_LOGE
(
"Init sandbox name is NULL."
);
return
;
return
;
}
}
struct
SandboxMap
*
map
=
GetSandboxMapByName
(
name
);
const
struct
SandboxMap
*
map
=
GetSandboxMapByName
(
name
);
if
(
map
==
NULL
)
{
if
(
map
==
NULL
)
{
return
;
return
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录