00001 #ifndef _LINUX_INIT_H
00002 #define _LINUX_INIT_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifndef MODULE
00051 #include <asm/init.h>
00052 #else
00053 #define __init
00054 #define __initdata
00055 #define __initfunc(__arginit) __arginit
00056
00057 #define __INIT
00058 #define __FINIT
00059 #define __INITDATA
00060 #endif
00061
00062 #if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
00063 #define __initlocaldata __initdata
00064 #else
00065 #define __initlocaldata
00066 #endif
00067
00068
00069 #ifndef __ASSEMBLY__
00070
00071
00072
00073
00074 struct new_kernel_param {
00075 const char *str;
00076 int (*setup_func)(char *);
00077 };
00078
00079 extern struct new_kernel_param __setup_start, __setup_end;
00080
00081 #define __setup(str, fn) \
00082 static char __setup_str_##fn[] __initdata = str; \
00083 static struct new_kernel_param __setup_##fn __initsetup = { __setup_str_##fn, fn }
00084
00085 #define __initsetup __attribute__ ((unused,__section__ (".setup.init")))
00086
00087
00088
00089
00090
00091 typedef int (*initcall_t)(void);
00092 typedef void (*exitcall_t)(void);
00093
00094 #define __init_call __attribute__ ((unused,__section__ (".initcall.init")))
00095 #define __exit_call __attribute__ ((unused,__section__ (".exitcall.exit")))
00096
00097 extern initcall_t __initcall_start, __initcall_end;
00098
00099 #define __initcall(fn) \
00100 static initcall_t __initcall_##fn __init_call = fn
00101 #define __exitcall(fn) \
00102 static exitcall_t __exitcall_##fn __exit_call = fn
00103
00104 #ifdef MODULE
00105
00106 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 91)
00107
00108
00109
00110
00111
00112 typedef int (*__init_module_func_t)(void);
00113 typedef void (*__cleanup_module_func_t)(void);
00114 #define module_init(x) \
00115 int init_module(void) __attribute__((alias(#x))); \
00116 extern inline __init_module_func_t __init_module_inline(void) \
00117 { return x; }
00118 #define module_exit(x) \
00119 void cleanup_module(void) __attribute__((alias(#x))); \
00120 extern inline __cleanup_module_func_t __cleanup_module_inline(void) \
00121 { return x; }
00122 #else
00123 #define module_init(x) int init_module(void) { return x(); }
00124 #define module_exit(x) void cleanup_module(void) { x(); }
00125 #endif
00126
00127 #else
00128 #define module_init(x) __initcall(x);
00129 #define module_exit(x) __exitcall(x);
00130 #endif
00131
00132 #endif
00133 #endif