From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [RFC 19/19] xl: Add new option dtdev Date: Wed, 18 Jun 2014 14:46:43 +0100 Message-ID: <53A19843.5000803@linaro.org> 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> <20140618134303.GA20819@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WxGCN-0003Al-91 for xen-devel@lists.xenproject.org; Wed, 18 Jun 2014 13:46:47 +0000 Received: by mail-wi0-f172.google.com with SMTP id hi2so7666104wib.11 for ; Wed, 18 Jun 2014 06:46:45 -0700 (PDT) In-Reply-To: <20140618134303.GA20819@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: Wei Liu Cc: 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 06/18/2014 02:43 PM, Wei Liu wrote: > 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. Right, I blindly copied the pcidevs code which is also using realloc. I will fix both of them in my next series. Regards, -- Julien Grall