From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=43179 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pjvft-0002l2-R3 for qemu-devel@nongnu.org; Mon, 31 Jan 2011 10:28:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pjvfj-0003WH-9m for qemu-devel@nongnu.org; Mon, 31 Jan 2011 10:28:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:16082) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pjvfj-0003W0-0V for qemu-devel@nongnu.org; Mon, 31 Jan 2011 10:28:07 -0500 From: Kevin Wolf Date: Mon, 31 Jan 2011 16:29:13 +0100 Message-Id: <1296487756-12553-26-git-send-email-kwolf@redhat.com> In-Reply-To: <1296487756-12553-1-git-send-email-kwolf@redhat.com> References: <1296487756-12553-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 25/28] blockdev: New drive_get_by_index() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Markus Armbruster Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- blockdev.c | 7 +++++++ blockdev.h | 1 + 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/blockdev.c b/blockdev.c index a42c5e4..01228f6 100644 --- a/blockdev.c +++ b/blockdev.c @@ -136,6 +136,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 0c01e08..18278cc 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