fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / include / linux / init.h
index c684247..5a593a1 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef _LINUX_INIT_H
 #define _LINUX_INIT_H
 
-#include <linux/config.h>
 #include <linux/compiler.h>
 
 /* These macros are used to mark some functions or 
@@ -46,8 +45,6 @@
 #define __exitdata     __attribute__ ((__section__(".exit.data")))
 #define __exit_call    __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
 
-#define __sched                __attribute__((__section__(".sched.text")))
-
 #ifdef MODULE
 #define __exit         __attribute__ ((__section__(".exit.text")))
 #else
 typedef int (*initcall_t)(void);
 typedef void (*exitcall_t)(void);
 
-extern initcall_t __con_initcall_start, __con_initcall_end;
-extern initcall_t __security_initcall_start, __security_initcall_end;
+extern initcall_t __con_initcall_start[], __con_initcall_end[];
+extern initcall_t __security_initcall_start[], __security_initcall_end[];
+
+/* Defined in init/main.c */
+extern char saved_command_line[];
+extern unsigned int reset_devices;
+
+/* used by init/main.c */
+extern void setup_arch(char **);
+
 #endif
   
 #ifndef MODULE
@@ -79,19 +84,38 @@ extern initcall_t __security_initcall_start, __security_initcall_end;
  * by link order. 
  * For backwards compatibility, initcall() puts the call in 
  * the device init subsection.
+ *
+ * The `id' arg to __define_initcall() is needed so that multiple initcalls
+ * can point at the same handler without causing duplicate-symbol build errors.
  */
 
-#define __define_initcall(level,fn) \
-       static initcall_t __initcall_##fn __attribute_used__ \
+#define __define_initcall(level,fn,id) \
+       static initcall_t __initcall_##fn##id __attribute_used__ \
        __attribute__((__section__(".initcall" level ".init"))) = fn
 
-#define core_initcall(fn)              __define_initcall("1",fn)
-#define postcore_initcall(fn)          __define_initcall("2",fn)
-#define arch_initcall(fn)              __define_initcall("3",fn)
-#define subsys_initcall(fn)            __define_initcall("4",fn)
-#define fs_initcall(fn)                        __define_initcall("5",fn)
-#define device_initcall(fn)            __define_initcall("6",fn)
-#define late_initcall(fn)              __define_initcall("7",fn)
+/*
+ * A "pure" initcall has no dependencies on anything else, and purely
+ * initializes variables that couldn't be statically initialized.
+ *
+ * This only exists for built-in code, not for modules.
+ */
+#define pure_initcall(fn)              __define_initcall("0",fn,1)
+
+#define core_initcall(fn)              __define_initcall("1",fn,1)
+#define core_initcall_sync(fn)         __define_initcall("1s",fn,1s)
+#define postcore_initcall(fn)          __define_initcall("2",fn,2)
+#define postcore_initcall_sync(fn)     __define_initcall("2s",fn,2s)
+#define arch_initcall(fn)              __define_initcall("3",fn,3)
+#define arch_initcall_sync(fn)         __define_initcall("3s",fn,3s)
+#define subsys_initcall(fn)            __define_initcall("4",fn,4)
+#define subsys_initcall_sync(fn)       __define_initcall("4s",fn,4s)
+#define fs_initcall(fn)                        __define_initcall("5",fn,5)
+#define fs_initcall_sync(fn)           __define_initcall("5s",fn,5s)
+#define rootfs_initcall(fn)            __define_initcall("rootfs",fn,rootfs)
+#define device_initcall(fn)            __define_initcall("6",fn,6)
+#define device_initcall_sync(fn)       __define_initcall("6s",fn,6s)
+#define late_initcall(fn)              __define_initcall("7",fn,7)
+#define late_initcall_sync(fn)         __define_initcall("7s",fn,7s)
 
 #define __initcall(fn) device_initcall(fn)
 
@@ -109,25 +133,39 @@ extern initcall_t __security_initcall_start, __security_initcall_end;
 struct obs_kernel_param {
        const char *str;
        int (*setup_func)(char *);
+       int early;
 };
 
-/* OBSOLETE: see moduleparam.h for the right way. */
-#define __setup_param(str, unique_id, fn)                      \
+/*
+ * Only for really core code.  See moduleparam.h for the normal way.
+ *
+ * Force the alignment so the compiler doesn't space elements of the
+ * obs_kernel_param "array" too far apart in .init.setup.
+ */
+#define __setup_param(str, unique_id, fn, early)                       \
        static char __setup_str_##unique_id[] __initdata = str; \
        static struct obs_kernel_param __setup_##unique_id      \
-                __attribute_used__                             \
-                __attribute__((__section__(".init.setup")))    \
-               = { __setup_str_##unique_id, fn }
+               __attribute_used__                              \
+               __attribute__((__section__(".init.setup")))     \
+               __attribute__((aligned((sizeof(long)))))        \
+               = { __setup_str_##unique_id, fn, early }
 
 #define __setup_null_param(str, unique_id)                     \
-       __setup_param(str, unique_id, NULL)
+       __setup_param(str, unique_id, NULL, 0)
 
 #define __setup(str, fn)                                       \
-       __setup_param(str, fn, fn)
+       __setup_param(str, fn, fn, 0)
 
 #define __obsolete_setup(str)                                  \
        __setup_null_param(str, __LINE__)
 
+/* NOTE: fn is as per module_param, not __setup!  Emits warning if fn
+ * returns non-zero. */
+#define early_param(str, fn)                                   \
+       __setup_param(str, fn, fn, 1)
+
+/* Relies on saved_command_line being set */
+void __init parse_early_param(void);
 #endif /* __ASSEMBLY__ */
 
 /**
@@ -214,6 +252,31 @@ struct obs_kernel_param {
 #define __devexitdata __exitdata
 #endif
 
+#ifdef CONFIG_HOTPLUG_CPU
+#define __cpuinit
+#define __cpuinitdata
+#define __cpuexit
+#define __cpuexitdata
+#else
+#define __cpuinit      __init
+#define __cpuinitdata __initdata
+#define __cpuexit __exit
+#define __cpuexitdata  __exitdata
+#endif
+
+#if defined(CONFIG_MEMORY_HOTPLUG) || defined(CONFIG_ACPI_HOTPLUG_MEMORY) \
+       || defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)
+#define __meminit
+#define __meminitdata
+#define __memexit
+#define __memexitdata
+#else
+#define __meminit      __init
+#define __meminitdata __initdata
+#define __memexit __exit
+#define __memexitdata  __exitdata
+#endif
+
 /* Functions marked as __devexit may be discarded at kernel link time, depending
    on config options.  Newer versions of binutils detect references from
    retained sections to discarded sections and flag an error.  Pointers to