Clean up pci_drive_hot_add()'s use of BlockInterfaceType

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>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Markus Armbruster 2012-11-22 15:16:36 +01:00 committed by Stefan Hajnoczi
parent 036f0f8356
commit 4dbd84e26f
3 changed files with 8 additions and 13 deletions

View file

@ -49,18 +49,16 @@ DriveInfo *add_init_drive(const char *optstr)
} }
#if !defined(TARGET_I386) #if !defined(TARGET_I386)
int pci_drive_hot_add(Monitor *mon, const QDict *qdict, int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo)
DriveInfo *dinfo, int type)
{ {
/* On non-x86 we don't do PCI hotplug */ /* 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; return -1;
} }
#endif #endif
void drive_hot_add(Monitor *mon, const QDict *qdict) void drive_hot_add(Monitor *mon, const QDict *qdict)
{ {
int type;
DriveInfo *dinfo = NULL; DriveInfo *dinfo = NULL;
const char *opts = qdict_get_str(qdict, "opts"); 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"); monitor_printf(mon, "Parameter addr not supported\n");
goto err; goto err;
} }
type = dinfo->type;
switch (type) { switch (dinfo->type) {
case IF_NONE: case IF_NONE:
monitor_printf(mon, "OK\n"); monitor_printf(mon, "OK\n");
break; break;
default: default:
if (pci_drive_hot_add(mon, qdict, dinfo, type)) { if (pci_drive_hot_add(mon, qdict, dinfo)) {
goto err; goto err;
} }
} }

View file

@ -111,15 +111,14 @@ static int scsi_hot_add(Monitor *mon, DeviceState *adapter,
return 0; return 0;
} }
int pci_drive_hot_add(Monitor *mon, const QDict *qdict, int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo)
DriveInfo *dinfo, int type)
{ {
int dom, pci_bus; int dom, pci_bus;
unsigned slot; unsigned slot;
PCIDevice *dev; PCIDevice *dev;
const char *pci_addr = qdict_get_str(qdict, "pci_addr"); const char *pci_addr = qdict_get_str(qdict, "pci_addr");
switch (type) { switch (dinfo->type) {
case IF_SCSI: case IF_SCSI:
if (pci_read_devaddr(mon, pci_addr, &dom, &pci_bus, &slot)) { if (pci_read_devaddr(mon, pci_addr, &dom, &pci_bus, &slot)) {
goto err; goto err;
@ -135,7 +134,7 @@ int pci_drive_hot_add(Monitor *mon, const QDict *qdict,
} }
break; break;
default: 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; goto err;
} }

View file

@ -145,8 +145,7 @@ extern unsigned int nb_prom_envs;
/* pci-hotplug */ /* pci-hotplug */
void pci_device_hot_add(Monitor *mon, const QDict *qdict); void pci_device_hot_add(Monitor *mon, const QDict *qdict);
int pci_drive_hot_add(Monitor *mon, const QDict *qdict, int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo);
DriveInfo *dinfo, int type);
void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict); void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict);
/* generic hotplug */ /* generic hotplug */