On Wed, Nov 10, 2010 at 5:14 PM, Gleb Natapov <gleb@xxxxxxxxxx> wrote: > > Signed-off-by: Gleb Natapov <gleb@xxxxxxxxxx> > --- > Âhw/usb-bus.c |  35 +++++++++++++++++++++++++++++++++++ > Â1 files changed, 35 insertions(+), 0 deletions(-) > > diff --git a/hw/usb-bus.c b/hw/usb-bus.c > index 256b881..6292282 100644 > --- a/hw/usb-bus.c > +++ b/hw/usb-bus.c > @@ -5,11 +5,13 @@ > Â#include "monitor.h" > > Âstatic void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent); > +static char *usbbus_get_fw_dev_path(DeviceState *dev); > > Âstatic struct BusInfo usb_bus_info = { >   .name   Â= "USB", >   .size   Â= sizeof(USBBus), >   .print_dev = usb_bus_dev_print, > +  Â.get_fw_dev_path = usbbus_get_fw_dev_path, > Â}; > Âstatic int next_usb_bus = 0; > Âstatic QTAILQ_HEAD(, USBBus) busses = QTAILQ_HEAD_INITIALIZER(busses); > @@ -307,3 +309,36 @@ USBDevice *usbdevice_create(const char *cmdline) >   } >   return usb->usbdevice_init(params); > Â} > + > +static int usbbus_get_fw_dev_path_helper(USBDevice *d, USBBus *bus, char *p, > +                     int len) > +{ > +  Âint l = 0; > +  ÂUSBPort *port; > + > +  ÂQTAILQ_FOREACH(port, &bus->used, next) { > +    Âif (port->dev != d) Braces. > +      Âcontinue; > + > +    Âif (port->pdev) { > +      Âl = usbbus_get_fw_dev_path_helper(port->pdev, bus, p, len); > +    Â} > +    Âl += snprintf(p + l, len - l, "%s@%x/", qdev_fw_name(&d->qdev), > +           Âport->index); > +    Âreturn l; > +  Â} > +  Âreturn 0; With this return value... > +} > + > +static char *usbbus_get_fw_dev_path(DeviceState *dev) > +{ > +  ÂUSBDevice *d = (USBDevice*)dev; > +  ÂUSBBus *bus = usb_bus_from_device(d); > +  Âchar path[100]; > +  Âint l; > + > +  Âl = usbbus_get_fw_dev_path_helper(d, bus, path, sizeof(path)); > +  Âpath[l-1] = '\0'; ...this statement will have undesirable effects... > + > +  Âreturn strdup(path); ...like this. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html