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

2007-11-04 Thread Greg KH
On Sun, Nov 04, 2007 at 08:12:02AM -0600, James Bottomley wrote: > On Wed, 2007-10-31 at 10:29 -0700, Greg KH wrote: > > On Wed, Oct 31, 2007 at 09:38:04AM -0500, James Bottomley wrote: > > > On Tue, 2007-10-30 at 20:55 -0700, Greg KH wrote: > > > > OSame problem here, if grp->is_visible is not set

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

2007-11-04 Thread James Bottomley
On Wed, 2007-10-31 at 10:29 -0700, Greg KH wrote: > On Wed, Oct 31, 2007 at 09:38:04AM -0500, James Bottomley wrote: > > On Tue, 2007-10-30 at 20:55 -0700, Greg KH wrote: > > > OSame problem here, if grp->is_visible is not set, sysfs_add_file() would > > > never be called, right? > > > > > > Other

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

2007-10-31 Thread Greg KH
On Wed, Oct 31, 2007 at 09:38:04AM -0500, James Bottomley wrote: > On Tue, 2007-10-30 at 20:55 -0700, Greg KH wrote: > > OSame problem here, if grp->is_visible is not set, sysfs_add_file() would > > never be called, right? > > > > Other than the logic problem (I think), I have no issue with this i

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

2007-10-31 Thread James Bottomley
On Tue, 2007-10-30 at 20:55 -0700, Greg KH wrote: > OSame problem here, if grp->is_visible is not set, sysfs_add_file() would > never be called, right? > > Other than the logic problem (I think), I have no issue with this idea > at all. Care to redo this so it works? It's a fair cop govenor ...

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

2007-10-31 Thread Cornelia Huck
On Wed, 31 Oct 2007 11:37:36 +0100, Stefan Richter <[EMAIL PROTECTED]> wrote: > > 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 ha

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

2007-10-31 Thread Mark M. Hoffman
Hi Kay: * Kay Sievers <[EMAIL PROTECTED]> [2007-10-31 03:01:56 +0100]: > On Oct 31, 2007 1:40 AM, Mark M. Hoffman <[EMAIL PROTECTED]> wrote: > > * James Bottomley <[EMAIL PROTECTED]> [2007-10-30 13:25:43 -0500]: > > > On Mon, 2007-10-29 at 18:58 +0100, Stefan Richter wrote: > > > > James Bottomley

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

2007-10-31 Thread Stefan Richter
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...

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

2007-10-31 Thread Cornelia Huck
On Wed, 31 Oct 2007 10:52:35 +0100, Stefan Richter <[EMAIL PROTECTED]> wrote: > Cornelia Huck wrote: > > Greg KH <[EMAIL PROTECTED]> 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_v

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

2007-10-31 Thread Stefan Richter
Cornelia Huck wrote: > Greg KH <[EMAIL PROTECTED]> 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)) >>> +

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

2007-10-31 Thread Cornelia Huck
On Tue, 30 Oct 2007 20:55:06 -0700, Greg KH <[EMAIL PROTECTED]> wrote: > On Tue, Oct 30, 2007 at 01:25:43PM -0500, James Bottomley wrote: > > Index: BUILD-2.6/fs/sysfs/group.c > > === > > --- BUILD-2.6.orig/fs/sysfs/group.c 2007-10-28

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

