From: Ian Campbell Subject: Re: [PATCH v1 03/10] libxl: store a copy of vanilla domain configuration when creating domain Date: Wed, 16 Jul 2014 17:18:08 +0100 Message-ID: <1405527488.1087.60.camel@kazak.uk.xensource.com> References: <1405002745-5034-1-git-send-email-wei.liu2@citrix.com> <1405002745-5034-4-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1405002745-5034-4-git-send-email-wei.liu2@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: Wei Liu Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Thu, 2014-07-10 at 15:32 +0100, Wei Liu wrote: > +/* update the saved domain configuration with a callback function, > + * which is responsible to pull in useful fields from src. > + */ > +typedef void (update_callback)(libxl__gc *, libxl_domain_config *, > + const libxl_domain_config *); > +static int libxl__update_domain_configuration(libxl__gc *gc, > + uint32_t domid, > + update_callback callback, > + const libxl_domain_config *src) You aren't using your shiny new locking functions here? > +{ > + libxl_domain_config d_config_saved; > + int rc; > + > + libxl_domain_config_init(&d_config_saved); > + > + rc = libxl__get_domain_configuration(gc, domid, &d_config_saved); > + > + if (rc) { > + LOG(ERROR, "cannot get domain configuration: %d", rc); > + goto out; > + } > + > + callback(gc, &d_config_saved, src); > + > + rc = libxl__set_domain_configuration(gc, domid, &d_config_saved); > + > + if (rc) > + LOG(ERROR, "cannot set domain configuration: %d", rc); > + > + libxl_domain_config_dispose(&d_config_saved); > + > +out: > + return rc; > +} > + > static void domcreate_complete(libxl__egc *egc, > libxl__domain_create_state *dcs, > int rc)