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 <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2016-06-04 23:10:47 +02:00
1 parent e9da876a10
commit ea21bfc4c9
4 files changed
+4 -4

No files matched your search

-1
View File
@@ -54,7 +54,6 @@ char *hostname = NULL;
char *rcsd = FINIT_RCSD; char *rcsd = FINIT_RCSD;
char *runparts = NULL; char *runparts = NULL;
char *console = NULL; char *console = NULL;
sm_t sm;
uev_ctx_t *ctx = NULL; /* Main loop context */ uev_ctx_t *ctx = NULL; /* Main loop context */
-3
View File
@@ -35,8 +35,6 @@
#include <unistd.h> #include <unistd.h>
#include <lite/lite.h> #include <lite/lite.h>
#include "sm.h"
#define CMD_SIZE 256 #define CMD_SIZE 256
#define LINE_SIZE 1024 #define LINE_SIZE 1024
#define BUF_SIZE 4096 #define BUF_SIZE 4096
@@ -80,7 +78,6 @@ extern char *username;
extern char *runparts; extern char *runparts;
extern char *console; extern char *console;
extern char *__progname; extern char *__progname;
extern sm_t sm;
#endif /* FINIT_H_ */ #endif /* FINIT_H_ */
+2
View File
@@ -35,6 +35,8 @@
#include "tty.h" #include "tty.h"
#include "sm.h" #include "sm.h"
sm_t sm;
void sm_init(sm_t *sm) void sm_init(sm_t *sm)
{ {
sm->state = SM_BOOTSTRAP_STATE; sm->state = SM_BOOTSTRAP_STATE;
+2
View File
@@ -40,6 +40,8 @@ typedef struct sm {
int in_teardown; /* Set when waiting for all processes to be halted */ int in_teardown; /* Set when waiting for all processes to be halted */
} sm_t; } sm_t;
extern sm_t sm;
void sm_init(sm_t *sm); void sm_init(sm_t *sm);
void sm_step(sm_t *sm); void sm_step(sm_t *sm);
void sm_set_runlevel(sm_t *sm, int newlevel); void sm_set_runlevel(sm_t *sm, int newlevel);