]> git.proxmox.com Git - qemu.git/commitdiff
blockdev: New drive_get_by_blockdev()
authorMarkus Armbruster <armbru@redhat.com>
Thu, 24 Jun 2010 15:25:32 +0000 (17:25 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 2 Jul 2010 11:18:01 +0000 (13:18 +0200)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
blockdev.c
blockdev.h

index e0495e5c614a0d1ccf69e5cc1a9da2bde5fa2702..ba4f66f976e6bb89f43e0a830b5d83ac80574ccb 100644 (file)
@@ -78,6 +78,18 @@ int drive_get_max_bus(BlockInterfaceType type)
     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);
index a9367857d8d25d8ba4f84046dd93adac90b25b7f..6ab592f0fdfddd34bcbaf81e73ef73fc750c9f6c 100644 (file)
@@ -40,6 +40,7 @@ extern DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit);
 extern DriveInfo *drive_get_by_id(const char *id);
 extern int drive_get_max_bus(BlockInterfaceType type);
 extern void drive_uninit(DriveInfo *dinfo);
+extern DriveInfo *drive_get_by_blockdev(BlockDriverState *bs);
 
 extern QemuOpts *drive_add(const char *file, const char *fmt, ...);
 extern DriveInfo *drive_init(QemuOpts *arg, int default_to_scsi,