From 2ef9602319af3f7d390ee3863556b4f10842e2f8 Mon Sep 17 00:00:00 2001 From: handyohos Date: Mon, 27 Jun 2022 22:53:07 +0800 Subject: [PATCH] bugfix: GetBootStageHookMgr auto create HookMgr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1) GetBootStageHookMgr中自动创建HookMgr,便于静态链接模块使用。 Signed-off-by: handyohos Change-Id: I585f73d7ca8117da79599a8231dbd6b74e07345b --- services/init/standard/init.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/services/init/standard/init.c b/services/init/standard/init.c index b03b5f444..d3a362945 100755 --- a/services/init/standard/init.c +++ b/services/init/standard/init.c @@ -254,6 +254,15 @@ static HOOK_MGR *bootStageHookMgr = NULL; HOOK_MGR *GetBootStageHookMgr() { + if (bootStageHookMgr != NULL) { + return bootStageHookMgr; + } + + /* + * Create bootstage hook manager for booting only. + * When boot completed, this manager will be destroyed. + */ + bootStageHookMgr = HookMgrCreate(INIT_BOOTSTAGE_HOOK_NAME); return bootStageHookMgr; } @@ -359,12 +368,6 @@ void SystemConfig(void) options.preHook = InitPreHook; options.postHook = InitPostHook; - /* - * Create bootstage hook manager for booting only. - * When boot completed, this manager will be destroyed. - */ - bootStageHookMgr = HookMgrCreate(INIT_BOOTSTAGE_HOOK_NAME); - HookMgrExecute(GetBootStageHookMgr(), INIT_GLOBAL_INIT, (void *)&timingStat, (void *)&options); InitServiceSpace();