patch-2.1.23 linux/include/linux/init.h

Next file: linux/include/linux/ioport.h
Previous file: linux/include/linux/fs.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.22/linux/include/linux/init.h linux/include/linux/init.h
@@ -0,0 +1,55 @@
+#ifndef _LINUX_INIT_H
+#define _LINUX_INIT_H
+
+/* These macros are used to mark some functions or 
+ * initialized data (doesn't apply to uninitialized data)
+ * as `initialization' functions. The kernel can take this
+ * as hint that the function is used only during the initialization
+ * phase and free up used memory resources after
+ *
+ * Usage:
+ * For functions:
+ * you can surround the whole function declaration 
+ * just before function body into __initfunc() macro, like:
+ *
+ * __initfunc (static void initme(int x, int y))
+ * {
+ *    extern int z; z = x * y;
+ * }
+ *
+ * if the function has a prototype somewhere, you can also add
+ * __init between closing brace of the prototype and semicolon:
+ *
+ * extern int initialize_foobar_device(int, int, int) __init;
+ *
+ * For initialized data:
+ * you should insert __initdata between the variable name and equal
+ * sign followed by value, e.g.:
+ *
+ * static int init_variable __initdata = 0;
+ * static char linux_logo[] __initdata = { 0x32, 0x36, ... };
+ */
+
+#ifndef __init
+#if (defined (__svr4__) || defined (__ELF__)) && !defined (MODULE)
+#define __init __attribute__ ((__section__ (".text.init")))
+#define __initdata __attribute__ ((__section__ (".data.init")))
+#define __initfunc(__arginit) \
+	__arginit __init; \
+	__arginit
+/* For assembly routines */
+#define __INIT		.section	".text.init",#alloc,#execinstr
+#define __FINIT	.previous
+#define __INITDATA	.section	".data.init",#alloc,#write
+#else
+#define	__init
+#define __initdata
+#define __initfunc(__arginit) __arginit
+/* For assembly routines */
+#define __INIT
+#define __FINIT
+#define __INITDATA
+#endif
+#endif
+
+#endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov