linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Jan Engelhardt <jengelh@computergmbh.de>
Cc: linux-kernel@vger.kernel.org, Kay Sievers <kay.sievers@vrfy.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Jonathan Corbet <corbet@lwn.net>,
	Randy Dunlap <randy.dunlap@oracle.com>
Subject: Re: [RFC] kobject/kset/ktype documentation and example code updated
Date: Thu, 20 Dec 2007 13:16:01 -0800	[thread overview]
Message-ID: <20071220211600.GA5808@kroah.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0712200958020.18943@fbirervta.pbzchgretzou.qr>

On Thu, Dec 20, 2007 at 10:04:26AM +0100, Jan Engelhardt wrote:
> 
> On Dec 19 2007 16:30, Greg KH wrote:
> >See the example module, samples/kobject/kobject-example.c for an
> >implementation of a simple kobject and attributes.
> 
> Should mention here that if simple types are enough and a callback
> function is not needed, a module_param() could be used instead.

Nah, why?  module paramaters are pretty well known already :)

> >As a kset contains a kobject within it, it should always be dynamically
> >created and never declared statically or on the stack.  To create a new
> >kset use:
> >  struct kset *kset_create_and_add(char *name,
> >				   struct kset_uevent_ops *u,
> >				   struct kobject *parent);
> Hmm... Not const char *?

good catch, that's what the .h file shows :)

> >If a kset wishes to control the uevent operations of the kobjects
> >associated with it, it can use the struct kset_uevent_ops to handle it:
> >
> >struct kset_uevent_ops {
> >        int (*filter)(struct kset *kset, struct kobject *kobj);
> >        const char *(*name)(struct kset *kset, struct kobject *kobj);
> >        int (*uevent)(struct kset *kset, struct kobject *kobj,
> >                      struct kobj_uevent_env *env);
> >};
> >
> >
> >The filter function allows a kset to prevent a uevent from being emitted to
> >userspace for a specific kobject.  If the function returns 0, the uevent
> >will not be emitted.
> >
> What about other return values? Should filter perhaps return bool instead?

Probably, it was created before there was a 'bool' in the kernel.

thanks,

greg k-h

      reply	other threads:[~2007-12-20 21:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-20  0:30 [RFC] kobject/kset/ktype documentation and example code updated Greg KH
2007-12-20  0:31 ` [RFC] sample kobject implementation code Greg KH
2007-12-20  0:31 ` [RFC] sample kset/ktype/kobject " Greg KH
2008-01-03 15:14   ` Cornelia Huck
2007-12-20  4:26 ` [RFC] kobject/kset/ktype documentation and example code updated Alan Stern
2007-12-20  7:27   ` Kay Sievers
2007-12-20 21:48   ` Greg KH
2007-12-20  6:32 ` Randy Dunlap
2007-12-20 21:27   ` Greg KH
2007-12-20 22:03     ` Robert P. J. Day
2007-12-20 22:20       ` Greg KH
2007-12-20 22:06     ` Randy Dunlap
2007-12-20 22:12       ` Greg KH
2007-12-20 22:29         ` Randy Dunlap
2007-12-20 22:42           ` Greg KH
2007-12-20 22:48             ` Randy Dunlap
2007-12-20 22:57     ` Alan Stern
2007-12-20  7:54 ` Dave Young
2007-12-20  8:02   ` Greg KH
2007-12-20  9:04 ` Jan Engelhardt
2007-12-20 21:16   ` Greg KH [this message]

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=20071220211600.GA5808@kroah.com \
    --to=greg@kroah.com \
    --cc=corbet@lwn.net \
    --cc=jengelh@computergmbh.de \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    --cc=stern@rowland.harvard.edu \
    /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;
as well as URLs for NNTP newsgroup(s).