Patchwork [for-1.5,3/4] scsi: add scsi_named_bus_new().

login
register
mail settings
Submitter fred.konrad@greensocs.com
Date April 29, 2013, 3:12 p.m.
Message ID <1367248365-27260-4-git-send-email-fred.konrad@greensocs.com>
Download mbox | patch
Permalink /patch/240399/
State New
Headers show

Comments

fred.konrad@greensocs.com - April 29, 2013, 3:12 p.m.
From: KONRAD Frederic <fred.konrad@greensocs.com>

This add the possibility to create a scsi-bus with a specified name.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
---
 hw/scsi/scsi-bus.c     | 12 +++++++++---
 include/hw/scsi/scsi.h |  2 ++
 2 files changed, 11 insertions(+), 3 deletions(-)
Paolo Bonzini - April 29, 2013, 3:40 p.m.
Il 29/04/2013 17:12, fred.konrad@greensocs.com ha scritto:
> From: KONRAD Frederic <fred.konrad@greensocs.com>
> 
> This add the possibility to create a scsi-bus with a specified name.
> 
> Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
> ---
>  hw/scsi/scsi-bus.c     | 12 +++++++++---
>  include/hw/scsi/scsi.h |  2 ++
>  2 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
> index 6239ee1..0364749 100644
> --- a/hw/scsi/scsi-bus.c
> +++ b/hw/scsi/scsi-bus.c
> @@ -71,15 +71,21 @@ static void scsi_device_unit_attention_reported(SCSIDevice *s)
>      }
>  }
>  
> -/* Create a scsi bus, and attach devices to it.  */
> -void scsi_bus_new(SCSIBus *bus, DeviceState *host, const SCSIBusInfo *info)
> +void scsi_named_bus_new(SCSIBus *bus, DeviceState *host,
> +                        const SCSIBusInfo *info, const char *bus_name)
>  {
> -    qbus_create_inplace(&bus->qbus, TYPE_SCSI_BUS, host, NULL);
> +    qbus_create_inplace(&bus->qbus, TYPE_SCSI_BUS, host, bus_name);
>      bus->busnr = next_scsi_bus++;
>      bus->info = info;
>      bus->qbus.allow_hotplug = 1;
>  }

I'd prefer that you just add the argument to scsi_bus_new and change all
callers.

Paolo

> +/* Create a scsi bus, and attach devices to it.  */
> +void scsi_bus_new(SCSIBus *bus, DeviceState *host, const SCSIBusInfo *info)
> +{
> +    scsi_named_bus_new(bus, host, info, NULL);
> +}
> +
>  static void scsi_dma_restart_bh(void *opaque)
>  {
>      SCSIDevice *s = opaque;
> diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
> index 3bda1c4..ddcb07c 100644
> --- a/include/hw/scsi/scsi.h
> +++ b/include/hw/scsi/scsi.h
> @@ -153,6 +153,8 @@ struct SCSIBus {
>  };
>  
>  void scsi_bus_new(SCSIBus *bus, DeviceState *host, const SCSIBusInfo *info);
> +void scsi_named_bus_new(SCSIBus *bus, DeviceState *host,
> +                        const SCSIBusInfo *info, const char *bus_name);
>  
>  static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d)
>  {
>
fred.konrad@greensocs.com - April 29, 2013, 4:15 p.m.
On 29/04/2013 17:40, Paolo Bonzini wrote:
> Il 29/04/2013 17:12, fred.konrad@greensocs.com ha scritto:
>> From: KONRAD Frederic <fred.konrad@greensocs.com>
>>
>> This add the possibility to create a scsi-bus with a specified name.
>>
>> Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>> ---
>>   hw/scsi/scsi-bus.c     | 12 +++++++++---
>>   include/hw/scsi/scsi.h |  2 ++
>>   2 files changed, 11 insertions(+), 3 deletions(-)
>>
>> diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
>> index 6239ee1..0364749 100644
>> --- a/hw/scsi/scsi-bus.c
>> +++ b/hw/scsi/scsi-bus.c
>> @@ -71,15 +71,21 @@ static void scsi_device_unit_attention_reported(SCSIDevice *s)
>>       }
>>   }
>>   
>> -/* Create a scsi bus, and attach devices to it.  */
>> -void scsi_bus_new(SCSIBus *bus, DeviceState *host, const SCSIBusInfo *info)
>> +void scsi_named_bus_new(SCSIBus *bus, DeviceState *host,
>> +                        const SCSIBusInfo *info, const char *bus_name)
>>   {
>> -    qbus_create_inplace(&bus->qbus, TYPE_SCSI_BUS, host, NULL);
>> +    qbus_create_inplace(&bus->qbus, TYPE_SCSI_BUS, host, bus_name);
>>       bus->busnr = next_scsi_bus++;
>>       bus->info = info;
>>       bus->qbus.allow_hotplug = 1;
>>   }
> I'd prefer that you just add the argument to scsi_bus_new and change all
> callers.
>
> Paolo

Ok, will do.

>> +/* Create a scsi bus, and attach devices to it.  */
>> +void scsi_bus_new(SCSIBus *bus, DeviceState *host, const SCSIBusInfo *info)
>> +{
>> +    scsi_named_bus_new(bus, host, info, NULL);
>> +}
>> +
>>   static void scsi_dma_restart_bh(void *opaque)
>>   {
>>       SCSIDevice *s = opaque;
>> diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
>> index 3bda1c4..ddcb07c 100644
>> --- a/include/hw/scsi/scsi.h
>> +++ b/include/hw/scsi/scsi.h
>> @@ -153,6 +153,8 @@ struct SCSIBus {
>>   };
>>   
>>   void scsi_bus_new(SCSIBus *bus, DeviceState *host, const SCSIBusInfo *info);
>> +void scsi_named_bus_new(SCSIBus *bus, DeviceState *host,
>> +                        const SCSIBusInfo *info, const char *bus_name);
>>   
>>   static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d)
>>   {
>>

Patch

diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index 6239ee1..0364749 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -71,15 +71,21 @@  static void scsi_device_unit_attention_reported(SCSIDevice *s)
     }
 }
 
-/* Create a scsi bus, and attach devices to it.  */
-void scsi_bus_new(SCSIBus *bus, DeviceState *host, const SCSIBusInfo *info)
+void scsi_named_bus_new(SCSIBus *bus, DeviceState *host,
+                        const SCSIBusInfo *info, const char *bus_name)
 {
-    qbus_create_inplace(&bus->qbus, TYPE_SCSI_BUS, host, NULL);
+    qbus_create_inplace(&bus->qbus, TYPE_SCSI_BUS, host, bus_name);
     bus->busnr = next_scsi_bus++;
     bus->info = info;
     bus->qbus.allow_hotplug = 1;
 }
 
+/* Create a scsi bus, and attach devices to it.  */
+void scsi_bus_new(SCSIBus *bus, DeviceState *host, const SCSIBusInfo *info)
+{
+    scsi_named_bus_new(bus, host, info, NULL);
+}
+
 static void scsi_dma_restart_bh(void *opaque)
 {
     SCSIDevice *s = opaque;
diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
index 3bda1c4..ddcb07c 100644
--- a/include/hw/scsi/scsi.h
+++ b/include/hw/scsi/scsi.h
@@ -153,6 +153,8 @@  struct SCSIBus {
 };
 
 void scsi_bus_new(SCSIBus *bus, DeviceState *host, const SCSIBusInfo *info);
+void scsi_named_bus_new(SCSIBus *bus, DeviceState *host,
+                        const SCSIBusInfo *info, const char *bus_name);
 
 static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d)
 {