[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH V6 7/7] domcreate: support pvusb in configuration file



On Mon, Aug 10, 2015 at 06:35:28PM +0800, Chunyan Liu wrote:
> Add code to support pvusb in domain config file. One could specify
> usbctrl and usb in domain's configuration file and create domain,
> then usb controllers will be created and usb device would be attached
> to guest automatically.
> 
> One could specify usb controllers and usb devices in config file
> like this:
> usbctrl=['version=2,ports=4', 'version=1, ports=4', ]
> usbdev=['2.1,controller=0,port=1', ]
> 
> Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx>
> Signed-off-by: Simon Cao <caobosimon@xxxxxxxxx>
> ---
[...]
>      }
>  
> +    if (!xlu_cfg_get_list(config, "usbctrl", &usbctrls, 0, 0)) {
> +        d_config->num_usbctrls = 0;
> +        d_config->usbctrls = NULL;
> +        while ((buf = xlu_cfg_get_listitem(usbctrls, d_config->num_usbctrls))
> +               != NULL) {
> +            libxl_device_usbctrl *usbctrl;
> +
> +            d_config->usbctrls =
> +                (libxl_device_usbctrl *)realloc(d_config->usbctrls,
> +                sizeof(libxl_device_usbctrl) * (d_config->num_usbctrls + 1));
> +            usbctrl = d_config->usbctrls + d_config->num_usbctrls;
> +            libxl_device_usbctrl_init(usbctrl);
> +

Use ARRAY_EXTEND_INIT macro.

> +            parse_usbctrl_config(usbctrl, buf);
> +
> +            d_config->num_usbctrls++;
> +        }
> +    }
> +
> +    if (!xlu_cfg_get_list(config, "usbdev", &usbs, 0, 0)) {
> +        d_config->num_usbs = 0;
> +        d_config->usbs = NULL;
> +        while ((buf = xlu_cfg_get_listitem(usbs, d_config->num_usbs)) != 
> NULL) {
> +            libxl_device_usb *usb;
> +
> +            d_config->usbs = (libxl_device_usb *)realloc(d_config->usbs,
> +                    sizeof(libxl_device_usb) * (d_config->num_usbs + 1));
> +            usb = d_config->usbs + d_config->num_usbs;
> +            libxl_device_usb_init(usb);
> +

Ditto.

Wei.

> +            parse_usb_config(usb, buf);
> +
> +            d_config->num_usbs++;
> +        }
> +    }
> +
>      switch (xlu_cfg_get_list(config, "cpuid", &cpuids, 0, 1)) {
>      case 0:
>          {
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.