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

Re: [Xen-devel] [Qemu-devel] [PATCH 2/2] xen: add qemu device for each pvusb backend



On 27/09/16 11:00, Daniel P. Berrange wrote:
> On Mon, Sep 26, 2016 at 02:43:57PM +0200, Juergen Gross wrote:
>> In order to be able to specify to which pvusb controller a new pvusb
>> device should be added we need a qemu device for each pvusb controller
>> with an associated id.
>>
>> Add such a device when a new controller is requested and attach the
>> usb bus of that controller to the new device. Any device connected to
>> that controller can now specify the bus and port directly via its
>> properties.
>>
>> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
>> ---
>>  hw/usb/xen-usb.c | 81 
>> +++++++++++++++++++++++++++++++++++++++++++++++---------
>>  1 file changed, 68 insertions(+), 13 deletions(-)
>>
>> @@ -733,10 +740,10 @@ static void usbback_portid_add(struct usbback_info 
>> *usbif, unsigned port,
>>  {
>>      unsigned speed;
>>      char *portname;
>> -    USBPort *p;
>>      Error *local_err = NULL;
>>      QDict *qdict;
>>      QemuOpts *opts;
>> +    char tmp[32];
>>  
>>      if (usbif->ports[port - 1].dev) {
>>          return;
>> @@ -749,11 +756,14 @@ static void usbback_portid_add(struct usbback_info 
>> *usbif, unsigned port,
>>          return;
>>      }
>>      portname++;
>> -    p = &(usbif->ports[port - 1].port);
>> -    snprintf(p->path, sizeof(p->path), "%s", portname);
>>  
>>      qdict = qdict_new();
>>      qdict_put(qdict, "driver", qstring_from_str("usb-host"));
>> +    snprintf(tmp, sizeof(tmp), "%s.0", usbif->id);
> 
> Don't snprintf into fixed length buffers. g_strdup_printf() does the
> right thing

Okay, will change it.


Juergen

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

 


Rackspace

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