Feature: add file_migrate_ability interface

Signed-off-by: fengjiahui4 <fengjiahui6@huawei.com>
This commit is contained in:
fengjiahui4 2023-08-04 10:20:28 +08:00
parent f02c38cbfd
commit 8e96af126c
2 changed files with 17 additions and 0 deletions

View File

@ -28,6 +28,8 @@ extern "C" {
enum INIT_BOOTSTAGE {
INIT_GLOBAL_INIT = 0,
INIT_FIRST_STAGE = 1,
INIT_MOUNT_STAGE = 3,
INIT_RESTORECON = 4,
INIT_POST_DATA_UNENCRYPT = 5,
INIT_PRE_PARAM_SERVICE = 10,
INIT_PRE_PARAM_LOAD = 20,

View File

@ -295,6 +295,7 @@ static void DoMountFstabFile(const struct CmdArgs *ctx)
INIT_LOGI("Mount partitions from fstab file \" %s \"", ctx->argv[0]);
int ret = MountAllWithFstabFile(ctx->argv[0], 0);
INIT_LOGI("Mount partitions from fstab file \" %s \" finish ret %d", ctx->argv[0], ret);
HookMgrExecute(GetBootStageHookMgr(), INIT_MOUNT_STAGE, NULL, NULL);
}
static void DoUmountFstabFile(const struct CmdArgs *ctx)
@ -310,6 +311,20 @@ static void DoUmountFstabFile(const struct CmdArgs *ctx)
static void DoRestorecon(const struct CmdArgs *ctx)
{
int ret;
INIT_CMD_INFO cmdInfo;
cmdInfo.cmdName = "restorecon";
cmdInfo.cmdContent = ctx->argv[0];
cmdInfo.reserved = NULL;
HOOK_EXEC_OPTIONS options;
options.flags = TRAVERSE_STOP_WHEN_ERROR;
options.preHook = NULL;
options.postHook = NULL;
ret = HookMgrExecute(GetBootStageHookMgr(), INIT_RESTORECON, (void*)(&cmdInfo), (void*)(&options));
if (ret == 0) {
return;
}
PluginExecCmdByName("restoreContentRecurse", ctx->argv[0]);
return;
}