From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roger Pau Monne Subject: Re: [PATCH v2 07/15] libxl: convert libxl_domain_destroy to an async op Date: Tue, 22 May 2012 15:11:38 +0100 Message-ID: <4FBB9E9A.6030107@citrix.com> References: <1337695365-5142-1-git-send-email-roger.pau@citrix.com> <1337695365-5142-8-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1337695365-5142-8-git-send-email-roger.pau@citrix.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: "xen-devel@lists.xen.org" Cc: Ian Jackson List-Id: xen-devel@lists.xenproject.org Roger Pau Monne wrote: > This change introduces some new structures, and breaks the mutual > dependency that libxl_domain_destroy and libxl__destroy_device_model > had. This is done by checking if the domid passed to > libxl_domain_destroy has a stubdom, and then having the bulk of the > destroy machinery in a separate function (libxl__destroy_domid) that > doesn't check for stubdom presence, since we check for it in the upper > level function. The reason behind this change is the need to use > structures for ao operations, and it was impossible to have two > different self-referencing structs. > > All uses of libxl_domain_destroy have been changed, and either > replaced by the new libxl_domain_destroy ao function or by the > internal libxl__domain_destroy that can be used inside an already > running ao. > > Cc: Ian Jackson > Signed-off-by: Roger Pau Monne > --- > tools/libxl/libxl.c | 167 +++++++++++++++++++++++++++++++++--- > tools/libxl/libxl.h | 3 +- > tools/libxl/libxl_create.c | 29 ++++++- > tools/libxl/libxl_device.c | 192 ++++++++++++++++++++++++++++++++++-------- > tools/libxl/libxl_dm.c | 85 ++++++++++--------- > tools/libxl/libxl_internal.h | 90 +++++++++++++++++++- > tools/libxl/xl_cmdimpl.c | 12 ++-- > 7 files changed, 473 insertions(+), 105 deletions(-) [ ...] > @@ -413,30 +490,40 @@ int libxl__devices_destroy(libxl__gc *gc, uint32_t domid) > path = libxl__sprintf(gc, "/local/domain/%d/device/%s/%s/backend", > domid, kinds[i], devs[j]); > path = libxl__xs_read(gc, XBT_NULL, path); > - if (path&& libxl__parse_backend_path(gc, path,&dev) == 0) { > - dev.domid = domid; > - dev.kind = kind; > - dev.devid = atoi(devs[j]); > - > - libxl__device_destroy(gc,&dev); > + printf("device: %s\n", path); This should not be here. > + GCNEW(dev); > + if (path&& libxl__parse_backend_path(gc, path, dev) == 0) { > + dev->domid = domid; > + dev->kind = kind; > + dev->devid = atoi(devs[j]); > + drs->aorm[numdev].action = DEVICE_DISCONNECT; > + drs->aorm[numdev].dev = dev; > + drs->aorm[numdev].callback = device_remove_callback; > + drs->aorm[numdev].force = drs->force; > + libxl__initiate_device_remove(egc,&drs->aorm[numdev]); > + numdev++; > } > } > } > > /* console 0 frontend directory is not under /local/domain//device */ > path = libxl__sprintf(gc, "/local/domain/%d/console/backend", domid); > + printf("frontend: %s\n", path); > path = libxl__xs_read(gc, XBT_NULL, path); > + printf("backend: %s\n", path); Neither should this. I will resend without this printfs, but please ignore them for review. [...]