From: George Dunlap <george.dunlap@eu.citrix.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: "sstanisi@cbnco.com" <sstanisi@cbnco.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [PATCH v4 1/2] libxl: Introduce functions to add and remove USB devices to an HVM guest
Date: Wed, 17 Apr 2013 10:59:17 +0100 [thread overview]
Message-ID: <516E7275.9030406@eu.citrix.com> (raw)
In-Reply-To: <1366192463.8399.219.camel@zakaz.uk.xensource.com>
On 17/04/13 10:54, Ian Campbell wrote:
> On Wed, 2013-04-17 at 10:36 +0100, George Dunlap wrote:
>>>> +/*
>>>> + * Just use plain numbers for now. Replace these with strings at some point.
>>>> + */
>>>> +#define protocol_to_str(gc, t) libxl__sprintf((gc), "%d", (t))
>>>> +#define str_to_protocol(s) atoi((s))
>>>> +#define type_to_str(gc, t) libxl__sprintf((gc), "%d", (t))
>>> GCSPRINTF, although this macros are so simple that you might also
>>> replace them entirely with GCSPRINTF (altough it might make the code
>>> harder to understand).
>> I might do that -- my original plan had actually been to actually print
>> "pv" for LIBXL_DEVICE_USB_BACKEND_PV, "dm" for _DEVICEMODEL, and so on.
>> Doing all the extra parsing was more work than I wanted to try to get
>> done for the code freeze, but I left the functions so I could easily
>> replaced them later.
> These symbols should be coming from the IDL, in which case it will have
> provided the parsing functions already, please use them instead of
> inventing your own.
>
> e.g. The libxl_domain_type enum in the idl generates
> libxl_domain_type_from_string and libxl_domain_type_to_string (and
> _to_json if that floats your boat). These implement the mapping:
> LIBXL_DOMAIN_TYPE_INVALID <=> "invalid"
> LIBXL_DOMAIN_TYPE_HVM <=> "hvm"
> LIBXL_DOMAIN_TYPE_PV <=> "pv"
> (the from function is case insensitive)
>
> "Replace these with strings at some point.", is that an API change,
> either for the libxl user or the driver side?
This is just an internal thing for libxl; it doesn't persist across reboots.
Let me take a look at the functions you mentioned -- if they're really
easy I'll just drop them in. Otherwise, the numeric values will be just
fine, even if for some reason they end up being permanent.
>
>>>> + switch (usbdev->protocol) {
>>>> + case LIBXL_USB_PROTOCOL_DEVICEMODEL:
>>>> + switch (libxl__device_model_version_running(gc, domid)) {
>>>> + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
>>>> + LOG(ERROR, "usb-remove not yet implemented for qemu-traditional");
>>>> + return ERROR_INVAL;
>>>> + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
>>>> + if ( (rc = libxl__qmp_usb_remove(gc, domid, usbdev)) < 0 )
>>> Spaces
>> How important are the spaces? Most of the time I think it makes it
>> easier to read, in this case particularly so.
> Everyone has their own opinions about these thing but the main purpose
> of having a Coding Style is consistency and libxl's style is to not
> include those spaces.
>
> If you want to make it easier to read I would suggest removing the
> assignment from the condition.
Ack.
-George
next prev parent reply other threads:[~2013-04-17 9:59 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-11 18:51 [PATCH v4 1/2] libxl: Introduce functions to add and remove USB devices to an HVM guest George Dunlap
2013-04-11 18:51 ` [PATCH v4 2/2] xl: Add commands for usb hot-plug George Dunlap
2013-04-17 10:02 ` Roger Pau Monné
2013-04-17 10:03 ` George Dunlap
2013-04-17 10:15 ` Ian Campbell
2013-04-17 10:20 ` George Dunlap
2013-04-17 11:48 ` Ian Jackson
2013-04-17 11:44 ` Ian Jackson
2013-04-11 18:55 ` [PATCH v4 1/2] libxl: Introduce functions to add and remove USB devices to an HVM guest George Dunlap
2013-04-16 15:38 ` George Dunlap
2013-04-16 18:00 ` Roger Pau Monné
2013-04-17 9:36 ` George Dunlap
2013-04-17 9:48 ` Roger Pau Monné
2013-04-17 10:05 ` George Dunlap
2013-04-17 11:46 ` Ian Jackson
2013-04-17 9:54 ` Ian Campbell
2013-04-17 9:59 ` George Dunlap [this message]
2013-04-17 11:41 ` Ian Jackson
2013-04-17 9:58 ` Ian Campbell
2013-04-17 10:02 ` George Dunlap
2013-04-17 10:13 ` Ian Campbell
2013-04-17 10:25 ` George Dunlap
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=516E7275.9030406@eu.citrix.com \
--to=george.dunlap@eu.citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=roger.pau@citrix.com \
--cc=sstanisi@cbnco.com \
--cc=xen-devel@lists.xen.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.