summaryrefslogtreecommitdiffstats
path: root/drivers/xen/sys-hypervisor.c
diff options
context:
space:
mode:
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>2012-08-16 22:40:26 +0200
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2012-08-23 16:16:18 +0200
commit5c13f8067745efc15f6ad0158b58d57c44104c25 (patch)
treed873f981be9f5b68de0203a3b30d65a97999ab4d /drivers/xen/sys-hypervisor.c
parentxen/apic/xenbus/swiotlb/pcifront/grant/tmem: Make functions or variables static. (diff)
downloadlinux-5c13f8067745efc15f6ad0158b58d57c44104c25.tar.xz
linux-5c13f8067745efc15f6ad0158b58d57c44104c25.zip
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@tycho.nsa.gov> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/xen/sys-hypervisor.c')
-rw-r--r--drivers/xen/sys-hypervisor.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c
index fdb6d229c9bb..5e5ad7e28858 100644
--- a/drivers/xen/sys-hypervisor.c
+++ b/drivers/xen/sys-hypervisor.c
@@ -114,7 +114,7 @@ static void xen_sysfs_version_destroy(void)
/* UUID */
-static ssize_t uuid_show(struct hyp_sysfs_attr *attr, char *buffer)
+static ssize_t uuid_show_fallback(struct hyp_sysfs_attr *attr, char *buffer)
{
char *vm, *val;
int ret;
@@ -135,6 +135,17 @@ static ssize_t uuid_show(struct hyp_sysfs_attr *attr, char *buffer)
return ret;
}
+static ssize_t uuid_show(struct hyp_sysfs_attr *attr, char *buffer)
+{
+ xen_domain_handle_t uuid;
+ int ret;
+ ret = HYPERVISOR_xen_version(XENVER_guest_handle, uuid);
+ if (ret)
+ return uuid_show_fallback(attr, buffer);
+ ret = sprintf(buffer, "%pU\n", uuid);
+ return ret;
+}
+
HYPERVISOR_ATTR_RO(uuid);
static int __init xen_sysfs_uuid_init(void)