Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
30c3a96e
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,发现更多精彩内容 >>
提交
30c3a96e
编写于
6月 17, 2022
作者:
M
Mupceet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
l1接口返回值适配
Signed-off-by:
N
Mupceet
<
laiguizhong@huawei.com
>
上级
093b3ac7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
25 addition
and
10 deletion
+25
-10
interfaces/innerkits/syspara/param_comm.c
interfaces/innerkits/syspara/param_comm.c
+8
-5
interfaces/innerkits/syspara/parameter.c
interfaces/innerkits/syspara/parameter.c
+5
-1
services/begetctl/BUILD.gn
services/begetctl/BUILD.gn
+2
-1
services/param/base/param_trie.c
services/param/base/param_trie.c
+7
-0
test/unittest/syspara/syspara_unittest.cpp
test/unittest/syspara/syspara_unittest.cpp
+3
-3
未找到文件。
interfaces/innerkits/syspara/param_comm.c
浏览文件 @
30c3a96e
...
...
@@ -50,11 +50,14 @@ INIT_LOCAL_API int GetParameter_(const char *key, const char *def, char *value,
}
uint32_t
size
=
len
;
int
ret
=
SystemGetParameter
(
key
,
NULL
,
&
size
);
if
(
ret
==
PARAM_CODE_INVALID_NAME
||
ret
==
DAC_RESULT_FORBIDED
||
ret
==
PARAM_CODE_INVALID_PARAM
)
{
return
EC_FAILURE
;
}
if
((
size
>
len
)
||
(
ret
!=
0
))
{
return
strcpy_s
(
value
,
len
,
def
);
if
(
ret
!=
0
)
{
if
(
def
==
NULL
||
strlen
(
def
)
>
len
)
{
return
EC_INVALID
;
}
ret
=
strcpy_s
(
value
,
len
,
def
);
return
(
ret
==
0
)
?
0
:
EC_FAILURE
;
}
else
if
(
size
>
len
)
{
return
EC_INVALID
;
}
size
=
len
;
return
(
SystemGetParameter
(
key
,
value
,
&
size
)
==
0
)
?
EC_SUCCESS
:
EC_FAILURE
;
...
...
interfaces/innerkits/syspara/parameter.c
浏览文件 @
30c3a96e
...
...
@@ -75,7 +75,7 @@ int GetParameter(const char *key, const char *def, char *value, uint32_t len)
return
EC_INVALID
;
}
int
ret
=
GetParameter_
(
key
,
def
,
value
,
len
);
return
(
ret
!=
0
)
?
EC_INVALID
:
strlen
(
value
);
return
(
ret
!=
0
)
?
ret
:
strlen
(
value
);
}
int
GetIntParameter
(
const
char
*
key
,
int
def
)
...
...
@@ -99,6 +99,10 @@ int SetParameter(const char *key, const char *value)
return
EC_INVALID
;
}
int
ret
=
SystemSetParameter
(
key
,
value
);
if
(
ret
==
PARAM_CODE_INVALID_NAME
||
ret
==
DAC_RESULT_FORBIDED
||
ret
==
PARAM_CODE_INVALID_PARAM
||
ret
==
PARAM_CODE_INVALID_VALUE
)
{
return
EC_INVALID
;
}
return
(
ret
==
0
)
?
EC_SUCCESS
:
EC_FAILURE
;
}
...
...
services/begetctl/BUILD.gn
浏览文件 @
30c3a96e
...
...
@@ -189,7 +189,8 @@ if (defined(ohos_lite)) {
deps = [
"//base/startup/init_lite/services/log:agent_log",
"//base/startup/init_lite/services/loopevent:loopevent",
"//base/startup/init_lite/services/param:parameter",
"//base/startup/init_lite/services/param/base:parameterbase",
"//base/startup/init_lite/services/param/linux:param_client",
"//base/startup/init_lite/services/utils:libinit_utils",
"//third_party/bounds_checking_function:libsec_static",
]
...
...
services/param/base/param_trie.c
浏览文件 @
30c3a96e
...
...
@@ -409,5 +409,12 @@ INIT_LOCAL_API ParamTrieNode *FindTrieNode(WorkSpace *workSpace,
PARAMSPACE_AREA_RD_LOCK
(
workSpace
);
node
=
FindTrieNode_
(
workSpace
,
key
,
keyLen
,
matchLabel
);
PARAMSPACE_AREA_RW_UNLOCK
(
workSpace
);
if
(
node
!=
NULL
&&
node
->
dataIndex
!=
0
)
{
ParamNode
*
entry
=
(
ParamNode
*
)
GetTrieNode
(
workSpace
,
node
->
dataIndex
);
if
(
entry
!=
NULL
&&
entry
->
keyLength
==
keyLen
)
{
return
node
;
}
return
NULL
;
}
return
node
;
}
\ No newline at end of file
test/unittest/syspara/syspara_unittest.cpp
浏览文件 @
30c3a96e
...
...
@@ -115,7 +115,7 @@ HWTEST_F(SysparaUnitTest, parameterTest003, TestSize.Level0)
char
key2
[]
=
"rw.sys.version*%version"
;
char
value2
[]
=
"set value with illegal key"
;
int
ret
=
SetParameter
(
key2
,
value2
);
EXPECT_EQ
(
ret
,
EC_
FAILURE
);
EXPECT_EQ
(
ret
,
EC_
INVALID
);
}
/* key = 32 */
...
...
@@ -134,7 +134,7 @@ HWTEST_F(SysparaUnitTest, parameterTest005, TestSize.Level0)
char
value4
[]
=
"rw.sys.version.version.version.version flash_offset = *(hi_u32 *)DT_SetGetU32(&g_Element[0], 0)a\
size = *(hi_u32 *)DT_SetGetU32(&g_Element[1], 0)a"
;
int
ret
=
SetParameter
(
key4
,
value4
);
EXPECT_EQ
(
ret
,
EC_
FAILURE
);
EXPECT_EQ
(
ret
,
EC_
INVALID
);
}
HWTEST_F
(
SysparaUnitTest
,
parameterTest006
,
TestSize
.
Level0
)
...
...
@@ -170,7 +170,7 @@ HWTEST_F(SysparaUnitTest, parameterTest009, TestSize.Level0)
char
value5
[]
=
"rw.sys.version.version.version.version \
flash_offset = *(hi_u32 *)DT_SetGetU32(&g_Element[0], 0)"
;
int
ret
=
SetParameter
(
key5
,
value5
);
EXPECT_EQ
(
ret
,
EC_
FAILURE
);
EXPECT_EQ
(
ret
,
EC_
INVALID
);
char
valueGet
[
2
]
=
{
0
};
char
defValue3
[]
=
"value of key > 32 ..."
;
ret
=
GetParameter
(
key5
,
defValue3
,
valueGet
,
2
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录