On Fri, 2016-01-08 at 14:08 +0100, Juergen Gross wrote: > +# get xenstore domain id (or 0 if no xenstore domain) > +get_xsdomid() > +{ > + XS_DOMID=`${bindir}/xenstore-read /tool/xenstored/domid 2>/dev/null` > + if test $? -ne 0; then > + XS_DOMID=0 > + fi
In principal this could be: + XS_DOMID=`${bindir}/xenstore-read /tool/xenstored/domid 2>/dev/null || echo 0` But I'm far from convinced that is an improvement. > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c > index f9933cb..29f9d19 100644 > --- a/tools/libxl/xl_cmdimpl.c > +++ b/tools/libxl/xl_cmdimpl.c > @@ -4856,15 +4856,17 @@ static int main_shutdown_or_reboot(int do_reboot, > int argc, char **argv) > if (wait_for_it) > deathws = calloc(nb_domain, sizeof(*deathws)); > > + wait_for_it = 0; Please can we avoid reusing the boolean flag used for argument handling as a counter. I think you will need to introduce a new nrdeathws. I was thinking if you could invert the loop to count downwards such that you can decrement nb_domain for uninteresting domains, but then the uses of deathws[i] don't work, the solving of which would no doubt require another variable anyway. > for (i = 0; i<nb_domain; i++) { > - if (dominfo[i].domid == 0) > + if (dominfo[i].domid == 0 || dominfo[i].never_stop) > continue; > fn(dominfo[i].domid, deathws ? &deathws[i] : NULL, i, > fallback_trigger); > + wait_for_it++; > } > > - if (wait_for_it) { > - wait_for_domain_deaths(deathws, nb_domain - 1 /* not dom 0 > */); > + if (deathws) { > + wait_for_domain_deaths(deathws, wait_for_it); > free(deathws); > } > _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel