|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 4/7] libxl/FreeBSD: add support for disk hotplug scripts
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.pau@xxxxxxxxxx>
> ---
> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
> ---
> 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@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |