]> git.proxmox.com Git - mirror_qemu.git/blobdiff - hw/qdev.c
kill drives_table
[mirror_qemu.git] / hw / qdev.c
index 97a9665424dbd42d7dba9924dfc5e6fdce3d9571..479eb72b6740a6c2df91973eea180de7aaef634c 100644 (file)
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -267,13 +267,10 @@ static int next_block_unit[IF_COUNT];
 BlockDriverState *qdev_init_bdrv(DeviceState *dev, BlockInterfaceType type)
 {
     int unit = next_block_unit[type]++;
-    int index;
+    DriveInfo *dinfo;
 
-    index = drive_get_index(type, 0, unit);
-    if (index == -1) {
-        return NULL;
-    }
-    return drives_table[index].bdrv;
+    dinfo = drive_get(type, 0, unit);
+    return dinfo ? dinfo->bdrv : NULL;
 }
 
 BusState *qdev_get_child_bus(DeviceState *dev, const char *name)
@@ -296,14 +293,14 @@ void scsi_bus_new(DeviceState *host, SCSIAttachFn attach)
 {
    int bus = next_scsi_bus++;
    int unit;
-   int index;
+   DriveInfo *dinfo;
 
    for (unit = 0; unit < MAX_SCSI_DEVS; unit++) {
-       index = drive_get_index(IF_SCSI, bus, unit);
-       if (index == -1) {
+       dinfo = drive_get(IF_SCSI, bus, unit);
+       if (!dinfo) {
            continue;
        }
-       attach(host, drives_table[index].bdrv, unit);
+       attach(host, dinfo->bdrv, unit);
    }
 }