From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v2 03/13] libxl: provide a function to retrieve the xenstore domain id Date: Fri, 18 Dec 2015 13:53:06 +0000 Message-ID: <56740FC2.4030504@citrix.com> References: <1450444471-6454-1-git-send-email-jgross@suse.com> <1450444471-6454-4-git-send-email-jgross@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1450444471-6454-4-git-send-email-jgross@suse.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Juergen Gross , xen-devel@lists.xen.org, Ian.Campbell@citrix.com, ian.jackson@eu.citrix.com, stefano.stabellini@eu.citrix.com, wei.liu2@citrix.com, dgdegra@tycho.nsa.gov List-Id: xen-devel@lists.xenproject.org On 18/12/15 13:14, Juergen Gross wrote: > Add libxl_xenstore_domid() to obtain the domain id of the xenstore > domain. > > Signed-off-by: Juergen Gross What are the expected semantics here? Would you expect it to return domid 0 for a traditional setup, or are you wanting to use it as a "does a xenstored domain exist" test? > --- > tools/libxl/libxl.c | 24 ++++++++++++++++++++++++ > tools/libxl/libxl.h | 11 +++++++++++ > 2 files changed, 35 insertions(+) > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > index 9207621..3bcff59 100644 > --- a/tools/libxl/libxl.c > +++ b/tools/libxl/libxl.c > @@ -701,6 +701,30 @@ int libxl_domain_info(libxl_ctx *ctx, libxl_dominfo *info_r, > return 0; > } > > +int libxl_xenstore_domid(libxl_ctx *ctx, uint32_t *domid) > +{ > + xc_dominfo_t info; > + uint32_t last_domid; > + int ret; > + GC_INIT(ctx); > + > + for (last_domid = 0; > + (ret = xc_domain_getinfo(ctx->xch, last_domid, 1, &info)) == 1; > + last_domid = info.domid + 1) Just as a note, this will scale badly with large numbers of domains. A lot of other actions in libxl will as well, so I don't think it warrants changing at this point. At some point, I need to progress my plans to have stats information like this exposed via shared memory rather than hypercall. ~Andrew