Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
3c4f16cc
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看板
未验证
提交
3c4f16cc
编写于
3月 29, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 29, 2022
浏览文件
操作
浏览文件
下载
差异文件
!430 支持native 接口校验
Merge pull request !430 from 熊磊/init0315_2
上级
c95ca75f
3c5ab30b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
15 addition
and
4 deletion
+15
-4
device_info/device_info_stub.cpp
device_info/device_info_stub.cpp
+1
-3
services/include/param/sys_param.h
services/include/param/sys_param.h
+1
-0
services/param/client/param_request.c
services/param/client/param_request.c
+6
-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
未找到文件。
device_info/device_info_stub.cpp
浏览文件 @
3c4f16cc
...
...
@@ -77,9 +77,7 @@ bool DeviceInfoStub::CheckPermission(MessageParcel &data, const std::string &per
int32_t
result
=
TypePermissionState
::
PERMISSION_GRANTED
;
int32_t
tokenType
=
AccessTokenKit
::
GetTokenTypeFlag
(
callerToken
);
if
(
tokenType
==
TOKEN_NATIVE
)
{
#ifdef SUPPORT_NATIVE
result
=
AccessTokenKit
::
VerifyNativeToken
(
callerToken
,
permission
);
#endif
}
else
if
(
tokenType
==
TOKEN_HAP
)
{
result
=
AccessTokenKit
::
VerifyAccessToken
(
callerToken
,
permission
);
}
else
{
...
...
@@ -90,7 +88,7 @@ bool DeviceInfoStub::CheckPermission(MessageParcel &data, const std::string &per
DINFO_LOGE
(
"AccessTokenID:%d, permission:%s denied!"
,
callerToken
,
permission
.
c_str
());
return
false
;
}
DINFO_LOGI
(
"
dAccessTokenID:%d, permission:%s matched!"
,
callerToken
,
permission
.
c_str
());
DINFO_LOGI
(
"
tokenType %d dAccessTokenID:%d, permission:%s matched!"
,
tokenType
,
callerToken
,
permission
.
c_str
());
return
true
;
}
...
...
services/include/param/sys_param.h
浏览文件 @
3c4f16cc
...
...
@@ -97,6 +97,7 @@ int SystemWatchParameter(const char *keyprefix, ParameterChangePtr change, void
void
SystemDumpParameters
(
int
verbose
);
int
SysCheckParamExist
(
const
char
*
name
);
long
long
GetSystemCommitId
(
void
);
#ifdef __cplusplus
#if __cplusplus
}
...
...
services/param/client/param_request.c
浏览文件 @
3c4f16cc
...
...
@@ -307,6 +307,12 @@ int SystemGetParameterCommitId(ParamHandle handle, uint32_t *commitId)
return
ReadParamCommitId
(
&
g_clientSpace
.
paramSpace
,
handle
,
commitId
);
}
long
long
GetSystemCommitId
(
void
)
{
PARAM_CHECK
(
g_clientSpace
.
paramSpace
.
paramSpace
.
area
!=
NULL
,
return
0
,
"The handle is null"
);
return
g_clientSpace
.
paramSpace
.
paramSpace
.
area
->
commitId
;
}
int
SystemGetParameterName
(
ParamHandle
handle
,
char
*
name
,
unsigned
int
len
)
{
PARAM_CHECK
(
name
!=
NULL
&&
handle
!=
0
,
return
-
1
,
"The name is null"
);
...
...
services/param/include/param_trie.h
浏览文件 @
3c4f16cc
...
...
@@ -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
浏览文件 @
3c4f16cc
...
...
@@ -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
浏览文件 @
3c4f16cc
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录