[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] xen/sysfs: Use XENVER_guest_handle to query UUID


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
  • Date: Mon, 03 Sep 2012 13:33:02 +0000
  • Delivery-date: Mon, 03 Sep 2012 13:33:10 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
# Date 1346678256 -7200
# Node ID af558aa67990007d3570f68931be209f8c815a7f
# Parent  2d3239c1550132c77c2c306f294b2cd01d57ec81
xen/sysfs: Use XENVER_guest_handle to query UUID

This hypercall has been present since Xen 3.1, and is the preferred
method for a domain to obtain its UUID. Fall back to the xenstore method
if using an older version of Xen (which returns -ENOSYS).

Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Committed-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r 2d3239c15501 -r af558aa67990 drivers/xen/core/xen_sysfs.c
--- a/drivers/xen/core/xen_sysfs.c      Tue Aug 07 08:08:12 2012 +0200
+++ b/drivers/xen/core/xen_sysfs.c      Mon Sep 03 15:17:36 2012 +0200
@@ -104,9 +104,21 @@ static void xen_sysfs_version_destroy(vo
 
 static ssize_t uuid_show(struct hyp_sysfs_attr *attr, char *buffer)
 {
+       xen_domain_handle_t uuid;
        char *vm, *val;
-       int ret;
+       int ret = HYPERVISOR_xen_version(XENVER_guest_handle, uuid);
 
+       if (!ret)
+               return sprintf(buffer,
+                              
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
+                              uuid[0], uuid[1], uuid[2], uuid[3],
+                              uuid[4], uuid[5],
+                              uuid[6], uuid[7],
+                              uuid[8], uuid[9],
+                              uuid[10], uuid[11], uuid[12],
+                              uuid[13], uuid[14], uuid[15]);
+
+#if CONFIG_XEN_COMPAT < 0x030100
        if (!is_xenstored_ready())
                return -EBUSY;
 
@@ -119,6 +131,11 @@ static ssize_t uuid_show(struct hyp_sysf
                return PTR_ERR(val);
        ret = sprintf(buffer, "%s\n", val);
        kfree(val);
+#else /* prevent unused variable warnings */
+       asm("" : "=r" (vm), "=r" (val));
+       asm("" : : "r" (vm), "r" (val));
+#endif
+
        return ret;
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.