Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
220326bd
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
接近 2 年 前同步成功
通知
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看板
提交
220326bd
编写于
10月 18, 2021
作者:
4
411148299@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix code style
Signed-off-by:
N
411148299@qq.com
<
411148299@qq.com
>
上级
8bc44fcc
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
29 addition
and
44 deletion
+29
-44
services/init/standard/device.c
services/init/standard/device.c
+1
-1
services/init/standard/init.c
services/init/standard/init.c
+1
-1
services/init/standard/init_cmds.c
services/init/standard/init_cmds.c
+1
-1
services/init/standard/switch_root.c
services/init/standard/switch_root.c
+14
-14
services/param/cmd/param_cmd.c
services/param/cmd/param_cmd.c
+1
-3
services/param/trigger/trigger_processor.c
services/param/trigger/trigger_processor.c
+3
-5
services/test/unittest/init/service_unittest.cpp
services/test/unittest/init/service_unittest.cpp
+0
-1
services/test/unittest/param/client_unittest.cpp
services/test/unittest/param/client_unittest.cpp
+1
-1
services/test/unittest/param/param_unittest.cpp
services/test/unittest/param/param_unittest.cpp
+3
-3
services/test/unittest/param/watcher_proxy_unittest.cpp
services/test/unittest/param/watcher_proxy_unittest.cpp
+2
-3
services/test/unittest/test_data/proc/cmdline
services/test/unittest/test_data/proc/cmdline
+0
-1
services/test/unittest/test_data/system/etc/param/persist_parameters
...st/unittest/test_data/system/etc/param/persist_parameters
+0
-8
services/utils/init_utils.c
services/utils/init_utils.c
+0
-1
watchdog/linux/init_linux_watchdog.c
watchdog/linux/init_linux_watchdog.c
+2
-1
未找到文件。
services/init/standard/device.c
浏览文件 @
220326bd
...
@@ -16,11 +16,11 @@
...
@@ -16,11 +16,11 @@
#include <errno.h>
#include <errno.h>
#include <fcntl.h>
#include <fcntl.h>
#include <linux/major.h>
#include <sys/mount.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/stat.h>
#include <sys/sysmacros.h>
#include <sys/sysmacros.h>
#include <linux/major.h>
#include "init_log.h"
#include "init_log.h"
#define DEFAULT_RW_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
#define DEFAULT_RW_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
...
...
services/init/standard/init.c
浏览文件 @
220326bd
...
@@ -20,8 +20,8 @@
...
@@ -20,8 +20,8 @@
#include <sys/sysmacros.h>
#include <sys/sysmacros.h>
#include <sys/stat.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/types.h>
#include <linux/major.h>
#include <linux/major.h>
#include "device.h"
#include "device.h"
#include "init_log.h"
#include "init_log.h"
#include "init_mount.h"
#include "init_mount.h"
...
...
services/init/standard/init_cmds.c
浏览文件 @
220326bd
...
@@ -17,7 +17,6 @@
...
@@ -17,7 +17,6 @@
#include <ctype.h>
#include <ctype.h>
#include <errno.h>
#include <errno.h>
#include <fcntl.h>
#include <fcntl.h>
#include <linux/module.h>
#include <net/if.h>
#include <net/if.h>
#include <stdbool.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdio.h>
...
@@ -32,6 +31,7 @@
...
@@ -32,6 +31,7 @@
#include <sys/wait.h>
#include <sys/wait.h>
#include <unistd.h>
#include <unistd.h>
#include <linux/module.h>
#include "fs_manager/fs_manager.h"
#include "fs_manager/fs_manager.h"
#include "init.h"
#include "init.h"
#include "init_jobs.h"
#include "init_jobs.h"
...
...
services/init/standard/switch_root.c
浏览文件 @
220326bd
...
@@ -50,20 +50,20 @@ static void FreeOldRoot(DIR *dir, dev_t dev)
...
@@ -50,20 +50,20 @@ static void FreeOldRoot(DIR *dir, dev_t dev)
if
(
st
.
st_dev
!=
dev
)
{
if
(
st
.
st_dev
!=
dev
)
{
continue
;
// Not the same device, ignore.
continue
;
// Not the same device, ignore.
}
}
if
(
!
S_ISDIR
(
st
.
st_mode
))
{
if
(
S_ISDIR
(
st
.
st_mode
))
{
continue
;
int
fd
=
openat
(
dfd
,
de
->
d_name
,
O_RDONLY
|
O_DIRECTORY
);
}
isDir
=
true
;
int
fd
=
openat
(
dfd
,
de
->
d_name
,
O_RDONLY
|
O_DIRECTORY
)
;
if
(
fd
<
0
)
{
isDir
=
true
;
continue
;
if
(
fd
<
0
)
{
}
continue
;
DIR
*
subDir
=
fdopendir
(
fd
);
}
if
(
subDir
!=
NULL
)
{
DIR
*
subDir
=
fdopendir
(
fd
);
FreeOldRoot
(
subDir
,
dev
);
if
(
subDir
!=
NULL
)
{
closedir
(
subDir
);
FreeOldRoot
(
subDir
,
dev
);
}
else
{
closedir
(
subDir
);
close
(
fd
);
}
else
{
}
close
(
fd
);
}
}
}
}
if
(
unlinkat
(
dfd
,
de
->
d_name
,
isDir
?
AT_REMOVEDIR
:
0
)
<
0
)
{
if
(
unlinkat
(
dfd
,
de
->
d_name
,
isDir
?
AT_REMOVEDIR
:
0
)
<
0
)
{
...
...
services/param/cmd/param_cmd.c
浏览文件 @
220326bd
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
#include <time.h>
#include "param_manager.h"
#include "param_manager.h"
#include "param_utils.h"
#include "param_utils.h"
...
@@ -112,9 +111,8 @@ static void ExeuteCmdParamRead(int argc, char *argv[], int start)
...
@@ -112,9 +111,8 @@ static void ExeuteCmdParamRead(int argc, char *argv[], int start)
SystemSetParameter
(
"test.randrom.test.start"
,
"1"
);
SystemSetParameter
(
"test.randrom.test.start"
,
"1"
);
char
buffer
[
PARAM_NAME_LEN_MAX
]
=
{
0
};
char
buffer
[
PARAM_NAME_LEN_MAX
]
=
{
0
};
printf
(
"SystemGetParameter start
\n
"
);
printf
(
"SystemGetParameter start
\n
"
);
(
void
)
srand
((
unsigned
)
time
(
NULL
));
while
(
1
)
{
while
(
1
)
{
int
wait
=
rand
()
/
READ_DURATION
+
READ_DURATION
;
// 100ms
int
wait
=
READ_DURATION
+
READ_DURATION
;
// 100ms
uint32_t
size
=
PARAM_NAME_LEN_MAX
;
uint32_t
size
=
PARAM_NAME_LEN_MAX
;
int
ret
=
SystemGetParameter
(
argv
[
start
],
buffer
,
&
size
);
int
ret
=
SystemGetParameter
(
argv
[
start
],
buffer
,
&
size
);
if
(
ret
==
0
)
{
if
(
ret
==
0
)
{
...
...
services/param/trigger/trigger_processor.c
浏览文件 @
220326bd
...
@@ -13,7 +13,6 @@
...
@@ -13,7 +13,6 @@
* limitations under the License.
* limitations under the License.
*/
*/
#include <unistd.h>
#include <unistd.h>
#include <time.h>
#include "init_cmds.h"
#include "init_cmds.h"
#include "init_param.h"
#include "init_param.h"
#include "init_service_manager.h"
#include "init_service_manager.h"
...
@@ -43,8 +42,7 @@ static void AddTestTrigger(const TriggerWorkSpace *workSpace)
...
@@ -43,8 +42,7 @@ static void AddTestTrigger(const TriggerWorkSpace *workSpace)
static
void
TestTimerCallback
(
ParamTaskPtr
timer
,
void
*
context
)
static
void
TestTimerCallback
(
ParamTaskPtr
timer
,
void
*
context
)
{
{
(
void
)
srand
((
unsigned
)
time
(
NULL
));
char
buffer
[
32
]
=
{
0
};
// 32 buffer size
char
buffer
[
32
]
=
{
0
};
static
int
index
=
0
;
static
int
index
=
0
;
index
++
;
index
++
;
if
(
index
>=
MAX_COUNT
)
{
if
(
index
>=
MAX_COUNT
)
{
...
@@ -53,8 +51,8 @@ static void TestTimerCallback(ParamTaskPtr timer, void *context)
...
@@ -53,8 +51,8 @@ static void TestTimerCallback(ParamTaskPtr timer, void *context)
static
uint32_t
value
=
0
;
static
uint32_t
value
=
0
;
int
count
=
0
;
int
count
=
0
;
while
(
count
<
MAX_COUNT
)
{
while
(
count
<
MAX_COUNT
)
{
int
wait
=
rand
()
/
READ_DURATION
+
READ_DURATION
;
// 100ms
int
wait
=
READ_DURATION
+
READ_DURATION
;
// 100ms
(
void
)
sprintf_s
(
buffer
,
sizeof
(
buffer
),
"%u"
,
value
);
sprintf_s
(
buffer
,
sizeof
(
buffer
),
"%u"
,
value
);
PARAM_LOGI
(
"set param name: %s, value %s"
,
TEST_PARAM_NAME
,
buffer
);
PARAM_LOGI
(
"set param name: %s, value %s"
,
TEST_PARAM_NAME
,
buffer
);
SystemWriteParam
(
TEST_PARAM_NAME
,
buffer
);
SystemWriteParam
(
TEST_PARAM_NAME
,
buffer
);
usleep
(
wait
);
usleep
(
wait
);
...
...
services/test/unittest/init/service_unittest.cpp
浏览文件 @
220326bd
...
@@ -30,5 +30,4 @@ public:
...
@@ -30,5 +30,4 @@ public:
HWTEST_F
(
ServiceUnitTest
,
case01
,
TestSize
.
Level1
)
HWTEST_F
(
ServiceUnitTest
,
case01
,
TestSize
.
Level1
)
{
{
}
}
}
// namespace init_ut
}
// namespace init_ut
services/test/unittest/param/client_unittest.cpp
浏览文件 @
220326bd
...
@@ -212,7 +212,7 @@ void TestClient(int index)
...
@@ -212,7 +212,7 @@ void TestClient(int index)
SystemWaitParameter
(
name
.
c_str
(),
nullptr
,
0
);
SystemWaitParameter
(
name
.
c_str
(),
nullptr
,
0
);
break
;
break
;
}
}
case
2
:
{
//
3
api test
case
2
:
{
//
2
api test
ParamHandle
handle
;
ParamHandle
handle
;
uint32_t
size
=
PARAM_BUFFER_SIZE
;
uint32_t
size
=
PARAM_BUFFER_SIZE
;
int
ret
=
SystemFindParameter
(
name
.
c_str
(),
&
handle
);
int
ret
=
SystemFindParameter
(
name
.
c_str
(),
&
handle
);
...
...
services/test/unittest/param/param_unittest.cpp
浏览文件 @
220326bd
/*
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 202
0-202
1 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
*
*
http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS,
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
#include <memory>
#include <memory>
#include "init_param.h"
#include "init_param.h"
...
@@ -59,6 +58,7 @@ public:
...
@@ -59,6 +58,7 @@ public:
CheckServerParamValue
(
"const.actionable_compatible_property.enabled"
,
"false"
);
CheckServerParamValue
(
"const.actionable_compatible_property.enabled"
,
"false"
);
CheckServerParamValue
(
"build_version"
,
"2.0"
);
CheckServerParamValue
(
"build_version"
,
"2.0"
);
CheckServerParamValue
(
"ohos.boot.hardware"
,
"Hi3516DV300"
);
CheckServerParamValue
(
"ohos.boot.hardware"
,
"Hi3516DV300"
);
LoadPersistParams
();
return
0
;
return
0
;
}
}
...
...
services/test/unittest/param/watcher_proxy_unittest.cpp
浏览文件 @
220326bd
...
@@ -51,7 +51,7 @@ public:
...
@@ -51,7 +51,7 @@ public:
};
};
using
WatcherManagerPtr
=
WatcherManager
*
;
using
WatcherManagerPtr
=
WatcherManager
*
;
WatcherManagerPtr
g_watcherManager
{
nullptr
}
;
WatcherManagerPtr
g_watcherManager
=
nullptr
;
class
WatcherProxyUnitTest
:
public
::
testing
::
Test
{
class
WatcherProxyUnitTest
:
public
::
testing
::
Test
{
public:
public:
...
@@ -72,7 +72,6 @@ public:
...
@@ -72,7 +72,6 @@ public:
data
.
WriteString
(
keyPrefix
);
data
.
WriteString
(
keyPrefix
);
sptr
<
IWatcher
>
watcher
=
new
TestWatcher
();
sptr
<
IWatcher
>
watcher
=
new
TestWatcher
();
// std::shared_ptr<TestWatcher> watcher = std::make_shared<TestWatcher>();
bool
ret
=
data
.
WriteRemoteObject
(
watcher
->
AsObject
());
bool
ret
=
data
.
WriteRemoteObject
(
watcher
->
AsObject
());
WATCHER_CHECK
(
ret
,
return
0
,
"Can not get remote"
);
WATCHER_CHECK
(
ret
,
return
0
,
"Can not get remote"
);
watcherManager
->
OnRemoteRequest
(
IWatcherManager
::
ADD_WATCHER
,
data
,
reply
,
option
);
watcherManager
->
OnRemoteRequest
(
IWatcherManager
::
ADD_WATCHER
,
data
,
reply
,
option
);
...
@@ -80,7 +79,7 @@ public:
...
@@ -80,7 +79,7 @@ public:
EXPECT_NE
(
watcherId
,
0
);
EXPECT_NE
(
watcherId
,
0
);
printf
(
"TestAddWatcher %s watcherId %d %p
\n
"
,
keyPrefix
.
c_str
(),
watcherId
,
watcherManager
);
printf
(
"TestAddWatcher %s watcherId %d %p
\n
"
,
keyPrefix
.
c_str
(),
watcherId
,
watcherManager
);
EXPECT_EQ
(
watcherManager
->
GetWatcherGroup
(
1000
)
!=
NULL
,
0
);
// test group id
EXPECT_EQ
(
watcherManager
->
GetWatcherGroup
(
1000
)
!=
NULL
,
0
);
//
1000
test group id
EXPECT_EQ
(
watcherManager
->
GetWatcherGroup
(
"TestAddWatcher"
)
!=
NULL
,
0
);
// test key not exist
EXPECT_EQ
(
watcherManager
->
GetWatcherGroup
(
"TestAddWatcher"
)
!=
NULL
,
0
);
// test key not exist
return
0
;
return
0
;
}
}
...
...
services/test/unittest/test_data/proc/cmdline
已删除
100755 → 0
浏览文件 @
8bc44fcc
mem=640M console=ttyAMA0,115200 mmz=anonymous,0,0xA8000000,384M clk_ignore_unused androidboot.selinux=permissive skip_initramfs rootdelay=10 init = /init root=uuid=aaaaa=/dev/mmcblk0p5 hardware=Hi3516DV300 rootfstype=ext4 ro dddddd=blkdevparts=mmcblk0:1M(boot),15M(kernel),20M(updater),1M(misc),3307M(system),256M(vendor),-(userdata)
\ No newline at end of file
services/test/unittest/test_data/system/etc/param/persist_parameters
已删除
100755 → 0
浏览文件 @
8bc44fcc
persist.sys.usb.config=hdc
persist.111.ffff.bbbb.cccc.dddd.eeee=1106
persist.111.ffff.bbbb.cccc.dddd.eeee.55555=22202
persist.111.aaaa.bbbb.cccc.dddd.eeee=1102
persist.111.bbbb.cccc.dddd.eeee=1103
persist.111.cccc.bbbb.cccc.dddd.eeee=1104
persist.111.eeee.bbbb.cccc.dddd.eeee=1105
persist.aaaa.aaa=3377
services/utils/init_utils.c
浏览文件 @
220326bd
...
@@ -146,7 +146,6 @@ void FreeStringVector(char **vector, int count)
...
@@ -146,7 +146,6 @@ void FreeStringVector(char **vector, int count)
}
}
}
}
free
(
vector
);
free
(
vector
);
vector
=
NULL
;
}
}
}
}
...
...
watchdog/linux/init_linux_watchdog.c
浏览文件 @
220326bd
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
#include <errno.h>
#include <errno.h>
#include <fcntl.h>
#include <fcntl.h>
#include <linux/watchdog.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
...
@@ -23,6 +22,8 @@
...
@@ -23,6 +22,8 @@
#include <sys/types.h>
#include <sys/types.h>
#include <time.h>
#include <time.h>
#include <unistd.h>
#include <unistd.h>
#include <linux/watchdog.h>
#include "init_log.h"
#include "init_log.h"
#define WAIT_MAX_COUNT 10
#define WAIT_MAX_COUNT 10
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录