On Thu, Feb 25, 2016 at 08:25:15PM +0100, Roger Pau Monne wrote: > Allow FreeBSD to execute hotplug scripts when attaching disk devices. > > Signed-off-by: Roger Pau Monné <roger....@citrix.com> > --- > Cc: Ian Jackson <ian.jack...@eu.citrix.com> > Cc: Ian Campbell <ian.campb...@citrix.com> > Cc: Wei Liu <wei.l...@citrix.com> > --- > tools/libxl/libxl_freebsd.c | 114 > ++++++++++++++++++++++++++++++++------------ > 1 file changed, 83 insertions(+), 31 deletions(-) >
It's better to either break the refactoring to another patch or explicitly say there is refactoring in this patch. > +static int libxl__hotplug_disk(libxl__gc *gc, libxl__device *dev, > + char ***args, char ***env, > + libxl__device_action action) > +{ > + char *be_path = libxl__device_backend_path(gc, dev); > + char *script; > + int nr = 0, rc; > + > + script = libxl__xs_read(gc, XBT_NULL, > + GCSPRINTF("%s/%s", be_path, "script")); > + if (!script) { > + LOGEV(ERROR, errno, "unable to read script from %s", be_path); > + rc = ERROR_FAIL; > + goto error; > + } > + > + const int arraysize = 4; > + GCNEW_ARRAY(*args, arraysize); > + (*args)[nr++] = script; > + (*args)[nr++] = be_path; > + (*args)[nr++] = (char *) libxl__device_action_to_string(action); > + (*args)[nr++] = NULL; > + assert(nr == arraysize); > + > + rc = 1; > + > +error: > + return rc; > +} > + The code looks fine. Wei. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel