From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH V7 5/7] xl: add pvusb commands Date: Fri, 2 Oct 2015 16:29:46 +0100 Message-ID: <1443799786.11707.141.camel@citrix.com> References: <1443147102-6471-1-git-send-email-cyliu@suse.com> <1443147102-6471-6-git-send-email-cyliu@suse.com> <560D6733.4030503@citrix.com> <1443792926.11707.119.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap Cc: =?ISO-8859-1?Q?J=FCrgen_Gro=DF?= , Wei Liu , Ian Jackson , George Dunlap , "xen-devel@lists.xen.org" , Jim Fehlig , Simon Cao , Chunyan Liu List-Id: xen-devel@lists.xenproject.org On Fri, 2015-10-02 at 16:17 +0100, George Dunlap wrote: > On Fri, Oct 2, 2015 at 2:35 PM, Ian Campbell > wrote: > > On Thu, 2015-10-01 at 18:02 +0100, George Dunlap wrote: > > > On 25/09/15 03:11, Chunyan Liu wrote: > > > > Add pvusb commands: usb-ctrl-attach, usb-ctrl-detach, usb-list, > > > > usb-attach and usb-detach. > > > > > > > > To attach a usb device to guest through pvusb, one could follow > > > > following example: > > > > > > > > #xl usb-ctrl-attach test_vm version=1 num_ports=8 > > > > > > So all the way back in v2 of this series, I suggested making the > > > arguments for usb-ctrl-attach and usb-attach mirror the format that > > > is > > > found in the config file[1] > > > [...] > > > [1] > > > marc.info/?i=< > > > CAFLBxZb1N3_9PVvg-yC8dyVaiySZVRA3H2e8496vHNEfvrm6Zg@mail.gmail.com> > > > > Re: xl usb-ctrl-attach test_vm name=pv-1,type=pv,version=1,ports=8 > > > > FWIW I think most of the existing ones allow (but don't require) a > > slight > > difference in the cli version, which is that they allow space spearated > > lists as well as command separate, which ends up a bit more natural: > > > > xl usb-ctrl-attach test_vm name=pv-1 type=pv version=1 ports=8 > > [...] BTW this is generally pretty easy to arrange, You have a helper: parse_foo(const char *s, libxl_foo *foo) which takes a comma separate list "s" and _incremntally_ updates the object "foo" which it was given. Then when parsing the cfg file you call parse_foo on the string and when parsing the command line you call parse_foo for every argv (with the same object). See e.g. parse_nic_config in xl_cmdimpl.c. Disk does it a bit differently with parse_disk_config and parse_disk_config_multistring, where the latter effectively incorporates the loop over argv. Ian.