qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Clean up pci_drive_hot_add()'s use of BlockInterfaceType
@ 2012-11-22 14:16 Markus Armbruster
  2012-11-22 14:21 ` Alexander Graf
  2012-12-03 12:55 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
  0 siblings, 2 replies; 4+ messages in thread
From: Markus Armbruster @ 2012-11-22 14:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, agraf

pci_drive_hot_add() parameter type has the wrong type: int instead of
BlockInterfaceType.  It's actually redundant, so we can just drop it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/device-hotplug.c | 11 ++++-------
 hw/pci-hotplug.c    |  7 +++----
 sysemu.h            |  3 +--
 3 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/hw/device-hotplug.c b/hw/device-hotplug.c
index eec0fe3..6d9c080 100644
--- a/hw/device-hotplug.c
+++ b/hw/device-hotplug.c
@@ -49,18 +49,16 @@ DriveInfo *add_init_drive(const char *optstr)
 }
 
 #if !defined(TARGET_I386)
-int pci_drive_hot_add(Monitor *mon, const QDict *qdict,
-                      DriveInfo *dinfo, int type)
+int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo)
 {
     /* On non-x86 we don't do PCI hotplug */
-    monitor_printf(mon, "Can't hot-add drive to type %d\n", type);
+    monitor_printf(mon, "Can't hot-add drive to type %d\n", dinfo->type);
     return -1;
 }
 #endif
 
 void drive_hot_add(Monitor *mon, const QDict *qdict)
 {
-    int type;
     DriveInfo *dinfo = NULL;
     const char *opts = qdict_get_str(qdict, "opts");
 
@@ -72,14 +70,13 @@ void drive_hot_add(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "Parameter addr not supported\n");
         goto err;
     }
-    type = dinfo->type;
 
-    switch (type) {
+    switch (dinfo->type) {
     case IF_NONE:
         monitor_printf(mon, "OK\n");
         break;
     default:
-        if (pci_drive_hot_add(mon, qdict, dinfo, type)) {
+        if (pci_drive_hot_add(mon, qdict, dinfo)) {
             goto err;
         }
     }
diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c
index e7fb780..d2121ee 100644
--- a/hw/pci-hotplug.c
+++ b/hw/pci-hotplug.c
@@ -105,15 +105,14 @@ static int scsi_hot_add(Monitor *mon, DeviceState *adapter,
     return 0;
 }
 
-int pci_drive_hot_add(Monitor *mon, const QDict *qdict,
-                      DriveInfo *dinfo, int type)
+int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo)
 {
     int dom, pci_bus;
     unsigned slot;
     PCIDevice *dev;
     const char *pci_addr = qdict_get_str(qdict, "pci_addr");
 
-    switch (type) {
+    switch (dinfo->type) {
     case IF_SCSI:
         if (pci_read_devaddr(mon, pci_addr, &dom, &pci_bus, &slot)) {
             goto err;
@@ -129,7 +128,7 @@ int pci_drive_hot_add(Monitor *mon, const QDict *qdict,
         }
         break;
     default:
-        monitor_printf(mon, "Can't hot-add drive to type %d\n", type);
+        monitor_printf(mon, "Can't hot-add drive to type %d\n", dinfo->type);
         goto err;
     }
 
diff --git a/sysemu.h b/sysemu.h
index f5ac664..c1b370b 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -145,8 +145,7 @@ extern unsigned int nb_prom_envs;
 
 /* pci-hotplug */
 void pci_device_hot_add(Monitor *mon, const QDict *qdict);
-int pci_drive_hot_add(Monitor *mon, const QDict *qdict,
-                      DriveInfo *dinfo, int type);
+int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo);
 void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict);
 
 /* generic hotplug */
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] Clean up pci_drive_hot_add()'s use of BlockInterfaceType
  2012-11-22 14:16 [Qemu-devel] [PATCH] Clean up pci_drive_hot_add()'s use of BlockInterfaceType Markus Armbruster
@ 2012-11-22 14:21 ` Alexander Graf
  2012-11-22 14:51   ` Markus Armbruster
  2012-12-03 12:55 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
  1 sibling, 1 reply; 4+ messages in thread
From: Alexander Graf @ 2012-11-22 14:21 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-trivial, qemu-devel


On 22.11.2012, at 15:16, Markus Armbruster wrote:

> pci_drive_hot_add() parameter type has the wrong type: int instead of
> BlockInterfaceType.  It's actually redundant, so we can just drop it.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> hw/device-hotplug.c | 11 ++++-------
> hw/pci-hotplug.c    |  7 +++----
> sysemu.h            |  3 +--
> 3 files changed, 8 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/device-hotplug.c b/hw/device-hotplug.c
> index eec0fe3..6d9c080 100644
> --- a/hw/device-hotplug.c
> +++ b/hw/device-hotplug.c
> @@ -49,18 +49,16 @@ DriveInfo *add_init_drive(const char *optstr)
> }
> 
> #if !defined(TARGET_I386)
> -int pci_drive_hot_add(Monitor *mon, const QDict *qdict,
> -                      DriveInfo *dinfo, int type)
> +int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo)
> {
>     /* On non-x86 we don't do PCI hotplug */
> -    monitor_printf(mon, "Can't hot-add drive to type %d\n", type);
> +    monitor_printf(mon, "Can't hot-add drive to type %d\n", dinfo->type);

Can't we expose names instead? I don't really want internal enum numbering be part of our external CLI interface :)


Alex

>     return -1;
> }
> #endif
> 
> void drive_hot_add(Monitor *mon, const QDict *qdict)
> {
> -    int type;
>     DriveInfo *dinfo = NULL;
>     const char *opts = qdict_get_str(qdict, "opts");
> 
> @@ -72,14 +70,13 @@ void drive_hot_add(Monitor *mon, const QDict *qdict)
>         monitor_printf(mon, "Parameter addr not supported\n");
>         goto err;
>     }
> -    type = dinfo->type;
> 
> -    switch (type) {
> +    switch (dinfo->type) {
>     case IF_NONE:
>         monitor_printf(mon, "OK\n");
>         break;
>     default:
> -        if (pci_drive_hot_add(mon, qdict, dinfo, type)) {
> +        if (pci_drive_hot_add(mon, qdict, dinfo)) {
>             goto err;
>         }
>     }
> diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c
> index e7fb780..d2121ee 100644
> --- a/hw/pci-hotplug.c
> +++ b/hw/pci-hotplug.c
> @@ -105,15 +105,14 @@ static int scsi_hot_add(Monitor *mon, DeviceState *adapter,
>     return 0;
> }
> 
> -int pci_drive_hot_add(Monitor *mon, const QDict *qdict,
> -                      DriveInfo *dinfo, int type)
> +int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo)
> {
>     int dom, pci_bus;
>     unsigned slot;
>     PCIDevice *dev;
>     const char *pci_addr = qdict_get_str(qdict, "pci_addr");
> 
> -    switch (type) {
> +    switch (dinfo->type) {
>     case IF_SCSI:
>         if (pci_read_devaddr(mon, pci_addr, &dom, &pci_bus, &slot)) {
>             goto err;
> @@ -129,7 +128,7 @@ int pci_drive_hot_add(Monitor *mon, const QDict *qdict,
>         }
>         break;
>     default:
> -        monitor_printf(mon, "Can't hot-add drive to type %d\n", type);
> +        monitor_printf(mon, "Can't hot-add drive to type %d\n", dinfo->type);
>         goto err;
>     }
> 
> diff --git a/sysemu.h b/sysemu.h
> index f5ac664..c1b370b 100644
> --- a/sysemu.h
> +++ b/sysemu.h
> @@ -145,8 +145,7 @@ extern unsigned int nb_prom_envs;
> 
> /* pci-hotplug */
> void pci_device_hot_add(Monitor *mon, const QDict *qdict);
> -int pci_drive_hot_add(Monitor *mon, const QDict *qdict,
> -                      DriveInfo *dinfo, int type);
> +int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo);
> void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict);
> 
> /* generic hotplug */
> -- 
> 1.7.11.7
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] Clean up pci_drive_hot_add()'s use of BlockInterfaceType
  2012-11-22 14:21 ` Alexander Graf
