]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/module.c
r6040: compile error
[linux-2.6-omap-h63xx.git] / kernel / module.c
index dcb8a2cbf75e2152496ebe4ca25d19ac50018401..1bb4c5e0d56e330b1de92b5e20fddbd446e9d314 100644 (file)
@@ -496,6 +496,8 @@ static struct module_attribute modinfo_##field = {                    \
 MODINFO_ATTR(version);
 MODINFO_ATTR(srcversion);
 
+static char last_unloaded_module[MODULE_NAME_LEN+1];
+
 #ifdef CONFIG_MODULE_UNLOAD
 /* Init the unload section of the module. */
 static void module_unload_init(struct module *mod)
@@ -719,6 +721,8 @@ sys_delete_module(const char __user *name_user, unsigned int flags)
                mod->exit();
                mutex_lock(&module_mutex);
        }
+       /* Store the name of the last unloaded module for diagnostic purposes */
+       sprintf(last_unloaded_module, mod->name);
        free_module(mod);
 
  out:
@@ -2357,21 +2361,30 @@ static void m_stop(struct seq_file *m, void *p)
        mutex_unlock(&module_mutex);
 }
 
-static char *taint_flags(unsigned int taints, char *buf)
+static char *module_flags(struct module *mod, char *buf)
 {
        int bx = 0;
 
-       if (taints) {
+       if (mod->taints ||
+           mod->state == MODULE_STATE_GOING ||
+           mod->state == MODULE_STATE_COMING) {
                buf[bx++] = '(';
-               if (taints & TAINT_PROPRIETARY_MODULE)
+               if (mod->taints & TAINT_PROPRIETARY_MODULE)
                        buf[bx++] = 'P';
-               if (taints & TAINT_FORCED_MODULE)
+               if (mod->taints & TAINT_FORCED_MODULE)
                        buf[bx++] = 'F';
                /*
                 * TAINT_FORCED_RMMOD: could be added.
                 * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't
                 * apply to modules.
                 */
+
+               /* Show a - for module-is-being-unloaded */
+               if (mod->state == MODULE_STATE_GOING)
+                       buf[bx++] = '-';
+               /* Show a + for module-is-being-loaded */
+               if (mod->state == MODULE_STATE_COMING)
+                       buf[bx++] = '+';
                buf[bx++] = ')';
        }
        buf[bx] = '\0';
@@ -2398,7 +2411,7 @@ static int m_show(struct seq_file *m, void *p)
 
        /* Taints info */
        if (mod->taints)
-               seq_printf(m, " %s", taint_flags(mod->taints, buf));
+               seq_printf(m, " %s", module_flags(mod, buf));
 
        seq_printf(m, "\n");
        return 0;
@@ -2493,7 +2506,9 @@ void print_modules(void)
 
        printk("Modules linked in:");
        list_for_each_entry(mod, &modules, list)
-               printk(" %s%s", mod->name, taint_flags(mod->taints, buf));
+               printk(" %s%s", mod->name, module_flags(mod, buf));
+       if (last_unloaded_module[0])
+               printk(" [last unloaded: %s]", last_unloaded_module);
        printk("\n");
 }