2007-10-30 Thread Greg KH
On Tue, Oct 30, 2007 at 01:25:43PM -0500, James Bottomley wrote: > On Mon, 2007-10-29 at 18:58 +0100, Stefan Richter wrote: > > James Bottomley wrote: > > >> > struct attribute_group { > > >> >const char *name; > > >> > + int (*filter_show)(struct kobj

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

2007-10-30 Thread Kay Sievers
On Oct 31, 2007 1:40 AM, Mark M. Hoffman <[EMAIL PROTECTED]> wrote: > * James Bottomley <[EMAIL PROTECTED]> [2007-10-30 13:25:43 -0500]: > > On Mon, 2007-10-29 at 18:58 +0100, Stefan Richter wrote: > > > James Bottomley wrote: > > > >> > struct attribute_group { > > > >> >const char

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

2007-10-30 Thread Mark M. Hoffman
Hi James: * James Bottomley <[EMAIL PROTECTED]> [2007-10-30 13:25:43 -0500]: > On Mon, 2007-10-29 at 18:58 +0100, Stefan Richter wrote: > > James Bottomley wrote: > > >> > struct attribute_group { > > >> >const char *name; > > >> > + int (*filter_show

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

2007-10-30 Thread Kay Sievers
On Tue, 2007-10-30 at 13:25 -0500, James Bottomley wrote: > On Mon, 2007-10-29 at 18:58 +0100, Stefan Richter wrote: > > James Bottomley wrote: > > >> > struct attribute_group { > > >> >const char *name; > > >> > + int (*filter_show)(struct kobject *,

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

2007-10-30 Thread Stefan Richter
James Bottomley wrote: > OK, so is this latest revision acceptable to everyone? No complaint from me. (I'm more or less by accident in this thread anyway. Once this feature is available in mainline, I may have use for it in drivers/firewire/ though.) Thanks, -- Stefan Richter -=-=-=== =-=-

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

2007-10-30 Thread James Bottomley
On Mon, 2007-10-29 at 18:58 +0100, Stefan Richter wrote: > James Bottomley wrote: > >> > struct attribute_group { > >> > const char *name; > >> > +int (*filter_show)(struct kobject *, int); > > > Actually, it returns a true/false value indicating

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

2007-10-30 Thread Cornelia Huck
On Mon, 29 Oct 2007 12:29:27 -0500, James Bottomley <[EMAIL PROTECTED]> wrote: > On Mon, 2007-10-29 at 13:27 -0400, Jeff Garzik wrote: > > James Bottomley wrote: > > > visibility and creation are the same thing, aren't they? An invisible > > > attribute doesn't appear in the sysfs directory, so i

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

2007-10-30 Thread Cornelia Huck
On Mon, 29 Oct 2007 12:24:06 -0500, James Bottomley <[EMAIL PROTECTED]> wrote: > > Can you determine which subset of the attributes you want just before > > actually creating the group? Then you could do something like: > > > > create_group(grp, kobj) > > { > > grp->update_creation_mask(kobj)

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

2007-10-29 Thread James Bottomley
On Mon, 2007-10-29 at 18:58 +0100, Stefan Richter wrote: > James Bottomley wrote: > >> > struct attribute_group { > >> > const char *name; > >> > +int (*filter_show)(struct kobject *, int); > > > Actually, it returns a true/false value indicating

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

2007-10-29 Thread Stefan Richter
James Bottomley wrote: >> > struct attribute_group { >> >const char *name; >> > + int (*filter_show)(struct kobject *, int); > Actually, it returns a true/false value indicating whether the given > attribute should be displayed. How about this: int

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

2007-10-29 Thread Kay Sievers
On Mon, 2007-10-29 at 12:28 -0500, James Bottomley wrote: > On Mon, 2007-10-29 at 18:27 +0100, Kay Sievers wrote: > > On Mon, 2007-10-29 at 11:57 -0500, James Bottomley wrote: > > > On Mon, 2007-10-29 at 17:54 +0100, Kay Sievers wrote: > > > > On Mon, 2007-10-29 at 10:16 -0500, James Bottomley wrot

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

2007-10-29 Thread James Bottomley
On Mon, 2007-10-29 at 13:27 -0400, Jeff Garzik wrote: > James Bottomley wrote: > > visibility and creation are the same thing, aren't they? An invisible > > attribute doesn't appear in the sysfs directory, so it's equivalent to > > the file for it not being created. > > > What about the case whe

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

2007-10-29 Thread James Bottomley
On Mon, 2007-10-29 at 18:27 +0100, Kay Sievers wrote: > On Mon, 2007-10-29 at 11:57 -0500, James Bottomley wrote: > > On Mon, 2007-10-29 at 17:54 +0100, Kay Sievers wrote: > > > On Mon, 2007-10-29 at 10:16 -0500, James Bottomley wrote: > > > > > struct attribute_group { > > > > const char

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

2007-10-29 Thread Jeff Garzik
James Bottomley wrote: visibility and creation are the same thing, aren't they? An invisible attribute doesn't appear in the sysfs directory, so it's equivalent to the file for it not being created. What about the case where it's visible at creation time, but then needs to be made selectivel

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

2007-10-29 Thread Kay Sievers
On Mon, 2007-10-29 at 11:57 -0500, James Bottomley wrote: > On Mon, 2007-10-29 at 17:54 +0100, Kay Sievers wrote: > > On Mon, 2007-10-29 at 10:16 -0500, James Bottomley wrote: > > > struct attribute_group { > > > const char *name; > > > + int (*filter_show)(stru

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

2007-10-29 Thread James Bottomley
On Mon, 2007-10-29 at 18:18 +0100, Cornelia Huck wrote: > On Mon, 29 Oct 2007 11:57:51 -0500, > James Bottomley <[EMAIL PROTECTED]> wrote: > > > On Mon, 2007-10-29 at 17:54 +0100, Kay Sievers wrote: > > > On Mon, 2007-10-29 at 10:16 -0500, James Bottomley wrote: > > > > This patch is a first pass

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

2007-10-29 Thread Cornelia Huck
On Mon, 29 Oct 2007 11:57:51 -0500, James Bottomley <[EMAIL PROTECTED]> wrote: > On Mon, 2007-10-29 at 17:54 +0100, Kay Sievers wrote: > > On Mon, 2007-10-29 at 10:16 -0500, James Bottomley wrote: > > > This patch is a first pass at adding a filter function to the group > > > attributes, just to s

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

2007-10-29 Thread James Bottomley
On Mon, 2007-10-29 at 17:54 +0100, Kay Sievers wrote: > On Mon, 2007-10-29 at 10:16 -0500, James Bottomley wrote: > > In the SCSI transport classes (and soon to be in the AEN event > > subsystem) we have a lot of need for a grouping that doesn't include all > > files in the group. We basically wan

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

2007-10-29 Thread Kay Sievers
On Mon, 2007-10-29 at 10:16 -0500, James Bottomley wrote: > In the SCSI transport classes (and soon to be in the AEN event > subsystem) we have a lot of need for a grouping that doesn't include all > files in the group. We basically want to show capability by which file > is present. A classic ex

[PATCH] sysfs: add filter function to groups

2007-10-29 Thread James Bottomley
In the SCSI transport classes (and soon to be in the AEN event subsystem) we have a lot of need for a grouping that doesn't include all files in the group. We basically want to show capability by which file is present. A classic example of this is the SPI transport class connected to the 53c700 c