qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH for-1.5 4/4] virtio-scsi: fix the command line c


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH for-1.5 4/4] virtio-scsi: fix the command line compatibility.
Date: Mon, 29 Apr 2013 18:32:55 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4

Il 29/04/2013 18:28, KONRAD Frédéric ha scritto:
>>>
>> Could this be simply a qdev property?
> 
> Yes, that can be a good idea.
> 
> What about adding a qdev property bus_name and using it in qbus_realize?
> 
> Like this:
> 
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 4eb0134..c5d5407 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -421,6 +421,13 @@ static void qbus_realize(BusState *bus, DeviceState
> *parent, const char *name)
> 
>      if (name) {
>          bus->name = g_strdup(name);
> +    } else if (bus->parent && bus->parent->bus_name) {
> +        /* parent device has bus_name -> use it for bus name */
> +        len = strlen(bus->parent->bus_name) + 16;
> +        buf = g_malloc(len);
> +        snprintf(buf, len, "%s.%d", bus->parent->bus_name,
> +                 bus->parent->num_child_bus);
> +        bus->name = buf;
>      } else if (bus->parent && bus->parent->id) {
>          /* parent device has id -> use it for bus name */
>          len = strlen(bus->parent->id) + 16;
> 
> If so, change to scsi_bus_new is not needed and the two new functions are
> not needed.
> 
> Is that making sense?

Ah, that's a bit more extreme. :)

I think I like it, but I need more input.

Paolo



reply via email to

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