FreeBSD Bugzilla – Attachment 79574 Details for
Bug 114291
[RFE] [modules] [patch] add dynamic module references
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.75 KB, created by
david chosrova
on 2007-07-04 16:20:03 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
david chosrova
Created:
2007-07-04 16:20:03 UTC
Size:
1.75 KB
patch
obsolete
>--- kern_module.c.orig Wed Jul 4 10:33:06 2007 >+++ kern_module.c Wed Jul 4 10:21:28 2007 >@@ -52,6 +52,7 @@ > TAILQ_ENTRY(module) flink; /* all modules in a file */ > struct linker_file *file; /* file which contains this module */ > int refs; /* reference count */ >+ int dynrefs; /* dynamic reference count */ > int id; /* unique id number */ > char *name; /* module name */ > modeventhand_t handler; /* event handler */ >@@ -65,6 +66,7 @@ > struct sx modules_sx; > static int nextid = 1; > static void module_shutdown(void *, int); >+static int module_updatedynrefs(const char* , int ); > > static int > modevent_nop(module_t mod, int what, void *arg) >@@ -152,6 +154,7 @@ > } > newmod->refs = 1; > newmod->id = nextid++; >+ newmod->dynrefs = 0; > newmod->name = (char *)(newmod + 1); > strcpy(newmod->name, data->name); > newmod->handler = data->evhand ? data->evhand : modevent_nop; >@@ -231,7 +234,9 @@ > module_unload(module_t mod, int flags) > { > int error; >- error = MOD_EVENT(mod, MOD_QUIESCE); >+ MOD_SLOCK; >+ (mod->dynrefs == 0) ? (error = MOD_EVENT(mod, MOD_QUIESCE)) : (error = EPERM); >+ MOD_SUNLOCK; > if (error == EOPNOTSUPP || error == EINVAL) > error = 0; > if (flags == LINKER_UNLOAD_NORMAL && error != 0) >@@ -261,6 +266,37 @@ > > MOD_XLOCK_ASSERT; > mod->data = *datap; >+} >+ >+static int >+module_updatedynrefs(const char* modname, int action) >+{ >+ module_t mod; >+ >+ MOD_XLOCK; >+ mod = module_lookupbyname(modname); >+ >+ if(mod == 0) { >+ MOD_XUNLOCK; >+ return(-1); >+ } >+ >+ (action == 1) ? mod->dynrefs++ : mod->dynrefs--; >+ MOD_XUNLOCK; >+ return (0); >+} >+ >+int >+module_add_dynrefs(const char *modname) >+{ >+ >+ return (module_updatedynrefs(modname,1)); >+} >+ >+int >+module_remove_dynrefs(const char * modname) >+{ >+ return (module_updatedynrefs(modname,0)); > } > > /*
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 114291
: 79574