patch-2.3.32 linux/kernel/module.c
Next file: linux/kernel/sched.c
Previous file: linux/kernel/ksyms.c
Back to the patch index
Back to the overall index
- Lines: 94
- Date:
Thu Dec 9 13:23:13 1999
- Orig file:
v2.3.31/linux/kernel/module.c
- Orig date:
Tue Dec 7 09:32:52 1999
diff -u --recursive --new-file v2.3.31/linux/kernel/module.c linux/kernel/module.c
@@ -13,6 +13,7 @@
* 0.99.14 version by Jon Tombs <jon@gtex02.us.es>,
* Heavily modified by Bjorn Ekwall <bj0rn@blox.se> May 1994 (C)
* Rewritten by Richard Henderson <rth@tamu.edu> Dec 1996
+ * Add MOD_INITIALIZING Keith Owens <kaos@ocs.com.au> Nov 1999
*
* This source is covered by the GNU GPL, the same as all kernel sources.
*/
@@ -323,16 +324,18 @@
put_mod_name(name);
/* Initialize the module. */
+ mod->flags |= MOD_INITIALIZING;
atomic_set(&mod->uc.usecount,1);
if (mod->init && mod->init() != 0) {
atomic_set(&mod->uc.usecount,0);
+ mod->flags &= ~MOD_INITIALIZING;
error = -EBUSY;
goto err0;
}
atomic_dec(&mod->uc.usecount);
/* And set it running. */
- mod->flags |= MOD_RUNNING;
+ mod->flags = (mod->flags | MOD_RUNNING) & ~MOD_INITIALIZING;
error = 0;
goto err0;
@@ -456,7 +459,7 @@
if (mod == &kernel_module)
return -EINVAL;
- if ((mod->flags & (MOD_RUNNING | MOD_DELETED)) != MOD_RUNNING)
+ if (!MOD_CAN_QUERY(mod))
if (put_user(0, ret))
return -EFAULT;
else
@@ -500,7 +503,7 @@
if (mod == &kernel_module)
return -EINVAL;
- if ((mod->flags & (MOD_RUNNING | MOD_DELETED)) != MOD_RUNNING)
+ if (!MOD_CAN_QUERY(mod))
if (put_user(0, ret))
return -EFAULT;
else
@@ -544,7 +547,7 @@
char *strings;
unsigned long *vals;
- if ((mod->flags & (MOD_RUNNING | MOD_DELETED)) != MOD_RUNNING)
+ if (!MOD_CAN_QUERY(mod))
if (put_user(0, ret))
return -EFAULT;
else
@@ -710,7 +713,7 @@
struct module_symbol *msym;
unsigned int j;
- if ((mod->flags & (MOD_RUNNING|MOD_DELETED)) != MOD_RUNNING)
+ if (!MOD_CAN_QUERY(mod))
continue;
/* magic: write module info as a pseudo symbol */
@@ -859,7 +862,10 @@
safe_copy_cstr(" (autoclean)");
if (!(mod->flags & MOD_USED_ONCE))
safe_copy_cstr(" (unused)");
- } else
+ }
+ else if (mod->flags & MOD_INITIALIZING)
+ safe_copy_cstr(" (initializing)");
+ else
safe_copy_cstr(" (uninitialized)");
if ((ref = mod->refs) != NULL) {
@@ -903,7 +909,7 @@
unsigned i;
struct module_symbol *sym;
- if (!(mod->flags & MOD_RUNNING) || (mod->flags & MOD_DELETED))
+ if (!MOD_CAN_QUERY(mod))
continue;
for (i = mod->nsyms, sym = mod->syms; i > 0; --i, ++sym) {
@@ -951,7 +957,7 @@
for (mp = module_list; mp; mp = mp->next) {
if (((modname == NULL) || (strcmp(mp->name, modname) == 0)) &&
- (mp->flags & (MOD_RUNNING | MOD_DELETED)) == MOD_RUNNING &&
+ MOD_CAN_QUERY(mp) &&
(mp->nsyms > 0)) {
for (i = mp->nsyms, sym = mp->syms;
i > 0; --i, ++sym) {
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)