From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH v2] xen/sysfs: Use XENVER_guest_handle to query UUID Date: Wed, 22 Aug 2012 12:57:53 -0400 Message-ID: <20120822165753.GA3328@phenom.dumpdata.com> References: <20120816202246.GA6244@US-SEA-R8XVZTX> <1345149626-32602-1-git-send-email-dgdegra@tycho.nsa.gov> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1345149626-32602-1-git-send-email-dgdegra@tycho.nsa.gov> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Daniel De Graaf Cc: jbeulich@suse.com, ian.campbell@citrix.com, msw@amazon.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Thu, Aug 16, 2012 at 04:40:26PM -0400, Daniel De Graaf wrote: > On 08/16/2012 04:22 PM, Matt Wilson wrote: > > > > Hi Daniel, > > > > What do you think about retaining a fallback of looking in xenstore if > > the hypercall fails? > > > > Matt > > > > That sounds good; there's little cost to leaving the fallback in. applied > > ----8<----------------------------------------------------- > > 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 > --- > drivers/xen/sys-hypervisor.c | 13 ++++++++++++- > include/xen/interface/version.h | 3 +++ > 2 files changed, 15 insertions(+), 1 deletion(-) > > diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c > index 4c7db7d..284df8a 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) > diff --git a/include/xen/interface/version.h b/include/xen/interface/version.h > index e8b6519..dd58cf5 100644 > --- a/include/xen/interface/version.h > +++ b/include/xen/interface/version.h > @@ -60,4 +60,7 @@ struct xen_feature_info { > /* arg == NULL; returns host memory page size. */ > #define XENVER_pagesize 7 > > +/* arg == xen_domain_handle_t. */ > +#define XENVER_guest_handle 8 > + > #endif /* __XEN_PUBLIC_VERSION_H__ */ > -- > 1.7.11.2