@ 2012-11-22 14:51   ` Markus Armbruster
  0 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2012-11-22 14:51 UTC (permalink / raw)
  To: Alexander Graf; +Cc: qemu-trivial, qemu-devel

Alexander Graf <agraf@suse.de> writes:

> On 22.11.2012, at 15:16, Markus Armbruster wrote:
>
>> pci_drive_hot_add() parameter type has the wrong type: int instead of
>> BlockInterfaceType.  It's actually redundant, so we can just drop it.
>> 
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>> hw/device-hotplug.c | 11 ++++-------
>> hw/pci-hotplug.c    |  7 +++----
>> sysemu.h            |  3 +--
>> 3 files changed, 8 insertions(+), 13 deletions(-)
>> 
>> diff --git a/hw/device-hotplug.c b/hw/device-hotplug.c
>> index eec0fe3..6d9c080 100644
>> --- a/hw/device-hotplug.c
>> +++ b/hw/device-hotplug.c
>> @@ -49,18 +49,16 @@ DriveInfo *add_init_drive(const char *optstr)
>> }
>> 
>> #if !defined(TARGET_I386)
>> -int pci_drive_hot_add(Monitor *mon, const QDict *qdict,
>> -                      DriveInfo *dinfo, int type)
>> +int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo)
>> {
>>     /* On non-x86 we don't do PCI hotplug */
>> -    monitor_printf(mon, "Can't hot-add drive to type %d\n", type);
>> +    monitor_printf(mon, "Can't hot-add drive to type %d\n", dinfo->type);
>
> Can't we expose names instead? I don't really want internal enum
> numbering be part of our external CLI interface :)

Fixing that would be nice, but it's outside this patch's scope.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] Clean up pci_drive_hot_add()'s use of BlockInterfaceType
  2012-11-22 14:16 [Qemu-devel] [PATCH] Clean up pci_drive_hot_add()'s use of BlockInterfaceType Markus Armbruster
  2012-11-22 14:21 ` Alexander Graf
@ 2012-12-03 12:55 ` Stefan Hajnoczi
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2012-12-03 12:55 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-trivial, qemu-devel, agraf

On Thu, Nov 22, 2012 at 03:16:36PM +0100, Markus Armbruster wrote:
> pci_drive_hot_add() parameter type has the wrong type: int instead of
> BlockInterfaceType.  It's actually redundant, so we can just drop it.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  hw/device-hotplug.c | 11 ++++-------
>  hw/pci-hotplug.c    |  7 +++----
>  sysemu.h            |  3 +--
>  3 files changed, 8 insertions(+), 13 deletions(-)

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-12-03 12:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-22 14:16 [Qemu-devel] [PATCH] Clean up pci_drive_hot_add()'s use of BlockInterfaceType Markus Armbruster
2012-11-22 14:21 ` Alexander Graf
2012-11-22 14:51   ` Markus Armbruster
2012-12-03 12:55 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).