nfsd41: introduce nfs4_client cl_sessions list
[safe/jmp/linux-2.6] / include / linux / module.h
index 3e03b1a..145a755 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/kobject.h>
 #include <linux/moduleparam.h>
 #include <linux/marker.h>
+#include <linux/tracepoint.h>
 #include <asm/local.h>
 
 #include <asm/module.h>
 /* Not Yet Implemented */
 #define MODULE_SUPPORTED_DEVICE(name)
 
-/* v850 toolchain uses a `_' prefix for all user symbols */
+/* some toolchains uses a `_' prefix for all user symbols */
 #ifndef MODULE_SYMBOL_PREFIX
 #define MODULE_SYMBOL_PREFIX ""
 #endif
 
-#define MODULE_NAME_LEN (64 - sizeof(unsigned long))
+#define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN
 
 struct kernel_symbol
 {
@@ -59,6 +60,7 @@ struct module_kobject
        struct kobject kobj;
        struct module *mod;
        struct kobject *drivers_dir;
+       struct module_param_attrs *mp;
 };
 
 /* These are either module local, or the kernel's dummy ones. */
@@ -217,11 +219,6 @@ void *__symbol_get_gpl(const char *symbol);
 
 #endif
 
-struct module_ref
-{
-       local_t count;
-} ____cacheline_aligned;
-
 enum module_state
 {
        MODULE_STATE_LIVE,
@@ -241,7 +238,6 @@ struct module
 
        /* Sysfs stuff. */
        struct module_kobject mkobj;
-       struct module_param_attrs *param_attrs;
        struct module_attribute *modinfo_attrs;
        const char *version;
        const char *srcversion;
@@ -249,31 +245,34 @@ struct module
 
        /* Exported symbols */
        const struct kernel_symbol *syms;
-       unsigned int num_syms;
        const unsigned long *crcs;
+       unsigned int num_syms;
 
        /* GPL-only exported symbols. */
-       const struct kernel_symbol *gpl_syms;
        unsigned int num_gpl_syms;
+       const struct kernel_symbol *gpl_syms;
        const unsigned long *gpl_crcs;
 
+#ifdef CONFIG_UNUSED_SYMBOLS
        /* unused exported symbols. */
        const struct kernel_symbol *unused_syms;
-       unsigned int num_unused_syms;
        const unsigned long *unused_crcs;
+       unsigned int num_unused_syms;
+
        /* GPL-only, unused exported symbols. */
-       const struct kernel_symbol *unused_gpl_syms;
        unsigned int num_unused_gpl_syms;
+       const struct kernel_symbol *unused_gpl_syms;
        const unsigned long *unused_gpl_crcs;
+#endif
 
        /* symbols that will be GPL-only in the near future. */
        const struct kernel_symbol *gpl_future_syms;
-       unsigned int num_gpl_future_syms;
        const unsigned long *gpl_future_crcs;
+       unsigned int num_gpl_future_syms;
 
        /* Exception table */
        unsigned int num_exentries;
-       const struct exception_table_entry *extable;
+       struct exception_table_entry *extable;
 
        /* Startup function. */
        int (*init)(void);
@@ -285,13 +284,10 @@ struct module
        void *module_core;
 
        /* Here are the sizes of the init and core sections */
-       unsigned long init_size, core_size;
+       unsigned int init_size, core_size;
 
        /* The size of the executable code in each section.  */
-       unsigned long init_text_size, core_text_size;
-
-       /* The handle returned from unwind_add_table. */
-       void *unwind_info;
+       unsigned int init_text_size, core_text_size;
 
        /* Arch-specific module values */
        struct mod_arch_specific arch;
@@ -300,29 +296,15 @@ struct module
 
 #ifdef CONFIG_GENERIC_BUG
        /* Support for BUG */
+       unsigned num_bugs;
        struct list_head bug_list;
        struct bug_entry *bug_table;
-       unsigned num_bugs;
-#endif
-
-#ifdef CONFIG_MODULE_UNLOAD
-       /* Reference counts */
-       struct module_ref ref[NR_CPUS];
-
-       /* What modules depend on me? */
-       struct list_head modules_which_use_me;
-
-       /* Who is waiting for us to be unloaded */
-       struct task_struct *waiter;
-
-       /* Destruction function. */
-       void (*exit)(void);
 #endif
 
 #ifdef CONFIG_KALLSYMS
        /* We keep the symbol and string tables for kallsyms. */
        Elf_Sym *symtab;
-       unsigned long num_symtab;
+       unsigned int num_symtab;
        char *strtab;
 
        /* Section attributes */
@@ -342,6 +324,27 @@ struct module
        struct marker *markers;
        unsigned int num_markers;
 #endif
+#ifdef CONFIG_TRACEPOINTS
+       struct tracepoint *tracepoints;
+       unsigned int num_tracepoints;
+#endif
+
+#ifdef CONFIG_MODULE_UNLOAD
+       /* What modules depend on me? */
+       struct list_head modules_which_use_me;
+
+       /* Who is waiting for us to be unloaded */
+       struct task_struct *waiter;
+
+       /* Destruction function. */
+       void (*exit)(void);
+
+#ifdef CONFIG_SMP
+       char *refptr;
+#else
+       local_t ref;
+#endif
+#endif
 };
 #ifndef MODULE_ARCH_INIT
 #define MODULE_ARCH_INIT {}
