From ea21bfc4c9b9e8f9de0376c069c5b31ccf968b9e Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sat, 4 Jun 2016 23:10:47 +0200 Subject: [PATCH] Relocate global sm variable to reduce include file deps The new state machine handling is not necessary to export to external plugins, so this patch reduces the exposure of the global variable sm Signed-off-by: Joachim Nilsson --- finit.c | 1 - finit.h | 3 --- sm.c | 2 ++ sm.h | 2 ++ 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/finit.c b/finit.c index 7393a84b..dc60608b 100644 --- a/finit.c +++ b/finit.c @@ -54,7 +54,6 @@ char *hostname = NULL; char *rcsd = FINIT_RCSD; char *runparts = NULL; char *console = NULL; -sm_t sm; uev_ctx_t *ctx = NULL; /* Main loop context */ diff --git a/finit.h b/finit.h index 426cba00..867a7a5e 100644 --- a/finit.h +++ b/finit.h @@ -35,8 +35,6 @@ #include #include -#include "sm.h" - #define CMD_SIZE 256 #define LINE_SIZE 1024 #define BUF_SIZE 4096 @@ -80,7 +78,6 @@ extern char *username; extern char *runparts; extern char *console; extern char *__progname; -extern sm_t sm; #endif /* FINIT_H_ */ diff --git a/sm.c b/sm.c index 288473cf..d7cfaa2a 100644 --- a/sm.c +++ b/sm.c @@ -35,6 +35,8 @@ #include "tty.h" #include "sm.h" +sm_t sm; + void sm_init(sm_t *sm) { sm->state = SM_BOOTSTRAP_STATE; diff --git a/sm.h b/sm.h index 9bb8d584..d8246df5 100644 --- a/sm.h +++ b/sm.h @@ -40,6 +40,8 @@ typedef struct sm { int in_teardown; /* Set when waiting for all processes to be halted */ } sm_t; +extern sm_t sm; + void sm_init(sm_t *sm); void sm_step(sm_t *sm); void sm_set_runlevel(sm_t *sm, int newlevel);