From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Scott Subject: Re: [PATCH v3 3/3] xl: add support for channels Date: Thu, 3 Jul 2014 08:51:15 +0000 Message-ID: References: <1403512141-12283-1-git-send-email-dave.scott@citrix.com> <1403512141-12283-4-git-send-email-dave.scott@citrix.com> <21416.16448.159980.302953@mariner.uk.xensource.com> <1404315212.8137.15.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X2cjm-0001wY-Gs for xen-devel@lists.xenproject.org; Thu, 03 Jul 2014 08:51:26 +0000 In-Reply-To: <1404315212.8137.15.camel@kazak.uk.xensource.com> Content-Language: en-US Content-ID: <9D94AF5ECE0F4E44B3ED5D73F7CC8456@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: Ian Campbell Cc: Ian Jackson , Wei Liu , Stefano Stabellini , "xen-devel@lists.xenproject.org" List-Id: xen-devel@lists.xenproject.org On 2 Jul 2014, at 16:33, Ian Campbell wrote: > On Mon, 2014-06-23 at 15:57 +0100, Ian Jackson wrote: >> David Scott writes ("[PATCH v3 3/3] xl: add support for channels"): >>> This adds support for channel declarations of the form: >>> channel =3D [ "name=3D...,kind=3D...[,path=3D...][,backend=3D...]" ] >> = >>> + if (!xlu_cfg_get_list (config, "channel", &channels, 0, 0)) { >>> + d_config->num_channels =3D 0; >>> + d_config->channels =3D NULL; >>> + while ((buf =3D xlu_cfg_get_listitem (channels, >>> + d_config->num_channels)) !=3D NULL) { >>> + libxl_device_channel *chn; >>> + char *buf2 =3D strdup(buf); >>> + char *p, *p2; >>> + chn =3D ARRAY_EXTEND_INIT(d_config->channels, d_config->nu= m_channels, >>> + libxl_device_channel_init); >> = >> I appreciate that you're just following the example of the vif >> configuration here, but I think this is rather too much open-coded >> string handling. > = > FWIW I think there are a few places in xl where a precanned parser for > strings of comma-separated key=3Dvalue syntax would be quite valuable (the > existing one is very disk specific due to the quirks for that syntax). > = > I don't expect Dave to write one though=85 I=92ve had a go at decomposing this into =91split_string_into_string_list= =92, =91trim=92 and =91split_string_into_pair=92 so at least the fiddly poi= nter-level stuff is in shareable functions. I=92ll send around the updated = patch set later today. > = >> = >>> + if (!strcmp(p, "backend")) { >>> + free(chn->backend_domname); >>> + chn->backend_domname =3D strdup(p2 + 1); >> = >> At the very least, can we provide a macro or function or something to >> do this ? > = > I think the existing replace_string already does this. Ah yes so it does. I=92ll replace my new replace function with =91replace_s= tring' before I send the patches :-) Cheers, Dave