diff options
author | Daniel De Graaf <dgdegra@tycho.nsa.gov> | 2012-08-16 16:40:26 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-08-23 10:16:18 -0400 |
commit | 5c13f8067745efc15f6ad0158b58d57c44104c25 (patch) | |
tree | d873f981be9f5b68de0203a3b30d65a97999ab4d /drivers | |
parent | b8b0f559c7b1dcf5503817e518c81c9a18ee45e0 (diff) |
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')
-rw-r--r-- | drivers/xen/sys-hypervisor.c | 13 |
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) | |||
114 | 114 | ||
115 | /* UUID */ | 115 | /* UUID */ |
116 | 116 | ||
117 | static ssize_t uuid_show(struct hyp_sysfs_attr *attr, char *buffer) | 117 | static ssize_t uuid_show_fallback(struct hyp_sysfs_attr *attr, char *buffer) |
118 | { | 118 | { |
119 | char *vm, *val; | 119 | char *vm, *val; |
120 | int ret; | 120 | int ret; |
@@ -135,6 +135,17 @@ static ssize_t uuid_show(struct hyp_sysfs_attr *attr, char *buffer) | |||
135 | return ret; | 135 | return ret; |
136 | } | 136 | } |
137 | 137 | ||
138 | static ssize_t uuid_show(struct hyp_sysfs_attr *attr, char *buffer) | ||
139 | { | ||
140 | xen_domain_handle_t uuid; | ||
141 | int ret; | ||
142 | ret = HYPERVISOR_xen_version(XENVER_guest_handle, uuid); | ||
143 | if (ret) | ||
144 | return uuid_show_fallback(attr, buffer); | ||
145 | ret = sprintf(buffer, "%pU\n", uuid); | ||
146 | return ret; | ||
147 | } | ||
148 | |||
138 | HYPERVISOR_ATTR_RO(uuid); | 149 | HYPERVISOR_ATTR_RO(uuid); |
139 | 150 | ||
140 | static int __init xen_sysfs_uuid_init(void) | 151 | static int __init xen_sysfs_uuid_init(void) |