Re: [PATCH] RFC: Attributes in /sys/cdev

Patrick Mochel
2003-09-22T16:32:53Z

> BTW, I suspect that we need a way to say "this kobject and its children
> will *never* have any attributes and will never be seen in sysfs". There
> are quite a few uses when we keep kobject as a refcounting vehicle, etc.,
> but have nothing meaningful to show in sysfs tree. Keep in mind that
> sysfs nodes (including attributes) are not free - it's struct inode +
> struct dentry at the very least. Both pinned down and permanently mapped...

There is already - use kobject_init() to initialize the refcount to 1, and
kobject_put() to clean it up. (kobject_add() and kobject_del() can be used
to later add/remove it from the sysfs hierarchy).

Or, since those objects will probably never get added to sysfs, and since
few objects are ever promoted, we may just want to create a new, smaller
object purely for the refcounting vehicle..

Pat