]> git.proxmox.com Git - qemu.git/blobdiff - hw/ide/core.c
ide: consolidate drive_get(IF_IDE)
[qemu.git] / hw / ide / core.c
index 007a4ee0c9cad3b6d728126b66f8dbf5b9dc6c95..c11d457b7ad976724dd595f5626e1a988abeea20 100644 (file)
@@ -2826,3 +2826,17 @@ const VMStateDescription vmstate_ide_bus = {
         VMSTATE_END_OF_LIST()
     }
 };
+
+void ide_drive_get(DriveInfo **hd, int max_bus)
+{
+    int i;
+
+    if (drive_get_max_bus(IF_IDE) >= max_bus) {
+        fprintf(stderr, "qemu: too many IDE bus: %d\n", max_bus);
+        exit(1);
+    }
+
+    for(i = 0; i < max_bus * MAX_IDE_DEVS; i++) {
+        hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS);
+    }
+}