]> git.proxmox.com Git - mirror_qemu.git/commitdiff
blockdev: New drive_get_by_index()
authorMarkus Armbruster <armbru@redhat.com>
Fri, 28 Jan 2011 10:21:44 +0000 (11:21 +0100)
committerKevin Wolf <kwolf@redhat.com>
Mon, 31 Jan 2011 10:17:07 +0000 (11:17 +0100)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
blockdev.c
blockdev.h

index a42c5e4a62a96ed6ff8e5bd154cc490828d43b17..01228f6200c0a9708ed42a639483a07a2121c7e9 100644 (file)
@@ -136,6 +136,13 @@ DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit)
     return NULL;
 }
 
+DriveInfo *drive_get_by_index(BlockInterfaceType type, int index)
+{
+    return drive_get(type,
+                     drive_index_to_bus_id(type, index),
+                     drive_index_to_unit_id(type, index));
+}
+
 int drive_get_max_bus(BlockInterfaceType type)
 {
     int max_bus;
index 0c01e0801ee41c290e3324ff6f3f38ecdfad2651..18278cc65d4e6dc200e8a0735a5d598f5928dbca 100644 (file)
@@ -39,6 +39,7 @@ struct DriveInfo {
 };
 
 DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit);
+DriveInfo *drive_get_by_index(BlockInterfaceType type, int index);
 int drive_get_max_bus(BlockInterfaceType type);
 DriveInfo *drive_get_next(BlockInterfaceType type);
 void drive_uninit(DriveInfo *dinfo);