Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
be9d1866
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看板
提交
be9d1866
编写于
3月 28, 2022
作者:
X
xionglei6
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: commitid
Signed-off-by:
N
xionglei6
<
xionglei6@huawei.com
>
上级
f6659018
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
8 addition
and
1 deletion
+8
-1
services/include/param/sys_param.h
services/include/param/sys_param.h
+1
-0
services/param/include/param_trie.h
services/param/include/param_trie.h
+1
-0
services/param/service/param_service.c
services/param/service/param_service.c
+4
-0
test/plugintest/plugin_param_cmd.c
test/plugintest/plugin_param_cmd.c
+2
-1
未找到文件。
services/include/param/sys_param.h
浏览文件 @
be9d1866
...
...
@@ -97,6 +97,7 @@ int SystemWatchParameter(const char *keyprefix, ParameterChangePtr change, void
void
SystemDumpParameters
(
int
verbose
);
int
SysCheckParamExist
(
const
char
*
name
);
long
long
GetSystemCommitId
();
#ifdef __cplusplus
#if __cplusplus
}
...
...
services/param/include/param_trie.h
浏览文件 @
be9d1866
...
...
@@ -85,6 +85,7 @@ typedef struct {
}
ParamSecruityNode
;
typedef
struct
{
atomic_llong
commitId
;
uint32_t
trieNodeCount
;
uint32_t
paramNodeCount
;
uint32_t
securityNodeCount
;
...
...
services/param/service/param_service.c
浏览文件 @
be9d1866
...
...
@@ -70,6 +70,8 @@ static int AddParam(WorkSpace *workSpace, const char *name, const char *value, u
uint32_t
offset
=
AddParamNode
(
workSpace
,
name
,
strlen
(
name
),
value
,
strlen
(
value
));
PARAM_CHECK
(
offset
>
0
,
return
PARAM_CODE_REACHED_MAX
,
"Failed to allocate name %s"
,
name
);
SaveIndex
(
&
node
->
dataIndex
,
offset
);
long
long
globalCommitId
=
atomic_load_explicit
(
&
workSpace
->
area
->
commitId
,
memory_order_relaxed
);
atomic_store_explicit
(
&
workSpace
->
area
->
commitId
,
++
globalCommitId
,
memory_order_release
);
}
if
(
dataIndex
!=
NULL
)
{
*
dataIndex
=
node
->
dataIndex
;
...
...
@@ -86,6 +88,7 @@ static int UpdateParam(const WorkSpace *workSpace, uint32_t *dataIndex, const ch
uint32_t
valueLen
=
strlen
(
value
);
uint32_t
commitId
=
atomic_load_explicit
(
&
entry
->
commitId
,
memory_order_relaxed
);
atomic_store_explicit
(
&
entry
->
commitId
,
commitId
|
PARAM_FLAGS_MODIFY
,
memory_order_relaxed
);
long
long
globalCommitId
=
atomic_load_explicit
(
&
workSpace
->
area
->
commitId
,
memory_order_relaxed
);
if
(
entry
->
valueLength
<
PARAM_VALUE_LEN_MAX
&&
valueLen
<
PARAM_VALUE_LEN_MAX
)
{
int
ret
=
memcpy_s
(
entry
->
data
+
entry
->
keyLength
+
1
,
PARAM_VALUE_LEN_MAX
,
value
,
valueLen
+
1
);
...
...
@@ -94,6 +97,7 @@ static int UpdateParam(const WorkSpace *workSpace, uint32_t *dataIndex, const ch
}
uint32_t
flags
=
commitId
&
~
PARAM_FLAGS_COMMITID
;
atomic_store_explicit
(
&
entry
->
commitId
,
(
++
commitId
)
|
flags
,
memory_order_release
);
atomic_store_explicit
(
&
workSpace
->
area
->
commitId
,
++
globalCommitId
,
memory_order_release
);
futex_wake
(
&
entry
->
commitId
,
INT_MAX
);
return
0
;
}
...
...
test/plugintest/plugin_param_cmd.c
浏览文件 @
be9d1866
...
...
@@ -83,7 +83,8 @@ static int32_t BShellParamCmdRead(BShellHandle shell, int32_t argc, char *argv[]
static
void
HandleParamChange
(
const
char
*
key
,
const
char
*
value
,
void
*
context
)
{
PLUGIN_CHECK
(
key
!=
NULL
&&
value
!=
NULL
,
return
,
"Invalid parameter"
);
printf
(
"Receive parameter change %s %s
\n
"
,
key
,
value
);
long
long
commit
=
GetSystemCommitId
();
printf
(
"Receive parameter commit %lld change %s %s
\n
"
,
commit
,
key
,
value
);
}
static
void
*
CmdWatcher
(
void
*
args
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录