All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Scott <Dave.Scott@citrix.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Ian Jackson <Ian.Jackson@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Stefano Stabellini <Stefano.Stabellini@citrix.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v3 3/3] xl: add support for channels
Date: Thu, 3 Jul 2014 08:51:15 +0000	[thread overview]
Message-ID: <B349C0CD-FA10-408C-B2A8-A8A6AD9AFE92@citrix.com> (raw)
In-Reply-To: <1404315212.8137.15.camel@kazak.uk.xensource.com>


On 2 Jul 2014, at 16:33, Ian Campbell <Ian.Campbell@citrix.com> 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 = [ "name=...,kind=...[,path=...][,backend=...]" ]
>> 
>>> +    if (!xlu_cfg_get_list (config, "channel", &channels, 0, 0)) {
>>> +        d_config->num_channels = 0;
>>> +        d_config->channels = NULL;
>>> +        while ((buf = xlu_cfg_get_listitem (channels,
>>> +                d_config->num_channels)) != NULL) {
>>> +            libxl_device_channel *chn;
>>> +            char *buf2 = strdup(buf);
>>> +            char *p, *p2;
>>> +            chn = ARRAY_EXTEND_INIT(d_config->channels, d_config->num_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=value 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…

I’ve had a go at decomposing this into ‘split_string_into_string_list’, ‘trim’ and ‘split_string_into_pair’ so at least the fiddly pointer-level stuff is in shareable functions. I’ll send around the updated patch set later today.

> 
>> 
>>> +                if (!strcmp(p, "backend")) {
>>> +                    free(chn->backend_domname);
>>> +                    chn->backend_domname = 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’ll replace my new replace function with ‘replace_string' before I send the patches :-)

Cheers,
Dave

  reply	other threads:[~2014-07-03  8:51 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-23  8:28 [PATCH v3] add support for libvirt-like channels David Scott
2014-06-23  8:28 ` [PATCH v3 1/3] docs: add a document describing the 'channels' mechanism David Scott
2014-06-23 14:38   ` Ian Jackson
2014-06-23 14:53   ` Ian Jackson
2014-06-23 17:45     ` Dave Scott
2014-06-24 10:43       ` Ian Jackson
2014-06-24 11:15         ` Dave Scott
2014-07-02 15:29           ` Ian Campbell
2014-06-23  8:29 ` [PATCH v3 2/3] libxl: add support for channels David Scott
2014-06-23 14:52   ` Ian Jackson
2014-06-23 17:43     ` Dave Scott
2014-06-24 10:41       ` Ian Jackson
2014-06-24 11:09         ` Dave Scott
2014-06-23  8:29 ` [PATCH v3 3/3] xl: " David Scott
2014-06-23 10:02   ` Wei Liu
2014-06-23 10:47     ` Dave Scott
2014-06-23 14:57   ` Ian Jackson
2014-07-02 15:33     ` Ian Campbell
2014-07-03  8:51       ` Dave Scott [this message]
2014-07-22 15:05 ` [PATCH v4] add support for libvirt-like channels David Scott
2014-07-22 15:05   ` [PATCH v4 1/3] libxl IDL: the name of a KeyedUnion descriminator need not be 'type' David Scott
2014-07-24 15:52     ` Ian Campbell
2014-07-22 15:05   ` [PATCH v4 2/3] libxl: add support for 'channels' David Scott
2014-09-10 14:41     ` Ian Campbell
2014-09-11 13:12       ` Dave Scott
2014-07-22 15:05   ` [PATCH v4 3/3] xl: " David Scott
2014-07-28 14:22   ` [PATCH v4] add support for libvirt-like channels David Vrabel
2014-08-07 13:37     ` Dave Scott
2014-08-07 14:12       ` David Vrabel
2014-08-07 14:26         ` Stefano Stabellini
2014-08-11  9:35           ` Dave Scott
2014-08-11 11:49             ` Stefano Stabellini
2014-09-10 13:07     ` Ian Campbell
2014-09-10 13:45       ` Dave Scott
2014-09-10 14:04         ` David Vrabel
2014-09-10 14:13         ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B349C0CD-FA10-408C-B2A8-A8A6AD9AFE92@citrix.com \
    --to=dave.scott@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@citrix.com \
    --cc=Stefano.Stabellini@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.