From: "Kay Sievers" <kay.sievers@vrfy.org>
To: "Mark M. Hoffman" <mhoffman@lightlink.com>
Cc: "James Bottomley" <James.Bottomley@steeleye.com>,
"Stefan Richter" <stefanr@s5r6.in-berlin.de>,
"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: Wed, 31 Oct 2007 03:01:56 +0100 [thread overview]
Message-ID: <3ae72650710301901r5cda1fb7i5e31fd9b7f8855de@mail.gmail.com> (raw)
In-Reply-To: <20071031004011.GA8309@jupiter.solarsys.private>
On Oct 31, 2007 1:40 AM, Mark M. Hoffman <mhoffman@lightlink.com> wrote:
> * James Bottomley <James.Bottomley@SteelEye.com> [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)(struct kobject *, int);
> > >
> > > > Actually, it returns a true/false value indicating whether the given
> > > > attribute should be displayed.
> > >
> > > How about this:
> > >
> > > int (*is_visible)(...);
> >
> > OK, so is this latest revision acceptable to everyone?
>
> I've just been hacking around in this area a bit, for a completely different
> reason: there are literally 1000's of attributes in drivers/hwmon/*.c that
> really want to be const, but which cannot be due to the current API. I was
> about to propose some patches that move in a different direction...
That isn't related to "dynamic attributes", right?
> IMHO the fundamental problem is struct attribute_group itself. This structure
> is nothing but a convenience for packaging the arguments to sysfs_create_group
> and sysfs_remove_group.
That "problem" is actually a good thing. If you look at the change
rate of the internal kernel API, it saves us so much trouble. Like in
this case, James can just add a callback without caring about any
(almost :)) of the current users.
> Those functions should take the contents of that
> struct as direct arguments.
I think we should move in the opposite direction. You are right, it
isn't neccessarily pretty, but having encapsulations like this saves
us a lot of trouble while interacting with so many other people and
extending API's all the time. It's a trade, and it's a good one, if
you need to maintain code that has so many callers, and so many
architectures, you can't even check that you don't break them.
> I haven't finished the patch series to implement
> this, but since I noticed your patch I thought I'd better speak up now. Here's
> the first... the idea is to eventually deprecate sysfs_[create|remove]_group()
> altogether.
Again, I don't think, that we want to get rid of the struct container
housing all the parameters and beeing open for future extensions
without changing all the callers.
> The current declaration of struct attribute_group prevents long lists of
> attributes from being marked const. Ideally, the second argument to the
> sysfs_create_group() and sysfs_remove_group() functions would be marked "deep"
> const, but C has no such construct. This patch provides a parallel set of
> functions with the desired decoration.
What do we get out of this constification compared to the current code?
Thanks,
Kay
next prev parent reply other threads:[~2007-10-31 2:02 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-29 15:16 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
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 [this message]
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=3ae72650710301901r5cda1fb7i5e31fd9b7f8855de@mail.gmail.com \
--to=kay.sievers@vrfy.org \
--cc=James.Bottomley@steeleye.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mhoffman@lightlink.com \
--cc=stefanr@s5r6.in-berlin.de \
/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
all inboxes | Powered by JetHome®