diff options
Diffstat (limited to 'hw/pci-hotplug.c')
-rw-r--r-- | hw/pci-hotplug.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index d0f2911d65..43675e2659 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -52,9 +52,10 @@ void drive_hot_add(Monitor *mon, const char *pci_addr, const char *opts) { int dom, pci_bus; unsigned slot; - int drive_idx, type, bus; + int type, bus; int success = 0; PCIDevice *dev; + DriveInfo *dinfo; if (pci_read_devaddr(mon, pci_addr, &dom, &pci_bus, &slot)) { return; @@ -66,21 +67,21 @@ void drive_hot_add(Monitor *mon, const char *pci_addr, const char *opts) return; } - drive_idx = add_init_drive(opts); - if (drive_idx < 0) + dinfo = add_init_drive(opts); + if (!dinfo) return; - if (drives_table[drive_idx].devaddr) { + if (dinfo->devaddr) { monitor_printf(mon, "Parameter addr not supported\n"); return; } - type = drives_table[drive_idx].type; + type = dinfo->type; bus = drive_get_max_bus (type); switch (type) { case IF_SCSI: success = 1; - lsi_scsi_attach(&dev->qdev, drives_table[drive_idx].bdrv, - drives_table[drive_idx].unit); + lsi_scsi_attach(&dev->qdev, dinfo->bdrv, + dinfo->unit); break; default: monitor_printf(mon, "Can't hot-add drive to type %d\n", type); @@ -88,8 +89,8 @@ void drive_hot_add(Monitor *mon, const char *pci_addr, const char *opts) if (success) monitor_printf(mon, "OK bus %d, unit %d\n", - drives_table[drive_idx].bus, - drives_table[drive_idx].unit); + dinfo->bus, + dinfo->unit); return; } @@ -98,7 +99,8 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon, const char *opts) { PCIDevice *dev; - int type = -1, drive_idx = -1; + DriveInfo *dinfo; + int type = -1; char buf[128]; if (get_param_value(buf, sizeof(buf), "if", opts)) { @@ -116,10 +118,10 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon, } if (get_param_value(buf, sizeof(buf), "file", opts)) { - drive_idx = add_init_drive(opts); - if (drive_idx < 0) + dinfo = add_init_drive(opts); + if (!dinfo) return NULL; - if (drives_table[drive_idx].devaddr) { + if (dinfo->devaddr) { monitor_printf(mon, "Parameter addr not supported\n"); return NULL; } |