qemu-devel
[Top][All Lists]
Advanced

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

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


From: Juergen Gross
Subject: Re: [Qemu-devel] [PATCH 2/2] xen: add qemu device for each pvusb backend
Date: Thu, 29 Sep 2016 16:39:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

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 <address@hidden>
>> ---
>>  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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]