public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: "Mike D. Day" <ncmike@us.ibm.com>
Cc: lkml <linux-kernel@vger.kernel.org>, xen-devel@lists.xensource.com
Subject: Re: [RFC] [PATCH] sysfs support for Xen attributes
Date: Wed, 11 Jan 2006 15:07:04 -0800	[thread overview]
Message-ID: <20060111230704.GA32558@kroah.com> (raw)
In-Reply-To: <43C53DA0.60704@us.ibm.com>

On Wed, Jan 11, 2006 at 12:17:20PM -0500, Mike D. Day wrote:
> The included patch provides some sysfs helper routines so that xen 
> domain kernel processes can easily attributes to sysfs. The intent is 
> that any kernel process can add an attribute under /sys/xen just as 
> easily as adding a file under /proc. In other words, without using the 
> driver core to create a subsystem, dealing with kobjects and ksets, etc.

Why is xen special from the rest of the kernel in regards to adding
files to sysfs?  What does your infrastructure add that is not currently
already present for everyone to use today?

> One example adds xen version info under /sys/xen/version

Why is the xen version any different from any other module or driver
version in the kernel? (hint, use the interface that is availble for
this already...)

> The comments desired are (1) do the helper routines in xen_sysfs 
> duplicate code already present in linux (or under development somewhere 
> else).

You have access to the current tree as well as we do to be able to
answer this question :)

> (2) Is it appropriate for a process to create sysfs attributes without
> implementing a driver subsystem

You don't have to create a driver subsystem to be able to add stuff to
sysfs, what makes you think that?

> or (3) are such attributes better off living under /proc.

No, they belong in the sysfs tree like everything else.  Unless you have
process specific attributes, do NOT add anything new to /proc.

> (4) any other feedback is appreciated.

did you look at debugfs?  configfs?

What is wrong with the current kobject/sysfs/driver model interface that
made you want to create this extra code?

Aren't you already going to have a xen virtual bus in sysfs and the
driver model?  Why not just put your needed attributes there, where they
belong (on the devices themselves)?


> linux-2.6-xen-sparse/arch/xen/kernel/xen_sysfs.c
> --- /dev/null   Tue Jan 10 17:53:44 2006
> +++ b/linux-2.6-xen-sparse/arch/xen/kernel/xen_sysfs.c  Tue Jan 10 
> 23:30:37 2006

Your patch is linewrapped :(

> +#ifdef DEBUG
> +#define DPRINTK(fmt, args...)   printk(KERN_DEBUG "xen_sysfs: ",  fmt, 
> ## args)
> +#else
> +#define DPRINTK(fmt, args...)
> +#endif

Don't create your own, use dev_dbg() and friends instead.  pr_debug if
you absolutely don't have access to a struct device.

> +#ifndef BOOL
> +#define BOOL    int
> +#endif

Heh, what OS is this code for?

> +#ifndef FALSE
> +#define FALSE   0
> +#endif
> +
> +#ifndef TRUE
> +#define TRUE    1
> +#endif

No, don't add this, it's pointless.

> +#ifndef NULL
> +#define NULL    0
> +#endif

No, that will just break sparse.  Why did you add this?

> +#define __sysfs_ref__

Why?

> +struct xen_sysfs_object;
> +
> +struct xen_sysfs_attr {
> +       struct bin_attribute attr;
> +       ssize_t (*show)(void *, char *) ;
> +       ssize_t (*store)(void *, const char *, size_t) ;
> +       ssize_t (*read)(void *, char *, loff_t, size_t );
> +       ssize_t (*write)(void *, char *, loff_t, size_t) ;
> +};

Why a binary attribute?  Do you want to have more than one single piece
of info in here?  If so, no.

I'll stop here and say that you should use the internal-to-IBM code
review process, it would probably save you a lot of time in the
future...

thanks,

greg k-h

  parent reply	other threads:[~2006-01-11 23:07 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-11 17:17 [RFC] [PATCH] sysfs support for Xen attributes Mike D. Day
2006-01-11 17:19 ` Arjan van de Ven
2006-01-11 17:56 ` Stephen Hemminger
2006-01-11 18:45 ` Dave Hansen
2006-01-11 23:07 ` Greg KH [this message]
2006-01-12  0:23   ` Mike D. Day
2006-01-12  0:57     ` Greg KH
2006-01-12  1:49       ` Mike D. Day
2006-01-12  2:17         ` [Xen-devel] " Mark Williamson
2006-01-12  7:10         ` Greg KH
2006-01-12 14:44           ` [Xen-devel] " Mike D. Day
2006-01-12 14:53             ` Mark Williamson
2006-01-12 15:42               ` Anthony Liguori
2006-01-12 15:57             ` Anthony Liguori
2006-01-12 17:34               ` Greg KH
2006-01-12 18:44                 ` Anthony Liguori
2006-01-12 17:43             ` Greg KH
2006-01-12  9:10         ` Dave Hansen
2006-01-12 14:52           ` [Xen-devel] " Mike D. Day
2006-01-12 15:28             ` Dave Hansen
2006-01-12 15:50               ` Mike D. Day
2006-01-12 12:54         ` Gerd Hoffmann
2006-01-12 13:21           ` Arjan van de Ven
2006-01-12 14:42             ` Gerd Hoffmann
2006-01-12 17:39               ` Greg KH
2006-01-12 18:53                 ` Anthony Liguori
2006-01-12 18:55                   ` Arjan van de Ven
2006-01-12 18:59                     ` Anthony Liguori
2006-01-12 19:11                       ` Mike D. Day
2006-01-12 19:31                         ` Greg KH
2006-01-12 19:08                   ` Greg KH
2006-01-12 19:18                     ` Mike D. Day
2006-01-12 19:30                       ` Greg KH
2006-01-12 17:38           ` Greg KH
2006-01-12  1:32     ` Dave Hansen
2006-01-12 10:04       ` [Xen-devel] " Keir Fraser
2006-01-12 15:14         ` Dave Hansen
2006-01-12 15:06           ` Mark Williamson
2006-01-12 15:26           ` Keir Fraser
2006-01-12 15:37             ` Dave Hansen
2006-01-12 15:49               ` Anthony Liguori
2006-01-11 23:31 ` Pavel Machek
2006-01-12 19:01   ` 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=20060111230704.GA32558@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncmike@us.ibm.com \
    --cc=xen-devel@lists.xensource.com \
    /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