Thanks for you reply, please see inline.
Heiko Carstens <heiko.carstens <at> de.ibm.com> writes:
>
[snip]
> > static inline int try_module_get(struct module *module){
> > int ret = 1; <--- error case when !module
> > if (module) {
> > unsigned int cpu = get_cpu();
> > if (likely(module_is_live(module)))
> > local_inc(&module->ref[cpu].count);
> > else
> > ret = 0; <--- error case
> > put_cpu();
> > }
> > return ret; <----
> > }
> > ----
[snip]
> Somewhere in module.h you have:
>
> #ifdef MODULE
> #define THIS_MODULE (&__this_module)
> #else /* !MODULE */
> #define THIS_MODULE ((struct module *)0)
> #endif
>
> So this just means, that THIS_MODULE is NULL for compiled in modules
> and therefore try_module_get(NULL) succeeds. It's not an error case.
Agreed.
Then what is return value if my module tries to 'get' a module which does not
exist (and is a module, not in-built)? . Is it '1' ?
Or am I imagining a hypothetical scenario which would not exist?
Thanks again for your fast response.
Shreyansh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]