blockdev: New drive_get_by_blockdev()
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
diff --git a/blockdev.c b/blockdev.c
index e0495e5..ba4f66f 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -78,6 +78,18 @@
return max_bus;
}
+DriveInfo *drive_get_by_blockdev(BlockDriverState *bs)
+{
+ DriveInfo *dinfo;
+
+ QTAILQ_FOREACH(dinfo, &drives, next) {
+ if (dinfo->bdrv == bs) {
+ return dinfo;
+ }
+ }
+ return NULL;
+}
+
static void bdrv_format_print(void *opaque, const char *name)
{
fprintf(stderr, " %s", name);