From e4700e595ea0b24d5291dbd68deba26d7a955703 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 24 Jun 2010 17:25:32 +0200 Subject: blockdev: New drive_get_by_blockdev() Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- blockdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'blockdev.c') diff --git a/blockdev.c b/blockdev.c index e0495e5c61..ba4f66f976 100644 --- a/blockdev.c +++ b/blockdev.c @@ -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); -- cgit v1.2.3