0001
0002 #ifndef _LINUX_UML_INIT_H
0003 #define _LINUX_UML_INIT_H
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 #ifndef _LINUX_INIT_H
0041 typedef int (*initcall_t)(void);
0042 typedef void (*exitcall_t)(void);
0043
0044 #include <linux/compiler_types.h>
0045
0046
0047
0048 #define __init __section(".init.text")
0049 #define __initdata __section(".init.data")
0050 #define __exitdata __section(".exit.data")
0051 #define __exit_call __used __section(".exitcall.exit")
0052
0053 #ifdef MODULE
0054 #define __exit __section(".exit.text")
0055 #else
0056 #define __exit __used __section(".exit.text")
0057 #endif
0058
0059 #endif
0060
0061 #ifndef MODULE
0062 struct uml_param {
0063 const char *str;
0064 int (*setup_func)(char *, int *);
0065 };
0066
0067 extern initcall_t __uml_postsetup_start, __uml_postsetup_end;
0068 extern const char *__uml_help_start, *__uml_help_end;
0069 #endif
0070
0071 #define __uml_exitcall(fn) \
0072 static exitcall_t __uml_exitcall_##fn __uml_exit_call = fn
0073
0074 extern struct uml_param __uml_setup_start, __uml_setup_end;
0075
0076 #define __uml_postsetup(fn) \
0077 static initcall_t __uml_postsetup_##fn __uml_postsetup_call = fn
0078
0079 #define __non_empty_string(dummyname,string) \
0080 struct __uml_non_empty_string_struct_##dummyname \
0081 { \
0082 char _string[sizeof(string)-2]; \
0083 }
0084
0085 #ifndef MODULE
0086 #define __uml_setup(str, fn, help...) \
0087 __non_empty_string(fn ##_setup, str); \
0088 __uml_help(fn, help); \
0089 static char __uml_setup_str_##fn[] __initdata = str; \
0090 static struct uml_param __uml_setup_##fn __uml_init_setup = { __uml_setup_str_##fn, fn }
0091 #else
0092 #define __uml_setup(str, fn, help...) \
0093
0094 #endif
0095
0096 #define __uml_help(fn, help...) \
0097 __non_empty_string(fn ##__help, help); \
0098 static char __uml_help_str_##fn[] __initdata = help; \
0099 static const char *__uml_help_##fn __uml_setup_help = __uml_help_str_##fn
0100
0101
0102
0103
0104
0105 #define __uml_init_setup __used __section(".uml.setup.init")
0106 #define __uml_setup_help __used __section(".uml.help.init")
0107 #define __uml_postsetup_call __used __section(".uml.postsetup.init")
0108 #define __uml_exit_call __used __section(".uml.exitcall.exit")
0109
0110 #ifdef __UM_HOST__
0111
0112 #define __define_initcall(level,fn) \
0113 static initcall_t __initcall_##fn __used \
0114 __attribute__((__section__(".initcall" level ".init"))) = fn
0115
0116
0117
0118
0119 #define __initcall(fn) __define_initcall("1", fn)
0120
0121 #define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn
0122
0123 #define __init_call __used __section(".initcall.init")
0124
0125 #endif
0126
0127 #endif