From: Wei Liu Subject: Re: [PATCH V4 19/24] xl: introduce and use "xl-json" format Date: Tue, 6 May 2014 17:35:49 +0100 Message-ID: <20140506163549.GX17067@zion.uk.xensource.com> References: <1398949101-23320-1-git-send-email-wei.liu2@citrix.com> <1398949101-23320-20-git-send-email-wei.liu2@citrix.com> <1399386402.3014.172.camel@kazak.uk.xensource.com> <20140506151753.GR17067@zion.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: <20140506151753.GR17067@zion.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 06, 2014 at 04:17:53PM +0100, Wei Liu wrote: [...] > > > > > > +static void nic_update_default(libxl_domain_config *d_config) > > > +{ > > > + int i; > > > + libxl_device_nic *nic; > > > + > > > + for (i = 0; i < d_config->num_nics; i++) { > > > + nic = &d_config->nics[i]; > > > + > > > + if (default_vifscript) { > > > + free(nic->script); > > > + nic->script = strdup(default_vifscript); > > > + } > > > > You can use the replace_string() helper for all these I think. > > > > Except -- what about any explicitly configured script (ie. vif = > > ['script=blargle']), does this not replace it with the default? Should > > this be if !nic->script ? > > > > Haven't thought about this. This is actually just code motion. I think > you just discovered a bug. One more patch added to queue! > Actually I was wrong, this code motion is buggy and I will fix it. There's no bug in the original code. Wei.