Messages in this thread | ![/](/images/icornerl.gif) | | From | Rusty Russell <> | Subject | Re: [RFC] add kobject to struct module | Date | Wed, 10 Sep 2003 18:07:35 +1000 |
| |
In message <20030910041122.GE9760@kroah.com> you write: > On Wed, Sep 10, 2003 at 01:31:02PM +1000, Rusty Russell wrote: > > Because kobject does not have a "struct module *owner", we can't > > simply add in the refcount. > > Um, I don't understand. There is no "struct module *owner in struct > kobject. There is one in struct attribute, but I don't set it, so it > doesn't matter for this usage.
Your parser broke, I think 8)
> > The module reference count is defined to never go from zero to one > > when the module is dying, which means callers must use > > try_module_get(). I grab the reference on read/write, which means > > opening the file won't hold the module, either. > > read/write of what? The attribute? Sure, why not set the module > attribute sysfs file to the module that way the reference count will be > incremented if the sysfs file is opened.
Hmm, because there's one attribute: which module would own it? You're going to creation attributes per module later (for module parameters), so when you do that it might make sense to do this too.
> But in looking at your patch, I don't see why you want to separate the > module from the kobject? What benefit does it have?
The lifetimes are separate, each controlled by their own reference count. I *know* this will work even if someone holds a reference to the kobject (for some reason in the future) even as the module is removed.
> > Were you intending to put all the info currently in /proc/modules > > under sysfs? Makes sense I think. For the options you'll need a > > subdir to avoid name clashes. > > Yes, I was going to add it, this patch was more of a "test" to see how > receptive you were to it.
More more! 8)
Thanks, 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/
| ![\](/images/icornerr.gif) |