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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 31 Oct 2007 10:52:35 +0100,
Stefan Richter <stefanr@xxxxxxxxxxxxxxxxx> wrote:

> Cornelia Huck wrote:
> > Greg KH <greg@xxxxxxxxx> 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();
> 

Hm, I find that a bit harder to parse...

mask_out() would also imply that the common use case is to have all
attributes in the group created and that you need to take action to
have an attribute not created.
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux