xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Yang Hongyang <yanghy@cn.fujitsu.com>
To: xen-devel@lists.xen.org
Cc: ian.campbell@citrix.com, wency@cn.fujitsu.com,
	ian.jackson@eu.citrix.com, yunhong.jiang@intel.com,
	eddie.dong@intel.com, rshriram@cs.ubc.ca, laijs@cn.fujitsu.com
Subject: [PATCH for-4.5 v21 03/14] libxl: introduce libxl__multidev_prepare_with_aodev
Date: Fri, 26 Sep 2014 14:13:08 +0800	[thread overview]
Message-ID: <1411711999-3183-4-git-send-email-yanghy@cn.fujitsu.com> (raw)
In-Reply-To: <1411711999-3183-1-git-send-email-yanghy@cn.fujitsu.com>

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@cn.fujitsu.com>
Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 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

  parent reply	other threads:[~2014-09-26  6:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-26  6:13 [PATCH for-4.5 v21 00/14] Remus/Libxl: Remus network buffering and drbd disk Yang Hongyang
2014-09-26  6:13 ` [PATCH for-4.5 v21 01/14] libxl: multidev: Clarify comments about which callbacks are meant Yang Hongyang
2014-09-26 13:56   ` Wei Liu
2014-09-26  6:13 ` [PATCH for-4.5 v21 02/14] libxl: multidev: Expose libxl__multidev_one_callback Yang Hongyang
2014-09-26 13:58   ` Wei Liu
2014-09-26  6:13 ` Yang Hongyang [this message]
2014-09-26  6:13 ` [PATCH for-4.5 v21 04/14] libxl: Extend libxl__ao_device with a libxl__ev_child member Yang Hongyang
2014-09-26  6:13 ` [PATCH for-4.5 v21 05/14] autoconf: add libnl3 dependency for Remus network buffering support Yang Hongyang
2014-10-06 14:48   ` Ian Campbell
2014-09-26  6:13 ` [PATCH for-4.5 v21 06/14] libxl/remus: introduce an abstract Remus device layer Yang Hongyang
2014-09-26 12:59   ` Ian Jackson
2014-09-26  6:13 ` [PATCH for-4.5 v21 07/14] libxl/remus: setup and control network output buffering Yang Hongyang
2014-09-26  6:13 ` [PATCH for-4.5 v21 08/14] libxl/remus: setup and control disk replication for DRBD backends Yang Hongyang
2014-09-26  6:13 ` [PATCH for-4.5 v21 09/14] xl/remus: change bool to defbool Yang Hongyang
2014-09-26 12:57   ` Ian Jackson
2014-09-26  6:13 ` [PATCH for-4.5 v21 10/14] xl/remus: cmdline switch to explicitly enable unsafe configurations Yang Hongyang
2014-09-26 12:57   ` Ian Jackson
2014-09-26  6:13 ` [PATCH for-4.5 v21 11/14] xl/remus: cmdline switches and config vars to control network buffering Yang Hongyang
2014-09-26  6:13 ` [PATCH for-4.5 v21 12/14] xl/remus: add a cmdline switch to disable disk replication Yang Hongyang
2014-09-26  6:13 ` [PATCH for-4.5 v21 13/14] libxl/remus: add LIBXL_HAVE_REMUS to indicate Remus support in libxl Yang Hongyang
2014-09-26  6:13 ` [PATCH for-4.5 v21 14/14] MAINTAINERS: update maintained files of Remus Yang Hongyang
2014-09-26 13:10 ` [PATCH for-4.5 v21 00/14] Remus/Libxl: Remus network buffering and drbd disk Ian Jackson
2014-09-26 14:14   ` Ian Jackson
2014-09-26 14:20     ` Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1411711999-3183-4-git-send-email-yanghy@cn.fujitsu.com \
    --to=yanghy@cn.fujitsu.com \
    --cc=eddie.dong@intel.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=rshriram@cs.ubc.ca \
    --cc=wency@cn.fujitsu.com \
    --cc=xen-devel@lists.xen.org \
    --cc=yunhong.jiang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).