[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 2/5] libxl: add libxl__xs_path_cleanup
On Tue, 2012-04-17 at 16:51 +0100, Roger Pau Monne wrote: > Add a function which behaves like "xenstore-rm -t", and which will be used to > clean xenstore after unplug since we will be no longer executing > xen-hotplug-cleanup script, that used to do that for us. Can you put this in libxl_xshelp.c and a prototype in libxl_internal.h, please. Also it should include a comment in the header describing the function and what it does. > > Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxx> > --- > tools/libxl/libxl_device.c | 21 +++++++++++++++++++++ > 1 files changed, 21 insertions(+), 0 deletions(-) > > diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c > index c7e057d..fe4bcc6 100644 > --- a/tools/libxl/libxl_device.c > +++ b/tools/libxl/libxl_device.c > @@ -356,6 +356,27 @@ int libxl__device_disk_dev_number(const char *virtpath, > int *pdisk, > return -1; > } > > +static int libxl__xs_path_cleanup(libxl__gc *gc, char *path) > +{ > + libxl_ctx *ctx = libxl__gc_owner(gc); > + unsigned int nb = 0; > + char *last; > + > + if (!path) > + return 0; > + > + xs_rm(ctx->xsh, XBT_NULL, path); > + > + for (last = strrchr(path, '/'); last != NULL; last = strrchr(path, '/')) > { > + *last = '\0'; > + if (!libxl__xs_directory(gc, XBT_NULL, path, &nb)) > + continue; > + if (nb == 0) { > + xs_rm(ctx->xsh, XBT_NULL, path); > + } > + } > + return 0; > +} > > typedef struct { > libxl__ao *ao; _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |