From: James Bottomley <James.Bottomley@SteelEye.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>, Greg KH <greg@kroah.com>,
linux-scsi <linux-scsi@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sysfs: add filter function to groups
Date: Mon, 29 Oct 2007 12:24:06 -0500 [thread overview]
Message-ID: <1193678646.3383.76.camel@localhost.localdomain> (raw)
In-Reply-To: <20071029181814.25410e00@gondolin.boeblingen.de.ibm.com>
On Mon, 2007-10-29 at 18:18 +0100, Cornelia Huck wrote:
> On Mon, 29 Oct 2007 11:57:51 -0500,
> James Bottomley <James.Bottomley@SteelEye.com> 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 see how the idea flies. If everyone's OK with this,
> > > > I think the next thing that we might do is add bitmap functions (so
> > > > every bit in the bitmap has a name, but also might not appear) to
> > > > groups.
> > >
> > > Bitmaps in the attribute groups?
> >
> > Actually, no ... that would spoil our one group for all devices rule.
> > So they would be a set of helper functions for manipulating bitmaps, but
> > the bitmap would have to be in separate storage elsewhere.
>
> 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);
> actually_create_attrs();
> }
That's actually what we currently do (at least in hand coded form) in
the current transport classes. However, it leads to one separate group
for each attached class. With the filter approach, we only need one
constructed group for every transport class.
> >
> > > > struct attribute_group {
> > > > const char *name;
> > > > + int (*filter_show)(struct kobject *, int);
> > >
> > > Are you sure that you want to return an array index here, instead of the
> > > actual attribute? Like:
> >
> > Actually, it returns a true/false value indicating whether the given
> > attribute should be displayed.
> >
> > > int (*filter_show)(struct kobject *kobj, struct attribute *attr);
>
> I'd agree that using the attribute is better in this function.
>
> > >
> > > The names "show" and "store" are the ususal file-operation names, and we
> > > are not filtering a "show" here, right? Maybe "create", or "export", or
> > > something else might be a better name?
> >
> > how about (*attribute_is_visible)?
>
> Well, you don't only stop the visibility, but the creation of the
> attribute, so perhaps (*creation_filter)?
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.
James
next prev parent reply other threads:[~2007-10-29 17:24 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-29 15:16 [PATCH] sysfs: add filter function to groups James Bottomley
2007-10-29 16:54 ` Kay Sievers
2007-10-29 16:57 ` James Bottomley
2007-10-29 17:18 ` Cornelia Huck
2007-10-29 17:24 ` James Bottomley [this message]
2007-10-29 17:27 ` Jeff Garzik
2007-10-29 17:29 ` James Bottomley
2007-10-30 9:00 ` Cornelia Huck
2007-10-30 8:55 ` Cornelia Huck
2007-10-29 17:27 ` Kay Sievers
2007-10-29 17:28 ` James Bottomley
2007-10-29 17:43 ` Kay Sievers
2007-10-29 17:58 ` Stefan Richter
2007-10-29 18:12 ` James Bottomley
2007-10-30 18:25 ` James Bottomley
2007-10-30 19:31 ` Stefan Richter
2007-10-30 19:47 ` Kay Sievers
2007-10-31 0:40 ` Mark M. Hoffman
2007-10-31 2:01 ` Kay Sievers
2007-10-31 11:28 ` Mark M. Hoffman
2007-10-31 3:55 ` Greg KH
2007-10-31 9:41 ` Cornelia Huck
2007-10-31 9:52 ` Stefan Richter
2007-10-31 10:20 ` Cornelia Huck
2007-10-31 10:37 ` Stefan Richter
2007-10-31 12:19 ` Cornelia Huck
2007-10-31 14:38 ` James Bottomley
2007-10-31 17:29 ` Greg KH
2007-11-04 14:12 ` James Bottomley
2007-11-04 19:06 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1193678646.3383.76.camel@localhost.localdomain \
--to=james.bottomley@steeleye.com \
--cc=cornelia.huck@de.ibm.com \
--cc=greg@kroah.com \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox