This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define __define_initcall(level,fn,id) \ | |
static initcall_t __initcall_##fn##id __used \ | |
__attribute__((__section__(".initcall" level ".init"))) = fn | |
#define core_initcall(fn) __define_initcall("1",fn,1) | |
#define subsys_initcall(fn) __define_initcall("4",fn,4) | |
#define late_initcall(fn) __define_initcall("7",fn,7) | |
/* trimmed, obviously... */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void __init do_initcalls(void) | |
{ | |
int level; | |
for (level = 0; level < ARRAY_SIZE(initcall_levels) - 1; level++) | |
do_initcall_level(level); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "section_hacking.h" | |
static void in_equotes(const char *txt) | |
{ | |
printf("`%s'\n", txt); | |
} | |
REGISTER_FORMATTER(in_equotes); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "section_hacking.h" | |
static void in_equotes(const char *txt) | |
{ | |
printf("`%s'\n", txt); | |
} | |
REGISTER_FORMATTER(in_equotes); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "section_hacking.h" | |
extern struct formatter_info __start_my_formatters; | |
extern struct formatter_info __stop_my_formatters; | |
static void format_all(const char *txt) | |
{ | |
struct formatter_info *iter = &__start_my_formatters; | |
for ( ; iter < &__stop_my_formatters; ++iter) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "section_hacking.h" | |
extern struct formatter_info __start_my_formatters; | |
extern struct formatter_info __stop_my_formatters; | |
static void format_all(const char *txt) | |
{ | |
struct formatter_info *iter = &__start_my_formatters; | |
for ( ; iter < &__stop_my_formatters; ++iter) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void __init do_initcall_level(int level) | |
{ | |
extern const struct kernel_param __start___param[], __stop___param[]; | |
initcall_t *fn; | |
strcpy(static_command_line, saved_command_line); | |
parse_args(initcall_level_names[level], | |
static_command_line, __start___param, | |
__stop___param - __start___param, | |
level, level, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int __init_or_module do_one_initcall(initcall_t fn) | |
{ | |
int count = preempt_count(); | |
int ret; | |
/* ... */ | |
ret = fn(); | |
/* ... */ | |
return ret; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void __init do_initcall_level(int level) | |
{ | |
initcall_t *fn; | |
/* ... */ | |
for (fn = initcall_levels[level]; fn < initcall_levels[level+1]; fn++) | |
do_one_initcall(*fn); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static initcall_t *initcall_levels[] __initdata = { | |
__initcall0_start, | |
__initcall1_start, | |
__initcall2_start, | |
__initcall3_start, | |
__initcall4_start, | |
__initcall5_start, | |
__initcall6_start, | |
__initcall7_start, | |
__initcall_end, |