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

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

 



Cornelia Huck wrote:
> On Wed, 31 Oct 2007 10:52:35 +0100,
> Stefan Richter <[email protected]> wrote:
>> 		if (!grp->is_visible ||
>> 		    grp->is_visible(kobj, *attr, i))
>> 			add or remove();
>>
> 
> Hm, I find that a bit harder to parse...

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

However, how beautiful the implementation of static void remove_files()
and static int create_files() looks doesn't matter.  What's important is
that

 struct attribute_group {
 	const char		*name;
+	int			(*is_visible)(struct kobject *,
+					      struct attribute *, int);
 	struct attribute	**attrs;
 };

makes sense to users --- because this is the API.

[BTW, like most of the existing driver core APIs, there are kerneldoc
comments missing here.]

> 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.

Here you have a point.  But James has a point too when he says:
| We basically want to show capability by which file is present.

Anyway, /if/ the reverse logic is preferred, it shouldn't be called
"mask_out()" but rather "is_masked()" or "is_hidden()" or the like.
-- 
Stefan Richter
-=====-=-=== =-=- =====
http://arcgraph.de/sr/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux