未验证 提交 4ab46e62 编写于 作者: O openharmony_ci 提交者: Gitee

!333 init文件解析中添加mkswap和swapon命令

Merge pull request !333 from fanchengyang/swapon
...@@ -450,6 +450,40 @@ int FileCryptEnable(char *fileCryptOption) ...@@ -450,6 +450,40 @@ int FileCryptEnable(char *fileCryptOption)
return ret; return ret;
} }
static void DoMkswap(const struct CmdArgs *ctx)
{
INIT_LOGI("DoMkswap: start");
if (ctx == NULL) {
INIT_LOGE("DoMkswap: para invalid");
return;
}
char *const argv[] = {
"/system/bin/mkswap",
ctx->argv[0],
NULL
};
int argc = ARRAY_LEN(argv);
int ret = SyncExecCommand(argc, argv);
INIT_LOGI("DoMkswap: end, ret = %d", ret);
}
static void DoSwapon(const struct CmdArgs *ctx)
{
INIT_LOGI("DoSwapon: start");
if (ctx == NULL) {
INIT_LOGE("DoSwapon: para invalid");
return;
}
char *const argv[] = {
"/system/bin/swapon",
ctx->argv[0],
NULL
};
int argc = ARRAY_LEN(argv);
int ret = SyncExecCommand(argc, argv);
INIT_LOGI("DoSwapon: end, ret = %d", ret);
}
static const struct CmdTable g_cmdTable[] = { static const struct CmdTable g_cmdTable[] = {
{ "exec ", 1, 10, DoExec }, { "exec ", 1, 10, DoExec },
{ "mknode ", 1, 5, DoMakeNode }, { "mknode ", 1, 5, DoMakeNode },
...@@ -472,6 +506,8 @@ static const struct CmdTable g_cmdTable[] = { ...@@ -472,6 +506,8 @@ static const struct CmdTable g_cmdTable[] = {
{ "timer_stop", 1, 1, DoTimerStop }, { "timer_stop", 1, 1, DoTimerStop },
{ "init_global_key ", 1, 1, DoInitGlobalKey }, { "init_global_key ", 1, 1, DoInitGlobalKey },
{ "init_main_user ", 0, 1, DoInitMainUser }, { "init_main_user ", 0, 1, DoInitMainUser },
{ "mkswap", 1, 1, DoMkswap},
{ "swapon", 1, 1, DoSwapon},
}; };
const struct CmdTable *GetCmdTable(int *number) const struct CmdTable *GetCmdTable(int *number)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册