From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: Re: [PATCH V5 31/32] libxl: update domain configuration when updating memory targets Date: Sun, 1 Jun 2014 21:00:33 +0100 Message-ID: <20140601200033.GA28279@zion.uk.xensource.com> References: <1400018054-26038-1-git-send-email-wei.liu2@citrix.com> <1400018054-26038-32-git-send-email-wei.liu2@citrix.com> <1400596324.6946.92.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1400596324.6946.92.camel@kazak.uk.xensource.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: Ian Campbell Cc: ian.jackson@eu.citrix.com, Wei Liu , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Tue, May 20, 2014 at 03:32:04PM +0100, Ian Campbell wrote: > On Tue, 2014-05-13 at 22:54 +0100, Wei Liu wrote: > > Signed-off-by: Wei Liu > > --- > > tools/libxl/libxl.c | 36 ++++++++++++++++++++++++++++++++++++ > > 1 file changed, 36 insertions(+) > > > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > > index b578a5c..f93096b 100644 > > --- a/tools/libxl/libxl.c > > +++ b/tools/libxl/libxl.c > > @@ -3529,6 +3529,25 @@ out: > > > > /******************************************************************************/ > > > > +/* Macro to load / store domain configuration. They must use in pair. > > + * Load macro defines d_config that can be used by other code. Store > > + * macro will dispose d_config. > > + */ > > I was asking for a helper earlier, I suppose this could be useful there > too. > > TBH I think a helper fn and callback arrangement would be preferable to > magic macros (macros only when there is no alternative I think). I > suppose that would result in a plethora of little callback helpers > though. Hrm, what do you think? > Yes. The downside is we need to have many helpers. But I think it is a better approach. > > +#define LOAD_DOMAIN_CONFIG(domid) \ > > + libxl_domain_config d_config; \ > > + libxl_domain_config_init(&d_config); \ > > + rc = libxl_load_domain_configuration(CTX, (domid), &d_config); \ > > + if (rc) \ > > + goto out; \ > > + > > +#define STORE_DOMAIN_CONFIG(domid) \ > > + rc = libxl_store_domain_configuration(CTX, (domid), &d_config); \ > > + if (rc) { \ > > + libxl_domain_config_dispose(&d_config); \ > > + goto out; \ > > + } \ > > + libxl_domain_config_dispose(&d_config); \ > > rc = > libxl_domain_config_dispose > if (rc) > goto out; > > would work here I think, since dispose doesn't clobber rc. > Yes, you're right. Wei.