public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: "Mike D. Day" <ncmike@us.ibm.com>
Cc: xen-devel@lists.xensource.com, Greg KH <greg@kroah.com>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [Xen-devel] [PATCH 2.6.12.6-xen] sysfs attributes for xen
Date: Fri, 27 Jan 2006 21:03:17 -0600	[thread overview]
Message-ID: <43DADEF5.7030502@us.ibm.com> (raw)
In-Reply-To: <43DAD4DB.4090708@us.ibm.com>

Comments inlined.

Mike D. Day wrote:

> Creates /sys/hypervisor/xen and populates that dir with xen version, 
> changeset, compilation, and capabilities info. Intended for the xen 
> merge tree and later upstream.

<snip>

> +    if( 0 ==  (err = subsystem_register(&hypervisor_subsys)) ) {

This formatting is off.  You want a space after the if and no space 
after the (.  See CodingStyle.  It could be your mailer (it munged the 
newlines) but it appears you've got 4 space tabs?  Linux style is 8.

> +        if( ! HYPERVISOR_xen_version(XENVER_extraversion, 
> +                        extra_version) ) {
> +            page[PAGE_SIZE - 1] = 0x00;
> +            return snprintf(page, PAGE_SIZE - 1, +                    
> "xen-%ld.%ld%s\n",
> +                    major, minor, extra_version);

snprintf takes into account the terminating byte so you don't have to.

<snip>

> +/* xen compile info */
> +static ssize_t xen_compile_show(struct kobject * kobj, 
> +                struct attribute * attr, +                char * page)
> +{
> +    struct xen_compile_info info;
> +   
> +    if( 0 == HYPERVISOR_xen_version(XENVER_compile_info, &info) ) {
> +        page[PAGE_SIZE - 1] = 0x00;
> +        return snprintf(page, PAGE_SIZE - 1, +                
> "compiled by %s, using %s, on %s\n", +                info.compile_by, 
> +                info.compile_date, +                info.compiler);
> +    }
> +    return 0;
> +}

I'm not the best person to speak to this but I'm pretty sure sysfs 
prefers single values per file so you probably want to split this up 
into compile_by, compile_date, compiler.

> +int __init
> +sysfs_xen_version_init(void)
> +{
> +    __label__  out;
> +   
> +    struct kset * parent = get_xen_kset();
> +    if ( parent != NULL ) {
> +        kobject_init(&xen_ver_obj);
> +        xen_ver_obj.parent = &parent->kobj;       
> +        xen_ver_obj.dentry = parent->kobj.dentry;
> +        kobject_get(&parent->kobj);
> +        if ( sysfs_create_file(&xen_ver_obj, &xen_ver_attr.attr) )
> +            goto out;

I reckon you want to use default attributes here instead of immediately 
calling sysfs_create_file().

Regards,

Anthony Liguori

  parent reply	other threads:[~2006-01-28  3:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-28  2:20 [PATCH 2.6.12.6-xen] sysfs attributes for xen Mike D. Day
2006-01-28  2:25 ` Greg KH
2006-01-28  2:38 ` Greg KH
2006-01-28 12:23   ` Vincent Hanquez
2006-01-28  3:03 ` Anthony Liguori [this message]
2006-01-30 16:18 ` Dave Hansen
2006-01-30 16:58   ` [Xen-devel] " Mike D. Day
2006-01-30 17:04     ` Dave Hansen
2006-01-30 17:17       ` Mike D. Day
2006-01-30 17:26         ` Greg KH
2006-01-30 17:38         ` Dave Hansen
2006-01-30 17:53           ` Keir Fraser
2006-01-30 17:56             ` Dave Hansen
2006-01-30 19:33             ` 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=43DADEF5.7030502@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=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