diff options
author | Luis R. Rodriguez <mcgrof@kernel.org> | 2015-10-23 19:03:19 -0700 |
---|---|---|
committer | Luis R. Rodriguez <mcgrof@kernel.org> | 2016-02-11 08:42:16 -0800 |
commit | 0f9830d41512fc40509526e5ac25baffd241376c (patch) | |
tree | f9fef77223381afe03620197324d206aad95190d | |
parent | 01d9ed4478b880a3e638183d16dd9ae6fbc7b3b7 (diff) | |
download | linker-tables-0f9830d41512fc40509526e5ac25baffd241376c.tar.gz |
init: add name support to the init structure
This lets us do all the printing.
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
-rw-r--r-- | bar.c | 3 | ||||
-rw-r--r-- | foo.c | 4 | ||||
-rw-r--r-- | init.c | 7 | ||||
-rw-r--r-- | init.h | 2 | ||||
-rw-r--r-- | main.c | 4 |
5 files changed, 7 insertions, 13 deletions
@@ -3,11 +3,10 @@ #include "init.h" static void init_bar(void) { - printf("bar is going to init\n"); sleep(2); } struct init_fn bar_init_fn __init_fn (INIT_NORMAL) = { .initialise = init_bar, - //.name = "Bar thing", + .name = "Bar thing", }; @@ -3,12 +3,10 @@ #include "init.h" static void init_foo(void) { - printf("foo is about to start\n"); sleep(1); - printf("foo started!\n"); } struct init_fn foo_init_fn __init_fn(INIT_EARLY) = { .initialise = init_foo, - //.name = "Foo thing", + .name = "Foo thing", }; @@ -3,14 +3,12 @@ #include "init.h" static void init_x(void) { - printf("x is about to start\n"); sleep(1); - printf("x started!\n"); } struct init_fn x_init_fn __init_fn(INIT_EARLY) = { .initialise = init_x, - //.name = "X thing", + .name = "X thing", }; int init(void) @@ -22,8 +20,9 @@ int init(void) printf("Number of init entries: %d\n", num_inits); for_each_table_entry (init_fn, INIT_FNS) { - //printf("Initializing %s ...", init_fn->name); + printf("Initializing %s ...\n", init_fn->name); init_fn->initialise(); + printf("Completed initializing %s !\n", init_fn->name); } return 0; @@ -8,7 +8,7 @@ */ struct init_fn { void (* initialise) (void); - //const char *name; + const char *name; }; /** Initialisation function table */ @@ -3,14 +3,12 @@ #include "init.h" static void init_y(void) { - printf("y is about to start\n"); sleep(1); - printf("y started!\n"); } struct init_fn y_init_fn __init_fn(INIT_EARLY) = { .initialise = init_y, - //.name = "Y thing", + .name = "Y thing", }; int main(void) |