@@ -360,6 +363,18 @@ struct module *module_text_address(unsigned long addr);
 struct module *__module_text_address(unsigned long addr);
 int is_module_address(unsigned long addr);
 
+static inline int within_module_core(unsigned long addr, struct module *mod)
+{
+       return (unsigned long)mod->module_core <= addr &&
+              addr < (unsigned long)mod->module_core + mod->core_size;
+}
+
+static inline int within_module_init(unsigned long addr, struct module *mod)
+{
+       return (unsigned long)mod->module_init <= addr &&
+              addr < (unsigned long)mod->module_init + mod->init_size;
+}
+
 /* Returns 0 and fills in value, defined and namebuf, or -ERANGE if
    symnum out of range. */
 int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
@@ -378,13 +393,21 @@ void __symbol_put(const char *symbol);
 #define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x)
 void symbol_put_addr(void *addr);
 
+static inline local_t *__module_ref_addr(struct module *mod, int cpu)
+{
+#ifdef CONFIG_SMP
+       return (local_t *) (mod->refptr + per_cpu_offset(cpu));
+#else
+       return &mod->ref;
+#endif
+}
+
 /* Sometimes we know we already have a refcount, and it's easier not
    to handle the error case (which only happens with rmmod --wait). */
 static inline void __module_get(struct module *module)
 {
        if (module) {
-               BUG_ON(module_refcount(module) == 0);
-               local_inc(&module->ref[get_cpu()].count);
+               local_inc(__module_ref_addr(module, get_cpu()));
                put_cpu();
        }
 }
@@ -396,7 +419,7 @@ static inline int try_module_get(struct module *module)
        if (module) {
                unsigned int cpu = get_cpu();
                if (likely(module_is_live(module)))
-                       local_inc(&module->ref[cpu].count);
+                       local_inc(__module_ref_addr(module, cpu));
                else
                        ret = 0;
                put_cpu();
@@ -450,6 +473,9 @@ extern void print_modules(void);
 
 extern void module_update_markers(void);
 
+extern void module_update_tracepoints(void);
+extern int module_get_iter_tracepoints(struct tracepoint_iter *iter);
+
 #else /* !CONFIG_MODULES... */
 #define EXPORT_SYMBOL(sym)
 #define EXPORT_SYMBOL_GPL(sym)
@@ -554,6 +580,15 @@ static inline void module_update_markers(void)
 {
 }
 
+static inline void module_update_tracepoints(void)
+{
+}
+
+static inline int module_get_iter_tracepoints(struct tracepoint_iter *iter)
+{
+       return 0;
+}
+
 #endif /* CONFIG_MODULES */
 
 struct device_driver;