From 16b22a831c490b8dd1b5f81a4955e6f13f22705d Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 14 May 2020 15:42:36 +0200 Subject: Cleanup: remove target completion hooks Simply make the service scripts handle accordingly. Signed-off-by: David Oberhollenzer --- initd/config.c | 23 ----------------------- initd/init.h | 15 --------------- initd/main.c | 25 ------------------------- 3 files changed, 63 deletions(-) diff --git a/initd/config.c b/initd/config.c index 7f9f25c..d994faa 100644 --- a/initd/config.c +++ b/initd/config.c @@ -15,7 +15,6 @@ static size_t queue_count[TGT_MAX]; /* current state */ static size_t queue_idx = 0; static int target = TGT_BOOT; -static size_t singleshot = 0; int config_load(void) { @@ -103,29 +102,7 @@ void config_set_target(int tgt) queue_idx = 0; } -int config_get_current_target(void) -{ - return target; -} - -bool config_is_current_target_complete(void) -{ - return singleshot == 0 && queue_idx >= queue_count[target]; -} - bool config_should_respawn(void) { return target != TGT_REBOOT && target != TGT_SHUTDOWN; } - -void config_singleshot_started(void) -{ - singleshot++; -} - -void config_singleshot_terminated(void) -{ - assert(singleshot > 0); - - singleshot--; -} diff --git a/initd/init.h b/initd/init.h index 3400ec0..1a9f35a 100644 --- a/initd/init.h +++ b/initd/init.h @@ -58,24 +58,9 @@ svc_run_data_t *config_dequeue(void); */ void config_set_target(int tgt); -/* get the current run time target from the configuration manager */ -int config_get_current_target(void); - -/* - Find out if the current target is completed, i.e. there are no more services - left in the queue and no active single shot services. - */ -bool config_is_current_target_complete(void); - /* Ask whether we should respawn services in the current target */ bool config_should_respawn(void); -/* notify the configuration manager that a single shot service started */ -void config_singleshot_started(void); - -/* notify the configuration manager that a single shot service terminated */ -void config_singleshot_terminated(void); - /********** print_status.c **********/ void print_status(const svc_run_data_t *rt); diff --git a/initd/main.c b/initd/main.c index dbd4abf..6d46408 100644 --- a/initd/main.c +++ b/initd/main.c @@ -60,9 +60,6 @@ static void handle_exited(svc_run_data_t *rt) } print_status(rt); - - if (rt->svc->type == SVC_ONCE) - config_singleshot_terminated(); } } @@ -95,9 +92,6 @@ static void start_service(svc_run_data_t *rt) handle_exited(terminated); } while (terminated != rt); break; - case SVC_ONCE: - config_singleshot_started(); - break; } } @@ -117,22 +111,6 @@ static void handle_signal(int signo) } } -static void handle_target_completed(void) -{ - switch (config_get_current_target()) { - case TGT_BOOT: - break; - case TGT_SHUTDOWN: - for (;;) - reboot(RB_POWER_OFF); - break; - case TGT_REBOOT: - for (;;) - reboot(RB_AUTOBOOT); - break; - } -} - int main(void) { svc_run_data_t *rt; @@ -164,9 +142,6 @@ int main(void) } else { start_service(rt); } - - if (config_is_current_target_complete()) - handle_target_completed(); } return EXIT_SUCCESS; -- cgit v1.2.3