Re: [PATCH] sysfs: add filter function to groups

Stefan Richter
2007-10-31T09:52:42Z

Cornelia Huck wrote:
> Greg KH <greg@kroah.com> wrote:
>> On Tue, Oct 30, 2007 at 01:25:43PM -0500, James Bottomley wrote:
>>> + for (i = 0, attr = grp->attrs; *attr; i++, attr++)
>>> + if (grp->is_visible &&
>>> + grp->is_visible(kobj, *attr, i))
>>> + sysfs_hash_and_remove(dir_sd, (*attr)->name);
>> Hm, doesn't this break for the zillions of attribute groups that do not
>> have the is_visible function set?
...
> Would it make more sense then to turn the meaning of the callback
> around?
>
> for (...) {
> if (grp->mask_out && grp->mask_out(kobj, *attr, i))
> continue;
> error |= sysfs_add_file(...);
> }

if (!grp->is_visible ||
grp->is_visible(kobj, *attr, i))
add or remove();

--
Stefan Richter
-=====-=-=== =-=- =====