summaryrefslogtreecommitdiffstats
path: root/blockdev.c
diff options
context:
space:
mode:
authorMarkus Armbruster2011-01-28 11:21:44 +0100
committerKevin Wolf2011-01-31 11:17:07 +0100
commitf1bd51ac2b6e6ccd3d13dfd52c1c381a68bf261c (patch)
tree29d846394839738805d94ae2647d46aec1980198 /blockdev.c
parentblockdev: Factor drive_index_to_{bus,unit}_id out of drive_init() (diff)
downloadqemu-f1bd51ac2b6e6ccd3d13dfd52c1c381a68bf261c.tar.gz
qemu-f1bd51ac2b6e6ccd3d13dfd52c1c381a68bf261c.tar.xz
qemu-f1bd51ac2b6e6ccd3d13dfd52c1c381a68bf261c.zip
blockdev: New drive_get_by_index()
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/blockdev.c b/blockdev.c
index a42c5e4a62..01228f6200 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -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;