From: Ian Jackson Subject: Re: [PATCH 5/6] libxl_qmp: Introduce libxl__qmp_set_global_dirty_log. Date: Tue, 31 Jul 2012 15:37:07 +0100 Message-ID: <20503.60819.909345.127466@mariner.uk.xensource.com> References: <1343235857-15870-1-git-send-email-anthony.perard@citrix.com> <1343235857-15870-6-git-send-email-anthony.perard@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1343235857-15870-6-git-send-email-anthony.perard@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Anthony PERARD Cc: Ian Campbell , Xen Devel List-Id: xen-devel@lists.xenproject.org Anthony PERARD writes ("[PATCH 5/6] libxl_qmp: Introduce libxl__qmp_set_global_dirty_log."): > This function will enable or disable the global dirty log on QEMU, used during > a migration. Again we have the possible concurrent use of the qmp to contend with. Also: > +int libxl__qmp_set_global_dirty_log(libxl__gc *gc, int domid, bool enable) > +{ > + libxl__qmp_handler *qmp = NULL; > + libxl__json_object *args = NULL; > + int rc = 0; > + > + qmp = libxl__qmp_initialize(gc, domid); > + if (!qmp) > + return ERROR_FAIL; > + > + args = qmp_parameters_add_bool(gc, NULL, "enable", enable); > + if (!args) { > + rc = ERROR_NOMEM; > + goto out; > + } > + > + rc = qmp_synchronous_send(qmp, "xen-set-global-dirty-log", args, > + NULL, NULL, qmp->timeout); > + libxl__json_object_free(gc, args); > + > +out: > + libxl__qmp_close(qmp); > + return rc; > +} This pattern which is starting to appear multiple times could perhaps be encapsulated in a function ? Ian.