Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
b31dcaea
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,发现更多精彩内容 >>
提交
b31dcaea
编写于
9月 16, 2021
作者:
S
sun_fan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
init: delete LoadParamFromCmdLine
Signed-off-by:
N
sun_fan
<
sun_fan1@hoperun.com
>
上级
2a78a5a1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
0 addition
and
59 deletion
+0
-59
services/param/service/param_service.c
services/param/service/param_service.c
+0
-59
未找到文件。
services/param/service/param_service.c
浏览文件 @
b31dcaea
...
...
@@ -531,61 +531,6 @@ static int FindKey(const char *key, struct CmdLineEntry *cmdLineEntry, int lengt
return
0
;
}
static
int
LoadParamFromCmdLine
(
struct
CmdLineEntry
*
cmdLineEntry
,
int
length
)
{
PARAM_CHECK
(
cmdLineEntry
!=
NULL
&&
length
>
0
,
return
-
1
,
"Input params error."
);
char
*
buffer
=
ReadFileData
(
PARAM_CMD_LINE
);
PARAM_CHECK
(
buffer
!=
NULL
,
return
-
1
,
"Failed to read file %s"
,
PARAM_CMD_LINE
);
char
*
data
=
malloc
(
PARAM_NAME_LEN_MAX
+
PARAM_CONST_VALUE_LEN_MAX
);
PARAM_CHECK
(
data
!=
NULL
,
free
(
buffer
);
return
-
1
,
"Failed to read file %s"
,
PARAM_CMD_LINE
);
char
*
endBuffer
=
buffer
+
strlen
(
buffer
);
char
*
key
=
data
;
char
*
value
=
data
+
PARAM_NAME_LEN_MAX
;
char
*
tmp
=
strchr
(
buffer
,
'='
);
char
*
next
=
buffer
;
while
(
tmp
!=
0
)
{
int
ret
=
CopyBootParam
(
key
,
next
,
tmp
-
next
-
1
);
int
ret1
=
0
;
next
=
strchr
(
tmp
+
1
,
'='
);
if
(
next
!=
NULL
)
{
while
(
!
isspace
(
*
next
)
&&
(
next
>
buffer
))
{
// 直到属性值结束位置
next
--
;
}
while
(
isspace
(
*
next
)
&&
(
next
>
buffer
))
{
// 去掉空格
next
--
;
}
ret1
=
strncpy_s
(
value
,
PARAM_CONST_VALUE_LEN_MAX
-
1
,
tmp
+
1
,
next
-
tmp
);
next
++
;
while
(
isspace
(
*
next
)
&&
(
next
<
endBuffer
))
{
// 跳过空格
next
++
;
}
}
else
{
ret1
=
strncpy_s
(
value
,
PARAM_CONST_VALUE_LEN_MAX
-
1
,
tmp
+
1
,
endBuffer
-
tmp
);
}
if
((
ret
==
0
)
&&
(
ret1
==
0
)
&&
(
CheckParamName
(
key
,
0
)
==
0
))
{
uint32_t
dataIndex
=
0
;
if
(
FindKey
(
key
,
cmdLineEntry
,
length
)
==
1
)
{
PARAM_LOGD
(
"LoadParamFromCmdLine %s %s"
,
key
,
value
);
(
void
)
WriteParam
(
&
g_paramWorkSpace
.
paramSpace
,
key
,
value
,
&
dataIndex
,
0
);
}
}
if
(
next
==
NULL
)
{
break
;
}
tmp
=
strchr
(
next
,
'='
);
}
for
(
int
i
=
0
;
i
<
length
;
i
++
)
{
if
(
cmdLineEntry
[
i
].
set
==
0
)
{
PARAM_LOGI
(
"Warning, LoadParamFromCmdLine key %s is not found."
,
cmdLineEntry
[
i
].
key
);
}
}
free
(
data
);
free
(
buffer
);
return
0
;
}
int
SystemWriteParam
(
const
char
*
name
,
const
char
*
value
)
{
PARAM_CHECK
(
name
!=
NULL
&&
value
!=
NULL
,
return
-
1
,
"The name is null"
);
...
...
@@ -680,10 +625,6 @@ void InitParamService(void)
auditData
.
dacData
.
mode
=
DAC_ALL_PERMISSION
;
ret
=
AddSecurityLabel
(
&
auditData
,
(
void
*
)
&
g_paramWorkSpace
);
PARAM_CHECK
(
ret
==
0
,
return
,
"Failed to add default dac label"
);
// 读取cmdline的参数
struct
CmdLineEntry
cmdLineEntry
[]
=
{{
"hardware"
,
0
}};
LoadParamFromCmdLine
(
cmdLineEntry
,
sizeof
(
cmdLineEntry
)
/
sizeof
(
cmdLineEntry
[
0
]));
}
static
void
OnPidDelete
(
pid_t
pid
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录