Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
09f6e68b
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看板
提交
09f6e68b
编写于
11月 11, 2021
作者:
X
xionglei6
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
init: fix code style
Signed-off-by:
N
xionglei6
<
xionglei6@huawei.com
>
上级
5f00c532
变更
30
隐藏空白更改
内联
并排
Showing
30 changed file
with
73 addition
and
121 deletion
+73
-121
interfaces/innerkits/fs_manager/fstab.c
interfaces/innerkits/fs_manager/fstab.c
+1
-1
interfaces/innerkits/fs_manager/fstab_mount.c
interfaces/innerkits/fs_manager/fstab_mount.c
+1
-3
services/cmds/misc/misc_daemon.cpp
services/cmds/misc/misc_daemon.cpp
+3
-3
services/init/adapter/init_adapter.c
services/init/adapter/init_adapter.c
+0
-1
services/init/init_capability.c
services/init/init_capability.c
+0
-2
services/init/init_common_cmds.c
services/init/init_common_cmds.c
+0
-1
services/init/init_common_service.c
services/init/init_common_service.c
+3
-4
services/init/init_service_file.c
services/init/init_service_file.c
+0
-1
services/init/init_service_manager.c
services/init/init_service_manager.c
+1
-4
services/init/init_service_socket.c
services/init/init_service_socket.c
+0
-1
services/init/lite/init_cmds.c
services/init/lite/init_cmds.c
+0
-1
services/init/lite/init_jobs.c
services/init/lite/init_jobs.c
+0
-1
services/init/lite/init_reboot.c
services/init/lite/init_reboot.c
+0
-1
services/init/lite/init_service.c
services/init/lite/init_service.c
+0
-1
services/init/lite/init_signal_handler.c
services/init/lite/init_signal_handler.c
+0
-2
services/init/main.c
services/init/main.c
+1
-2
services/init/standard/init.c
services/init/standard/init.c
+2
-2
services/init/standard/init_cmds.c
services/init/standard/init_cmds.c
+0
-3
services/init/standard/init_mount.c
services/init/standard/init_mount.c
+0
-2
services/init/standard/init_reboot.c
services/init/standard/init_reboot.c
+0
-1
services/init/standard/init_service.c
services/init/standard/init_service.c
+0
-1
services/init/standard/init_signal_handler.c
services/init/standard/init_signal_handler.c
+0
-1
services/log/init_log.c
services/log/init_log.c
+1
-1
services/param/watcher/proxy/watcher_manager.cpp
services/param/watcher/proxy/watcher_manager.cpp
+1
-1
test/unittest/common/cmd_func_test.cpp
test/unittest/common/cmd_func_test.cpp
+52
-71
ueventd/ueventd.c
ueventd/ueventd.c
+2
-1
ueventd/ueventd_firmware_handler.c
ueventd/ueventd_firmware_handler.c
+0
-1
ueventd/ueventd_main.c
ueventd/ueventd_main.c
+0
-1
ueventd/ueventd_read_cfg.c
ueventd/ueventd_read_cfg.c
+2
-2
watchdog/init_watchdog.c
watchdog/init_watchdog.c
+3
-4
未找到文件。
interfaces/innerkits/fs_manager/fstab.c
浏览文件 @
09f6e68b
...
...
@@ -268,7 +268,7 @@ FstabItem *FindFstabItemForPath(Fstab fstab, const char *path)
char
tmp
[
PATH_MAX
]
=
{
0
};
char
*
dir
=
NULL
;
if
(
strncpy_s
(
tmp
,
PATH_MAX
-
1
,
path
,
strlen
(
path
))
!=
EOK
)
{
if
(
strncpy_s
(
tmp
,
PATH_MAX
-
1
,
path
,
strlen
(
path
))
!=
EOK
)
{
FSMGR_LOGE
(
"Failed to copy path."
);
return
NULL
;
}
...
...
interfaces/innerkits/fs_manager/fstab_mount.c
浏览文件 @
09f6e68b
...
...
@@ -14,7 +14,6 @@
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
...
...
@@ -118,7 +117,6 @@ MountStatus GetMountStatusForMountPoint(const char *mp)
return
MOUNT_ERROR
;
}
char
buffer
[
FS_MANAGER_BUFFER_SIZE
]
=
{
0
};
size_t
n
=
0
;
const
int
expectedItems
=
6
;
int
count
=
0
;
char
**
mountItems
=
NULL
;
...
...
@@ -130,7 +128,7 @@ MountStatus GetMountStatusForMountPoint(const char *mp)
return
status
;
}
while
(
fgets
(
buffer
,
sizeof
(
buffer
)
-
1
,
fp
)
!=
NULL
)
{
n
=
strlen
(
buffer
);
size_t
n
=
strlen
(
buffer
);
if
(
buffer
[
n
-
1
]
==
'\n'
)
{
buffer
[
n
-
1
]
=
'\0'
;
}
...
...
services/cmds/misc/misc_daemon.cpp
浏览文件 @
09f6e68b
...
...
@@ -69,7 +69,7 @@ static void ClearLogo(int fd)
return
;
}
char
buffer
[
8
]
=
{
0
};
// logo magic number + logo size is 8
int
addrOffset
=
(
PARTITION_INFO_POS
+
PARTITION_INFO_MAX_LENGTH
+
BLOCK_SZIE_1
-
1
)
/
BLOCK_SZIE_1
;
int
addrOffset
=
(
PARTITION_INFO_POS
+
PARTITION_INFO_MAX_LENGTH
+
BLOCK_SZIE_1
-
1
)
/
BLOCK_SZIE_1
;
if
(
lseek
(
fd
,
addrOffset
*
BLOCK_SZIE_1
,
SEEK_SET
)
<
0
)
{
std
::
cout
<<
"Failed to clean file
\n
"
;
return
;
...
...
@@ -180,7 +180,7 @@ static void WriteLogoToMisc(const std::string &logoPath)
return
;
}
int
fd
=
open
(
miscDev
.
c_str
(),
O_RDWR
|
O_CLOEXEC
,
0644
);
int
fd
=
open
(
miscDev
.
c_str
(),
O_RDWR
|
O_CLOEXEC
,
S_IRUSR
|
S_IWUSR
|
S_IRGRP
|
S_IROTH
);
if
(
fd
<
0
)
{
std
::
cout
<<
"Failed to open "
<<
miscDev
<<
", err = "
<<
errno
<<
std
::
endl
;
return
;
...
...
@@ -191,7 +191,7 @@ static void WriteLogoToMisc(const std::string &logoPath)
}
close
(
fd
);
int
addrOffset
=
(
PARTITION_INFO_POS
+
PARTITION_INFO_MAX_LENGTH
+
BLOCK_SZIE_1
-
1
)
/
BLOCK_SZIE_1
;
int
fd1
=
open
(
miscDev
.
c_str
(),
O_RDWR
|
O_CLOEXEC
,
0644
);
int
fd1
=
open
(
miscDev
.
c_str
(),
O_RDWR
|
O_CLOEXEC
,
S_IRUSR
|
S_IWUSR
|
S_IRGRP
|
S_IROTH
);
if
(
lseek
(
fd1
,
addrOffset
*
BLOCK_SZIE_1
,
SEEK_SET
)
<
0
)
{
std
::
cout
<<
"Failed to seek file
\n
"
;
return
;
...
...
services/init/adapter/init_adapter.c
浏览文件 @
09f6e68b
...
...
@@ -16,7 +16,6 @@
#include <errno.h>
#include <semaphore.h>
#include <stdio.h>
#include <sys/prctl.h>
#include <sys/reboot.h>
#include <unistd.h>
...
...
services/init/init_capability.c
浏览文件 @
09f6e68b
...
...
@@ -12,9 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <ctype.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined OHOS_LITE && !defined __LINUX__
...
...
services/init/init_common_cmds.c
浏览文件 @
09f6e68b
...
...
@@ -19,7 +19,6 @@
#include <fcntl.h>
#include <net/if.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
...
...
services/init/init_common_service.c
浏览文件 @
09f6e68b
...
...
@@ -17,7 +17,6 @@
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef __MUSL__
...
...
@@ -38,8 +37,8 @@
#include "securec.h"
#ifdef WITH_SELINUX
#
include "init_selinux_param.h"
#
include <selinux/selinux.h>
#include "init_selinux_param.h"
#include <selinux/selinux.h>
#endif // WITH_SELINUX
#ifndef TIOCSCTTY
...
...
@@ -172,7 +171,7 @@ static int WritePid(const Service *service)
return
SERVICE_SUCCESS
;
}
void
SetSecon
(
Service
*
service
)
void
SetSecon
(
Service
*
service
)
{
#ifdef WITH_SELINUX
if
(
*
(
service
->
secon
))
{
...
...
services/init/init_service_file.c
浏览文件 @
09f6e68b
...
...
@@ -14,7 +14,6 @@
*/
#include "init_service_file.h"
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
...
...
services/init/init_service_manager.c
浏览文件 @
09f6e68b
...
...
@@ -14,10 +14,7 @@
*/
#include "init_service_manager.h"
#include <ctype.h>
#include <limits.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
...
...
@@ -378,7 +375,7 @@ static int AddServiceFile(cJSON *json, Service *service)
return
SERVICE_FAILURE
;
}
if
(
opt
[
SERVICE_FILE_NAME
]
==
NULL
||
opt
[
SERVICE_FILE_FLAGS
]
==
NULL
||
opt
[
SERVICE_FILE_PERM
]
==
NULL
||
opt
[
SERVICE_FILE_UID
]
==
NULL
||
opt
[
SERVICE_FILE_GID
]
==
NULL
)
{
opt
[
SERVICE_FILE_UID
]
==
NULL
||
opt
[
SERVICE_FILE_GID
]
==
NULL
)
{
INIT_LOGE
(
"Invalid file opt"
);
return
SERVICE_FAILURE
;
}
...
...
services/init/init_service_socket.c
浏览文件 @
09f6e68b
...
...
@@ -14,7 +14,6 @@
*/
#include "init_service_socket.h"
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
...
...
services/init/lite/init_cmds.c
浏览文件 @
09f6e68b
...
...
@@ -19,7 +19,6 @@
#include <stdlib.h>
#include <string.h>
#include "init.h"
#include "init_log.h"
#include "init_utils.h"
#include "securec.h"
...
...
services/init/lite/init_jobs.c
浏览文件 @
09f6e68b
...
...
@@ -14,7 +14,6 @@
*/
#include "init_jobs_internal.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
...
...
services/init/lite/init_reboot.c
浏览文件 @
09f6e68b
...
...
@@ -13,7 +13,6 @@
* limitations under the License.
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/reboot.h>
...
...
services/init/lite/init_service.c
浏览文件 @
09f6e68b
...
...
@@ -14,7 +14,6 @@
*/
#include "init_service.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
...
...
services/init/lite/init_signal_handler.c
浏览文件 @
09f6e68b
...
...
@@ -13,11 +13,9 @@
* limitations under the License.
*/
#include <signal.h>
#include <stdio.h>
#include <sys/wait.h>
#include "init_adapter.h"
#include "init_log.h"
#include "init_service_manager.h"
void
ReapService
(
Service
*
service
)
...
...
services/init/main.c
浏览文件 @
09f6e68b
...
...
@@ -12,12 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdio.h>
#include "init.h"
#include "init_log.h"
static
const
pid_t
INIT_PROCESS_PID
=
1
;
int
main
(
int
argc
,
char
*
const
argv
[])
int
main
(
int
argc
,
char
*
const
argv
[])
{
int
isSecondStage
=
0
;
// Number of command line parameters is 2
...
...
services/init/standard/init.c
浏览文件 @
09f6e68b
...
...
@@ -34,7 +34,7 @@
#include "ueventd.h"
#include "ueventd_socket.h"
#ifdef WITH_SELINUX
#
include <policycoreutils.h>
#include <policycoreutils.h>
#endif // WITH_SELINUX
void
SystemInit
(
void
)
...
...
@@ -124,7 +124,7 @@ static void StartInitSecondStage(void)
}
SwitchRoot
(
"/usr"
);
// Execute init second stage
char
*
const
args
[]
=
{
char
*
const
args
[]
=
{
"/bin/init"
,
"--second-stage"
,
NULL
,
...
...
services/init/standard/init_cmds.c
浏览文件 @
09f6e68b
...
...
@@ -14,12 +14,10 @@
*/
#include "init_cmds.h"
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <net/if.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
...
...
@@ -34,7 +32,6 @@
#include <linux/module.h>
#include "fs_manager/fs_manager.h"
#include "fs_manager/fs_manager_log.h"
#include "init.h"
#include "init_jobs_internal.h"
#include "init_log.h"
#include "init_param.h"
...
...
services/init/standard/init_mount.c
浏览文件 @
09f6e68b
...
...
@@ -13,9 +13,7 @@
* limitations under the License.
*/
#include "device.h"
#include "fs_manager/fs_manager.h"
#include "init.h"
#include "init_cmds.h"
#include "init_log.h"
#include "securec.h"
...
...
services/init/standard/init_reboot.c
浏览文件 @
09f6e68b
...
...
@@ -13,7 +13,6 @@
* limitations under the License.
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/reboot.h>
...
...
services/init/standard/init_service.c
浏览文件 @
09f6e68b
...
...
@@ -14,7 +14,6 @@
*/
#include "init_service.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
...
...
services/init/standard/init_signal_handler.c
浏览文件 @
09f6e68b
...
...
@@ -13,7 +13,6 @@
* limitations under the License.
*/
#include <signal.h>
#include <stdio.h>
#include <sys/wait.h>
#include "init_adapter.h"
...
...
services/log/init_log.c
浏览文件 @
09f6e68b
...
...
@@ -41,7 +41,7 @@ void SetInitLogLevel(InitLogLevel logLevel)
#ifdef OHOS_LITE
static
LogLevel
ConvertToHiLog
(
InitLogLevel
level
)
{
switch
(
level
)
{
switch
(
level
)
{
case
INIT_DEBUG
:
return
LOG_DEBUG
;
case
INIT_INFO
:
...
...
services/param/watcher/proxy/watcher_manager.cpp
浏览文件 @
09f6e68b
...
...
@@ -291,7 +291,7 @@ int WatcherManager::GetServerFd(bool retry)
do
{
serverFd_
=
socket
(
PF_UNIX
,
SOCK_STREAM
,
0
);
int
flags
=
fcntl
(
serverFd_
,
F_GETFL
,
0
);
(
void
)
fcntl
(
serverFd_
,
F_SETFL
,
flags
&~
O_NONBLOCK
);
(
void
)
fcntl
(
serverFd_
,
F_SETFL
,
flags
&
~
O_NONBLOCK
);
ret
=
ConntectServer
(
serverFd_
,
CLIENT_PIPE_NAME
);
if
(
ret
==
0
)
{
break
;
...
...
test/unittest/common/cmd_func_test.cpp
浏览文件 @
09f6e68b
...
...
@@ -171,11 +171,10 @@ void DoCmd(const TestCmdLine *resCmd)
}
/*
** @tc.name: cmdFuncParseCmdTest_001
** @tc.desc: parse function, nullptr test
** @tc.type: FUNC
** @tc.require:
**/
* @tc.name: cmdFuncParseCmdTest_001
* @tc.desc: parse function, nullptr test
* @tc.type: FUNC
*/
HWTEST_F
(
StartupInitUTest
,
cmdFuncParseCmdTest_001
,
TestSize
.
Level0
)
{
// do not crash
...
...
@@ -183,11 +182,10 @@ HWTEST_F(StartupInitUTest, cmdFuncParseCmdTest_001, TestSize.Level0)
};
/*
** @tc.name: cmdFuncParseCmdTest_002
** @tc.desc: parse function, invalid strings test
** @tc.type: FUNC
** @tc.require:
**/
* @tc.name: cmdFuncParseCmdTest_002
* @tc.desc: parse function, invalid strings test
* @tc.type: FUNC
*/
HWTEST_F
(
StartupInitUTest
,
cmdFuncParseCmdTest_002
,
TestSize
.
Level0
)
{
TestCmdLine
curCmdLine
;
...
...
@@ -211,11 +209,10 @@ HWTEST_F(StartupInitUTest, cmdFuncParseCmdTest_002, TestSize.Level0)
}
/*
** @tc.name: cmdFuncParseCmdTest_003
** @tc.desc: parse function, cmd content empty test
** @tc.type: FUNC
** @tc.require:
**/
* @tc.name: cmdFuncParseCmdTest_003
* @tc.desc: parse function, cmd content empty test
* @tc.type: FUNC
*/
HWTEST_F
(
StartupInitUTest
,
cmdFuncParseCmdTest_003
,
TestSize
.
Level0
)
{
TestCmdLine
curCmdLine
;
...
...
@@ -229,11 +226,10 @@ HWTEST_F(StartupInitUTest, cmdFuncParseCmdTest_003, TestSize.Level0)
}
/*
** @tc.name: cmdFuncParseCmdTest_004
** @tc.desc: parse function, cmd content too long test
** @tc.type: FUNC
** @tc.require:
**/
* @tc.name: cmdFuncParseCmdTest_004
* @tc.desc: parse function, cmd content too long test
* @tc.type: FUNC
*/
HWTEST_F
(
StartupInitUTest
,
cmdFuncParseCmdTest_004
,
TestSize
.
Level0
)
{
TestCmdLine
curCmdLine
;
...
...
@@ -270,11 +266,10 @@ HWTEST_F(StartupInitUTest, cmdFuncParseCmdTest_004, TestSize.Level0)
}
/*
** @tc.name: cmdFuncParseCmdTest_005
** @tc.desc: parse function, parse success test
** @tc.type: FUNC
** @tc.require:
**/
* @tc.name: cmdFuncParseCmdTest_005
* @tc.desc: parse function, parse success test
* @tc.type: FUNC
*/
HWTEST_F
(
StartupInitUTest
,
cmdFuncParseCmdTest_005
,
TestSize
.
Level0
)
{
TestCmdLine
curCmdLine
;
...
...
@@ -302,11 +297,10 @@ HWTEST_F(StartupInitUTest, cmdFuncParseCmdTest_005, TestSize.Level0)
};
/*
** @tc.name: cmdFuncDoCmdTest_001
** @tc.desc: do cmd function, nullptr test
** @tc.type: FUNC
** @tc.require:
**/
* @tc.name: cmdFuncDoCmdTest_001
* @tc.desc: do cmd function, nullptr test
* @tc.type: FUNC
*/
HWTEST_F
(
StartupInitUTest
,
cmdFuncDoCmdTest_001
,
TestSize
.
Level0
)
{
// do not crash here
...
...
@@ -314,11 +308,10 @@ HWTEST_F(StartupInitUTest, cmdFuncDoCmdTest_001, TestSize.Level0)
}
/*
** @tc.name: cmdFuncDoCmdTest_002
** @tc.desc: do cmd function, do start fail test
** @tc.type: FUNC
** @tc.require:
**/
* @tc.name: cmdFuncDoCmdTest_002
* @tc.desc: do cmd function, do start fail test
* @tc.type: FUNC
*/
HWTEST_F
(
StartupInitUTest
,
cmdFuncDoCmdTest_002
,
TestSize
.
Level0
)
{
TestCmdLine
curCmdLine
;
...
...
@@ -334,11 +327,10 @@ HWTEST_F(StartupInitUTest, cmdFuncDoCmdTest_002, TestSize.Level0)
}
/*
** @tc.name: cmdFuncDoCmdTest_003
** @tc.desc: do cmd function, do mkdir fail test
** @tc.type: FUNC
** @tc.require:
**/
* @tc.name: cmdFuncDoCmdTest_003
* @tc.desc: do cmd function, do mkdir fail test
* @tc.type: FUNC
*/
HWTEST_F
(
StartupInitUTest
,
cmdFuncDoCmdTest_003
,
TestSize
.
Level0
)
{
TestCmdLine
curCmdLine
;
...
...
@@ -380,11 +372,10 @@ HWTEST_F(StartupInitUTest, cmdFuncDoCmdTest_003, TestSize.Level0)
}
/*
** @tc.name: cmdFuncDoCmdTest_004
** @tc.desc: do cmd function, do chmod fail test
** @tc.type: FUNC
** @tc.require:
**/
* @tc.name: cmdFuncDoCmdTest_004
* @tc.desc: do cmd function, do chmod fail test
* @tc.type: FUNC
*/
HWTEST_F
(
StartupInitUTest
,
cmdFuncDoCmdTest_004
,
TestSize
.
Level0
)
{
TestCmdLine
curCmdLine
;
...
...
@@ -437,11 +428,10 @@ HWTEST_F(StartupInitUTest, cmdFuncDoCmdTest_004, TestSize.Level0)
}
/*
** @tc.name: cmdFuncDoCmdTest_005
** @tc.desc: do cmd function, do chown fail test
** @tc.type: FUNC
** @tc.require:
**/
* @tc.name: cmdFuncDoCmdTest_005
* @tc.desc: do cmd function, do chown fail test
* @tc.type: FUNC
*/
HWTEST_F
(
StartupInitUTest
,
cmdFuncDoCmdTest_005
,
TestSize
.
Level0
)
{
TestCmdLine
curCmdLine
;
...
...
@@ -474,11 +464,10 @@ HWTEST_F(StartupInitUTest, cmdFuncDoCmdTest_005, TestSize.Level0)
}
/*
** @tc.name: cmdFuncDoCmdTest_006
** @tc.desc: do cmd function, do success test
** @tc.type: FUNC
** @tc.require:
**/
* @tc.name: cmdFuncDoCmdTest_006
* @tc.desc: do cmd function, do success test
* @tc.type: FUNC
*/
HWTEST_F
(
StartupInitUTest
,
cmdFuncDoCmdTest_006
,
TestSize
.
Level0
)
{
TestCmdLine
curCmdLine
;
...
...
@@ -542,11 +531,10 @@ HWTEST_F(StartupInitUTest, cmdFuncDoCmdTest_006, TestSize.Level0)
}
/*
** @tc.name: cfgCheckStat_001
** @tc.desc: init.cfg file state check
** @tc.type: FUNC
** @tc.require:
**/
* @tc.name: cfgCheckStat_001
* @tc.desc: init.cfg file state check
* @tc.type: FUNC
*/
HWTEST_F
(
StartupInitUTest
,
cfgCheckStat_001
,
TestSize
.
Level0
)
{
struct
stat
fileStat
=
{
0
};
...
...
@@ -807,11 +795,10 @@ static void CheckJobs(const cJSON* fileRoot)
}
/*
** @tc.name: cfgCheckContent_001
** @tc.desc: init.cfg file content check
** @tc.type: FUNC
** @tc.require:
**/
* @tc.name: cfgCheckContent_001
* @tc.desc: init.cfg file content check
* @tc.type: FUNC
*/
HWTEST_F
(
StartupInitUTest
,
cfgCheckContent_001
,
TestSize
.
Level0
)
{
char
*
fileBuf
=
ReadFileToBuf
();
...
...
@@ -836,7 +823,6 @@ HWTEST_F(StartupInitUTest, cfgCheckContent_001, TestSize.Level0)
* @tc.name: CreateIllegalCfg
* @tc.desc: Create illegal Config file for testing
* @tc.type: FUNC
* @tc.require:
*/
static
void
CreateIllegalCfg
()
{
...
...
@@ -860,7 +846,6 @@ static void CreateIllegalCfg()
* @tc.name: cmdFuncDoLoadCfgTest_001
* @tc.desc: parse function, parse success test
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F
(
StartupInitUTest
,
cmdFuncDoLoadCfgTest_001
,
TestSize
.
Level0
)
{
...
...
@@ -876,7 +861,6 @@ HWTEST_F(StartupInitUTest, cmdFuncDoLoadCfgTest_001, TestSize.Level0)
* @tc.name: cmdFuncDoLoadCfgTest_002
* @tc.desc: fstab.cfg file fail test
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F
(
StartupInitUTest
,
cmdFuncDoLoadCfgTest_002
,
TestSize
.
Level0
)
{
...
...
@@ -916,7 +900,6 @@ HWTEST_F(StartupInitUTest, cmdFuncDoLoadCfgTest_002, TestSize.Level0)
* @tc.name: cmdFuncDoLoadCfgTest_003
* @tc.desc: fstab.cfg file success test
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F
(
StartupInitUTest
,
cmdFuncDoLoadCfgTest_003
,
TestSize
.
Level0
)
{
...
...
@@ -965,7 +948,6 @@ HWTEST_F(StartupInitUTest, cmdFuncDoLoadCfgTest_003, TestSize.Level0)
* @tc.name: cmdJobTest_001
* @tc.desc: job functions test
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F
(
StartupInitUTest
,
cmdJobTest_001
,
TestSize
.
Level0
)
{
...
...
@@ -985,7 +967,6 @@ HWTEST_F(StartupInitUTest, cmdJobTest_001, TestSize.Level0)
* @tc.name: cmdJobTest_002
* @tc.desc: job functions test
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F
(
StartupInitUTest
,
cmdJobTest_002
,
TestSize
.
Level0
)
{
...
...
ueventd/ueventd.c
浏览文件 @
09f6e68b
...
...
@@ -34,6 +34,7 @@
// buffer size refer to kernel kobject uevent
#define UEVENT_BUFFER_SIZE (2048 + 1)
char
bootDevice
[
CMDLINE_VALUE_LEN_MAX
]
=
{
0
};
#define WRITE_SIZE 4
static
const
char
*
actions
[]
=
{
[
ACTION_ADD
]
=
"add"
,
...
...
@@ -232,7 +233,7 @@ static void DoTrigger(const char *ueventPath, int sockFd, char **devices, int nu
if
(
fd
<
0
)
{
INIT_LOGE
(
"Open
\"
%s
\"
failed, err = %d"
,
ueventPath
,
errno
);
}
else
{
ssize_t
n
=
write
(
fd
,
"add
\n
"
,
4
);
ssize_t
n
=
write
(
fd
,
"add
\n
"
,
WRITE_SIZE
);
if
(
n
<
0
)
{
INIT_LOGE
(
"Write
\"
%s
\"
failed, err = %d"
,
ueventPath
,
errno
);
close
(
fd
);
...
...
ueventd/ueventd_firmware_handler.c
浏览文件 @
09f6e68b
...
...
@@ -17,7 +17,6 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "ueventd.h"
#define INIT_LOG_TAG "ueventd"
...
...
ueventd/ueventd_main.c
浏览文件 @
09f6e68b
...
...
@@ -15,7 +15,6 @@
#include <poll.h>
#include "ueventd.h"
#include "ueventd_device_handler.h"
#include "ueventd_read_cfg.h"
#include "ueventd_socket.h"
#define INIT_LOG_TAG "ueventd"
...
...
ueventd/ueventd_read_cfg.c
浏览文件 @
09f6e68b
...
...
@@ -204,7 +204,7 @@ int ParseUeventConfig(char *buffer)
callback
=
funcMapper
[
type
].
func
;
return
0
;
}
return
callback
!=
NULL
?
callback
(
p
)
:
-
1
;
return
(
callback
!=
NULL
)
?
callback
(
p
)
:
-
1
;
}
static
void
DoUeventConfigParse
(
char
*
buffer
,
size_t
length
)
...
...
@@ -332,7 +332,7 @@ bool IsMatch(const char *target, const char *pattern)
while
(
*
p
==
'*'
)
{
p
++
;
}
return
*
p
==
'\0'
?
true
:
false
;
return
(
*
p
==
'\0'
)
?
true
:
false
;
}
void
GetDeviceNodePermissions
(
const
char
*
devNode
,
uid_t
*
uid
,
gid_t
*
gid
,
mode_t
*
mode
)
...
...
watchdog/init_watchdog.c
浏览文件 @
09f6e68b
...
...
@@ -16,7 +16,6 @@
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
...
...
@@ -66,13 +65,13 @@ int main(int argc, const char *argv[])
if
(
argc
>=
2
)
{
// Argument nums greater than or equal to 2.
interval
=
atoi
(
argv
[
1
]);
}
interval
=
interval
>
0
?
interval
:
DEFAULT_INTERVAL
;
interval
=
(
interval
>
0
)
?
interval
:
DEFAULT_INTERVAL
;
int
gap
=
0
;
if
(
argc
>=
3
)
{
// Argument nums greater than or equal to 3.
gap
=
atoi
(
argv
[
2
]);
// 2 second parameter.
}
gap
=
gap
>
0
?
gap
:
DEFAULT_GAP
;
gap
=
(
gap
>
0
)
?
gap
:
DEFAULT_GAP
;
INIT_LOGI
(
"watchdoge started (interval %d, margin %d), fd = %d
\n
"
,
interval
,
gap
,
fd
);
...
...
@@ -86,7 +85,7 @@ int main(int argc, const char *argv[])
if
(
ret
)
{
INIT_LOGE
(
"Failed to get timeout
\n
"
);
}
else
{
interval
=
timeoutGet
>
gap
?
timeoutGet
-
gap
:
1
;
interval
=
(
timeoutGet
>
gap
)
?
timeoutGet
-
gap
:
1
;
}
while
(
1
)
{
ioctl
(
fd
,
WDIOC_KEEPALIVE
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录