From: Wei Liu Subject: Re: [RFC 19/19] xl: Add new option dtdev Date: Wed, 18 Jun 2014 14:43:03 +0100 Message-ID: <20140618134303.GA20819@zion.uk.xensource.com> References: <1402935486-29136-1-git-send-email-julien.grall@linaro.org> <1402935486-29136-20-git-send-email-julien.grall@linaro.org> <20140616171953.GC1773@zion.uk.xensource.com> <53A196D5.6040304@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WxG8p-0002hk-5z for xen-devel@lists.xenproject.org; Wed, 18 Jun 2014 13:43:07 +0000 Content-Disposition: inline In-Reply-To: <53A196D5.6040304@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: Wei Liu , ian.campbell@citrix.com, Stefano Stabellini , tim@xen.org, Ian Jackson , stefano.stabellini@citrix.com, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Wed, Jun 18, 2014 at 02:40:37PM +0100, Julien Grall wrote: > Hi Wei, > > On 06/16/2014 06:19 PM, Wei Liu wrote: > > On Mon, Jun 16, 2014 at 05:18:06PM +0100, Julien Grall wrote: > > [...] > >> + if (!xlu_cfg_get_list (config, "dtdev", &dtdevs, 0, 0)) { > >> + d_config->num_dtdevs = 0; > >> + d_config->dtdevs = NULL; > >> + for (i = 0; (buf = xlu_cfg_get_listitem(dtdevs, i)) != NULL; i++) { > >> + libxl_device_dt *dtdev; > >> + > >> + d_config->dtdevs = (libxl_device_dt *) realloc(d_config->dtdevs, sizeof (libxl_device_dt) * (d_config->num_dtdevs + 1)); > >> + dtdev = d_config->dtdevs + d_config->num_dtdevs; > >> + libxl_device_dt_init(dtdev); > >> + > > > > There's a macro called ARRAY_EXTEND_INIT, you can probably use that. > > I can't use this macro because it requires to have a field devid in the > structure. Ah, OK. In that case, you need to use xrealloc in your code. > > I don't think it worth to add this field just for code conciseness. > Though I can add rename this macro into ARRAY_EXTEND_INIT_DEVID and > introduce an ARRAY_EXTEND_INIT that could be use in more general case. > No need to do that in my opinion. Wei. > Regards, > > -- > Julien Grall