>> >I think it can be argued both ways, honestly.
>> Yep. And I'd argue in for of module_get() :)
>
>My only real insistence in this is that such an interface be called
>__try_module_get(), because the "__" warn people that it's a "you'd
>better know *exactly* what you are doing", even though the "try" is a
>bit of a misnomer.
Yeah, I think 'try' is definitely be a misnomer in this case.
How about something like this ?
static inline void __module_get(struct module *mod)
{
#ifdef CONFIG_MODULE_DETECT_API_VIOLATION
if (!module_refcount(mod))
__unsafe(mod);
#endif
local_inc(&mod->ref[get_cpu()].count);
put_cpu();
}
We will be able to compile the kernel with CONFIG_MODULE_DETECT_API_VIOLATION
and easily find all modules that call __module_get() without holding a reference.
Comments ?
Max
-
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/