From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=58174 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PilSj-0008Fg-MH for qemu-devel@nongnu.org; Fri, 28 Jan 2011 05:21:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PilSg-0002SY-B5 for qemu-devel@nongnu.org; Fri, 28 Jan 2011 05:21:53 -0500 Received: from oxygen.pond.sub.org ([213.239.205.148]:53400) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PilSg-0002S2-5p for qemu-devel@nongnu.org; Fri, 28 Jan 2011 05:21:50 -0500 From: Markus Armbruster Date: Fri, 28 Jan 2011 11:21:44 +0100 Message-Id: <1296210106-11145-10-git-send-email-armbru@redhat.com> In-Reply-To: <1296210106-11145-1-git-send-email-armbru@redhat.com> References: <1296210106-11145-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH v2 09/11] blockdev: New drive_get_by_index() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@gmail.com, hare@suse.de Signed-off-by: Markus Armbruster --- blockdev.c | 7 +++++++ blockdev.h | 1 + 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/blockdev.c b/blockdev.c index f0bed2e..2aea768 100644 --- a/blockdev.c +++ b/blockdev.c @@ -130,6 +130,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; diff --git a/blockdev.h b/blockdev.h index 3b9c5fd..4009add 100644 --- a/blockdev.h +++ b/blockdev.h @@ -39,6 +39,7 @@ struct DriveInfo { }; DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit); +DriveInfo *drive_get_by_index(BlockInterfaceType type, int index); int drive_get_max_bus(BlockInterfaceType type); DriveInfo *drive_get_next(BlockInterfaceType type); void drive_uninit(DriveInfo *dinfo); -- 1.7.2.3