All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH] /sys/hypervisor/uuid
Date: Fri, 19 May 2006 01:57:44 -0500	[thread overview]
Message-ID: <446D6C68.6020102@us.ibm.com> (raw)
In-Reply-To: <87y7wzmeqb.fsf@pike.pond.sub.org>

Markus Armbruster wrote:
> New /sys/hypervisor/uuid, containing this domain's UUID.
>
> Stripping off /vm/ from the value of vm to get the UUID isn't exactly
> nice.  The alternative is to add a XENVER_get_uuid code to
> HYPERVISOR_xen_version(), but I'm not sure that's worth it.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>   

I really don't think we should be mirroring things in sysfs that are 
available in userspace.  What benefit is there of having two interfaces 
to the same information?

If the argument is that we don't want to rely on libxenstore in a domU, 
then we should be exposing all of XenStore in sysfs.

The uuid parameter is a construction of Xend.  Xend is *not* a part of 
the supported guest interface.  By exposing the uuid in the kernel 
interface, you're tying an unsupported interface to what really should 
be a supported interface.

Plus, there's already a patch floating on LKML for a /sys/hypervisor.  
We shouldn't start adding attributes to this namespace as it could 
potentially conflict with the existing patch.

In the very least, we ought to stick this stuff in /sys/hypervisor/xen.

Regards,

Anthony Liguori

> diff -r ddba92a5cba9 drivers/xen/core/xen_sysfs.c
> --- a/drivers/xen/core/xen_sysfs.c	Tue May 09 12:41:38 2006 +0200
> +++ b/drivers/xen/core/xen_sysfs.c	Thu May 18 18:06:35 2006 +0200
> @@ -8,12 +8,14 @@
>   */
>  
>  #include <linux/config.h>
> +#include <linux/err.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/init.h>
>  #include <asm/hypervisor.h>
>  #include <xen/features.h>
>  #include <xen/hypervisor_sysfs.h>
> +#include <xen/xenbus.h>
>  
>  MODULE_LICENSE("GPL");
>  MODULE_AUTHOR("Mike D. Day <ncmike@us.ibm.com>");
> @@ -92,6 +94,37 @@ static void xen_sysfs_version_destroy(vo
>  static void xen_sysfs_version_destroy(void)
>  {
>  	sysfs_remove_group(&hypervisor_subsys.kset.kobj, &version_group);
> +}
> +
> +/* UUID */
> +
> +static ssize_t uuid_show(struct hyp_sysfs_attr *attr, char *buffer)
> +{
> +	char *val;
> +	int ret;
> +
> +	val = xenbus_read(XBT_NULL, "vm", "", NULL);
> +	if (IS_ERR(val))
> +		ret = PTR_ERR(val);
> +	else if (strncmp(val, "/vm/", 4))
> +		ret = -EIO;
> +	else
> +		ret = sprintf(buffer, "%s\n", val + 4);
> +	kfree(val);
> +
> +	return ret;
> +}
> +
> +HYPERVISOR_ATTR_RO(uuid);
> +
> +static int __init xen_sysfs_uuid_init(void)
> +{
> +	return sysfs_create_file(&hypervisor_subsys.kset.kobj, &uuid_attr.attr);
> +}
> +
> +static void xen_sysfs_uuid_destroy(void)
> +{
> +	sysfs_remove_file(&hypervisor_subsys.kset.kobj, &uuid_attr.attr);
>  }
>  
>  /* xen compilation attributes */
> @@ -285,10 +318,15 @@ static int __init hyper_sysfs_init(void)
>  	ret = xen_compilation_init();
>  	if (ret)
>  		goto comp_out;
> +	ret = xen_sysfs_uuid_init();
> +	if (ret)
> +		goto uuid_out;
>  	ret = xen_properties_init();
>  	if (!ret)
>  		goto out;
>  
> +	xen_sysfs_uuid_destroy();
> +uuid_out:
>  	xen_compilation_destroy();
>  comp_out:
>  	xen_sysfs_version_destroy();
> @@ -302,6 +340,7 @@ static void hyper_sysfs_exit(void)
>  {
>  	xen_properties_destroy();
>  	xen_compilation_destroy();
> +	xen_sysfs_uuid_destroy();
>  	xen_sysfs_version_destroy();
>  	xen_sysfs_type_destroy();
>  
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>   

  parent reply	other threads:[~2006-05-19  6:57 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-18 17:20 [PATCH] /sys/hypervisor/uuid Markus Armbruster
2006-05-18 20:30 ` Keir Fraser
2006-05-19  7:41   ` Chris Wright
2006-05-19  9:43     ` Christian Limpach
2006-05-19 16:11       ` John Levon
2006-05-19 16:43       ` Jeremy Katz
2006-05-19 17:01         ` Christian Limpach
2006-05-19 17:24           ` Jeremy Katz
2006-05-22  8:33             ` Christian Limpach
2006-05-19 17:21       ` Markus Armbruster
2006-05-20  8:42         ` Keir Fraser
2006-05-22  6:21           ` Markus Armbruster
2006-05-22  6:33             ` Keir Fraser
2006-05-22 12:44               ` Jeremy Katz
2006-05-22 13:24                 ` Keir Fraser
2006-05-22 15:09                   ` Jeremy Katz
2006-05-22 15:44                     ` Christian Limpach
2006-05-22 15:46                       ` Jeremy Katz
2006-05-22 15:57                     ` Anthony Liguori
2006-05-22 16:05                       ` Jeremy Katz
2006-05-23 18:08       ` Stephen C. Tweedie
2006-05-19  6:57 ` Anthony Liguori [this message]
2006-05-19 12:46   ` Jeremy Katz
2006-05-19 13:43     ` B Thomas
2006-05-19 13:45       ` Jeremy Katz
2006-05-19 14:06         ` B Thomas
2006-05-24 13:00 ` Markus Armbruster
2006-05-30  9:28   ` Markus Armbruster

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=446D6C68.6020102@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=armbru@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.