Merge to Fedora kernel-2.6.7-1.492
[linux-2.6.git] / include / linux / module.h
index 0a86652..9fa25f6 100644 (file)
 #include <linux/kmod.h>
 #include <linux/elf.h>
 #include <linux/stringify.h>
+#include <linux/kobject.h>
+#include <linux/moduleparam.h>
 #include <asm/local.h>
 
 #include <asm/module.h>
 
 /* Not Yet Implemented */
 #define MODULE_SUPPORTED_DEVICE(name)
-#define print_modules()
 
 /* v850 toolchain uses a `_' prefix for all user symbols */
 #ifndef MODULE_SYMBOL_PREFIX
@@ -207,6 +208,39 @@ enum module_state
        MODULE_STATE_GOING,
 };
 
+/* sysfs stuff */
+struct module_attribute
+{
+       struct attribute attr;
+       struct kernel_param *param;
+};
+
+struct module_kobject
+{
+       /* Everyone should have one of these. */
+       struct kobject kobj;
+
+       /* We always have refcnt, we may have others from module_param(). */
+       unsigned int num_attributes;
+       struct module_attribute attr[0];
+};
+
+/* Similar stuff for section attributes. */
+#define MODULE_SECT_NAME_LEN 32
+struct module_sect_attr
+{
+       struct attribute attr;
+       char name[MODULE_SECT_NAME_LEN];
+       unsigned long address;
+};
+
+struct module_sections
+{
+       struct kobject kobj;
+       struct module_sect_attr attrs[0];
+};
+
+
 struct module
 {
        enum module_state state;
@@ -217,6 +251,9 @@ struct module
        /* Unique handle for this module */
        char name[MODULE_NAME_LEN];
 
+       /* Sysfs stuff. */
+       struct module_kobject *mkobj;
+
        /* Exported symbols */
        const struct kernel_symbol *syms;
        unsigned int num_syms;
@@ -254,6 +291,9 @@ struct module
 
        /* Am I GPL-compatible */
        int license_gplok;
+       
+       /* Am I gpg signed */
+       int gpgsig_ok;
 
 #ifdef CONFIG_MODULE_UNLOAD
        /* Reference counts */
@@ -267,6 +307,9 @@ struct module
 
        /* Destruction function. */
        void (*exit)(void);
+
+       /* Fake kernel param for refcnt. */
+       struct kernel_param refcnt_param;
 #endif
 
 #ifdef CONFIG_KALLSYMS
@@ -274,6 +317,9 @@ struct module
        Elf_Sym *symtab;
        unsigned long num_symtab;
        char *strtab;
+
+       /* Section attributes */
+       struct module_sections *sect_attrs;
 #endif
 
        /* Per-cpu data. */
@@ -292,8 +338,9 @@ static inline int module_is_live(struct module *mod)
        return mod->state != MODULE_STATE_GOING;
 }
 
-/* Is this address in a module? */
+/* Is this address in a module? (second is with no locks, for oops) */
 struct module *module_text_address(unsigned long addr);
+struct module *__module_text_address(unsigned long addr);
 
 /* Returns module and fills in value, defined and namebuf, or NULL if
    symnum out of range. */
@@ -400,6 +447,7 @@ const struct exception_table_entry *search_module_extables(unsigned long addr);
 int register_module_notifier(struct notifier_block * nb);
 int unregister_module_notifier(struct notifier_block * nb);
 
+extern void print_modules(void);
 #else /* !CONFIG_MODULES... */
 #define EXPORT_SYMBOL(sym)
 #define EXPORT_SYMBOL_GPL(sym)
@@ -418,6 +466,12 @@ static inline struct module *module_text_address(unsigned long addr)
        return NULL;
 }
 
+/* Is this address in a module? (don't take a lock, we're oopsing) */
+static inline struct module *__module_text_address(unsigned long addr)
+{
+       return NULL;
+}
+
 /* Get/put a kernel symbol (calls should be symmetric) */
 #define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); })
 #define symbol_put(x) do { } while(0)
@@ -480,6 +534,9 @@ static inline int unregister_module_notifier(struct notifier_block * nb)
 
 #define module_put_and_exit(code) do_exit(code)
 
+static inline void print_modules(void)
+{
+}
 #endif /* CONFIG_MODULES */
 
 #define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x)
@@ -497,29 +554,8 @@ struct obsolete_modparm {
 struct obsolete_modparm __parm_##var __attribute__((section("__obsparm"))) = \
 { __stringify(var), type };
 
-static inline void __deprecated MOD_INC_USE_COUNT(struct module *module)
-{
-       __unsafe(module);
-
-#if defined(CONFIG_MODULE_UNLOAD) && defined(MODULE)
-       local_inc(&module->ref[get_cpu()].count);
-       put_cpu();
-#else
-       (void)try_module_get(module);
-#endif
-}
-
-static inline void __deprecated MOD_DEC_USE_COUNT(struct module *module)
-{
-       module_put(module);
-}
-
-#define MOD_INC_USE_COUNT      MOD_INC_USE_COUNT(THIS_MODULE)
-#define MOD_DEC_USE_COUNT      MOD_DEC_USE_COUNT(THIS_MODULE)
 #else
 #define MODULE_PARM(var,type)
-#define MOD_INC_USE_COUNT      do { } while (0)
-#define MOD_DEC_USE_COUNT      do { } while (0)
 #endif
 
 #define __MODULE_STRING(x) __stringify(x)