patch-2.2.18 linux/include/linux/init.h
Next file: linux/include/linux/input.h
Previous file: linux/include/linux/inetdevice.h
Back to the patch index
Back to the overall index
- Lines: 79
- Date:
Sat Sep 30 15:18:06 2000
- Orig file:
v2.2.17/include/linux/init.h
- Orig date:
Sun Jun 11 21:44:23 2000
diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/include/linux/init.h linux/include/linux/init.h
@@ -17,7 +17,7 @@
* extern int z; z = x * y;
* }
*
- * Depricated: you can surround the whole function declaration
+ * Deprecated: you can surround the whole function declaration
* just before function body into __initfunc() macro, like:
*
* __initfunc (static void initme(int x, int y))
@@ -65,4 +65,69 @@
#define __initlocaldata
#endif
+
+#ifndef __ASSEMBLY__
+
+/*
+ * Used for kernel command line parameter setup
+ */
+struct new_kernel_param {
+ const char *str;
+ int (*setup_func)(char *);
+};
+
+extern struct new_kernel_param __setup_start, __setup_end;
+
+#define __setup(str, fn) \
+ static char __setup_str_##fn[] __initdata = str; \
+ static struct new_kernel_param __setup_##fn __initsetup = { __setup_str_##fn, fn }
+
+#define __initsetup __attribute__ ((unused,__section__ (".setup.init")))
+
+
+/*
+ * Used for initialization calls..
+ */
+typedef int (*initcall_t)(void);
+typedef void (*exitcall_t)(void);
+
+#define __init_call __attribute__ ((unused,__section__ (".initcall.init")))
+#define __exit_call __attribute__ ((unused,__section__ (".exitcall.exit")))
+
+extern initcall_t __initcall_start, __initcall_end;
+
+#define __initcall(fn) \
+ static initcall_t __initcall_##fn __init_call = fn
+#define __exitcall(fn) \
+ static exitcall_t __exitcall_##fn __exit_call = fn
+
+#ifdef MODULE
+/* Not sure what version aliases were introduced in, but certainly in 2.91.66. */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 91)
+/* These macros create a dummy inline: gcc 2.9x does not count alias
+ as usage, hence the `unused function' warning when __init functions
+ are declared static. We use the dummy __*_module_inline functions
+ both to kill the warning and check the type of the init/cleanup
+ function. */
+typedef int (*__init_module_func_t)(void);
+typedef void (*__cleanup_module_func_t)(void);
+#define module_init(x) \
+ int init_module(void) __attribute__((alias(#x))); \
+ extern inline __init_module_func_t __init_module_inline(void) \
+ { return x; }
+#define module_exit(x) \
+ void cleanup_module(void) __attribute__((alias(#x))); \
+ extern inline __cleanup_module_func_t __cleanup_module_inline(void) \
+ { return x; }
+#else
+#define module_init(x) int init_module(void) { return x(); }
+#define module_exit(x) void cleanup_module(void) { x(); }
+#endif
+
+#else
+#define module_init(x) __initcall(x);
+#define module_exit(x) __exitcall(x);
+#endif
+
+#endif /* __ASSEMBLY __ */
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)