From 13cb8a57062c3a56f991061315186b7e8dad4994 Mon Sep 17 00:00:00 2001 From: Anthony Liguori Date: Wed, 26 Jan 2011 14:58:01 -0200 Subject: [RHEL6 qemu-kvm PATCH 06/14] blockdev: New drive_get_by_blockdev() (v2) RH-Author: Anthony Liguori Message-id: <1296053886-2905-7-git-send-email-aliguori@redhat.com> Patchwork-id: 17091 O-Subject: [PATCH RHEL6.1 qemu-kvm 06/11] blockdev: New drive_get_by_blockdev() (v2) Bugzilla: 654682 RH-Acked-by: Kevin Wolf RH-Acked-by: Marcelo Tosatti RH-Acked-by: Markus Armbruster From: Markus Armbruster BZ: 654682 Upstream-status: accepted Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf (cherry picked from commit e4700e595ea0b24d5291dbd68deba26d7a955703) Signed-off-by: Anthony Liguori -- v1 -> v2 - Reorder declarations to match upstream Signed-off-by: Eduardo Habkost --- sysemu.h | 1 + vl.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/sysemu.h b/sysemu.h index 94b457e..49d1383 100644 --- a/sysemu.h +++ b/sysemu.h @@ -201,6 +201,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 const char *drive_get_serial(BlockDriverState *bdrv); extern BlockInterfaceErrorAction drive_get_on_error( diff --git a/vl.c b/vl.c index d899c9c..23bf101 100644 --- a/vl.c +++ b/vl.c @@ -2128,6 +2128,18 @@ DriveInfo *drive_get_by_id(const char *id) return NULL; } +DriveInfo *drive_get_by_blockdev(BlockDriverState *bs) +{ + DriveInfo *dinfo; + + QTAILQ_FOREACH(dinfo, &drives, next) { + if (dinfo->bdrv == bs) { + return dinfo; + } + } + return NULL; +} + int drive_get_max_bus(BlockInterfaceType type) { int max_bus; -- 1.7.3.2