[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH for-4.5 v21 03/14] libxl: introduce libxl__multidev_prepare_with_aodev
libxl__multidev_prepare_with_aodev is similar to libxl__multidev_prepare, but takes a libxl__ao_device as an extra argument. libxl__multidev_prepare is now a wrapper around libxl__multidev_prepare_with_aodev. This new internal API will be used by the Remus device abstract layer for handling various Remus devices. Signed-off-by: Yang Hongyang <yanghy@xxxxxxxxxxxxxx> Signed-off-by: Shriram Rajagopalan <rshriram@xxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> --- tools/libxl/libxl_device.c | 13 ++++++++++--- tools/libxl/libxl_internal.h | 15 ++++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index 1f6514c..4c49c4c 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -479,11 +479,10 @@ void libxl__multidev_begin(libxl__ao *ao, libxl__multidev *multidev) multidev->preparation = libxl__multidev_prepare(multidev); } -libxl__ao_device *libxl__multidev_prepare(libxl__multidev *multidev) { +void libxl__multidev_prepare_with_aodev(libxl__multidev *multidev, + libxl__ao_device *aodev) { STATE_AO_GC(multidev->ao); - libxl__ao_device *aodev; - GCNEW(aodev); aodev->multidev = multidev; aodev->callback = libxl__multidev_one_callback; libxl__prepare_ao_device(ao, aodev); @@ -493,6 +492,14 @@ libxl__ao_device *libxl__multidev_prepare(libxl__multidev *multidev) { GCREALLOC_ARRAY(multidev->array, multidev->allocd); } multidev->array[multidev->used++] = aodev; +} + +libxl__ao_device *libxl__multidev_prepare(libxl__multidev *multidev) { + STATE_AO_GC(multidev->ao); + libxl__ao_device *aodev; + + GCNEW(aodev); + libxl__multidev_prepare_with_aodev(multidev, aodev); return aodev; } diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index b19374e..a2dd7ca 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -2172,9 +2172,18 @@ struct libxl__ao_device { /* Starts preparing to add/remove a bunch of devices. */ _hidden void libxl__multidev_begin(libxl__ao *ao, libxl__multidev*); -/* Prepares to add/remove one of many devices. Returns a libxl__ao_device - * which has had libxl__prepare_ao_device called, and which has also - * had ->callback set. The user should not mess with aodev->callback. */ +/* Prepares to add/remove one of many devices. + * Calls libxl__prepare_ao_device on libxl__ao_device argument provided and + * also sets the aodev->callback (to libxl__multidev_one_callback) + * The user should not mess with aodev->callback. + */ +_hidden void libxl__multidev_prepare_with_aodev(libxl__multidev*, + libxl__ao_device*); + +/* A wrapper function around libxl__multidev_prepare_with_aodev. + * Allocates a libxl__ao_device and prepares it for addition/removal. + * Returns the newly allocated libxl__ao_dev. + */ _hidden libxl__ao_device *libxl__multidev_prepare(libxl__multidev*); /* Indicates to multidev that this one device has been processed. -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |