Messages in this thread | | | From | Rusty Russell <> | Subject | Re: Kernel module version support. | Date | Fri, 03 Jan 2003 16:54:25 +1100 |
| |
In message <957BD1C2BF3CD411B6C500A0C944CA2601F1170F@pdsmsx32.pd.intel.com> you write: > Hi Rusty > Thanks for your rapid responding. > > And as you are the maintainer of kernel module support, I would like to know > how > you think about export some APIs for geting a specified module structure's > pointer. > Just like: > struct module *get_module(const char *name) > { > struct module *mod; > down(&module_mutex); > mod = find_module(name); > up(&module_mutex); > return mod; > } > EXPORT_SYMBOL_GPL(get_module);
Well, you also need: if (mod && !try_module_get(mod)) mod = NULL; /* Not ready, or vanishing. Ignore. */
Just before the "up(&module_mutex);".
I'm not convinced you don't want some other, more powerful interface, though, like "get_ksymbol_address()" or something.
Rusty. -- Anyone who quotes me in their sig is an idiot. -- Rusty Russell. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |