[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] tools: Make init-xenstore-domain use xc_domain_getinfolist()
commit 5a8efb1bd092a0f579cc3306226868346b73f362 Author: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx> AuthorDate: Fri Apr 28 11:41:21 2023 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Fri Apr 28 14:34:40 2023 +0100 tools: Make init-xenstore-domain use xc_domain_getinfolist() It currently relies on xc_domain_getinfo() returning the next available domain past "first_domid", which is a feature that will disappear in a future patch. Furthermore and while at it, make it so the hypercall tries to fetch information about more than one domain per hypercall so we can (hopefully) get away with a single hypercall in a typical system. Signed-off-by: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx> Reviewed-by: Juergen Gross <jgross@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- tools/helpers/init-xenstore-domain.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xenstore-domain.c index 0950ba7dc5..b2d5df8ba5 100644 --- a/tools/helpers/init-xenstore-domain.c +++ b/tools/helpers/init-xenstore-domain.c @@ -13,6 +13,7 @@ #include <xentoollog.h> #include <libxl.h> #include <xen/sys/xenbus_dev.h> +#include <xen-tools/common-macros.h> #include <xen-xsm/flask/flask.h> #include <xen/io/xenbus.h> @@ -322,16 +323,20 @@ err: static int check_domain(xc_interface *xch) { - xc_dominfo_t info; + /* Commonly dom0 is the only domain, but buffer a little for efficiency. */ + xc_domaininfo_t info[8]; uint32_t dom; int ret; dom = 1; - while ( (ret = xc_domain_getinfo(xch, dom, 1, &info)) == 1 ) + while ( (ret = xc_domain_getinfolist(xch, dom, ARRAY_SIZE(info), info)) > 0 ) { - if ( info.xenstore ) - return 1; - dom = info.domid + 1; + for ( size_t i = 0; i < ret; i++ ) + { + if ( info[i].flags & XEN_DOMINF_xs_domain ) + return 1; + } + dom = info[ret - 1].domain + 1; } if ( ret < 0 && errno != ESRCH ) { -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |