From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38011) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJV3d-0007kP-S1 for qemu-devel@nongnu.org; Mon, 18 Aug 2014 18:05:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XJV3T-0006Oa-9V for qemu-devel@nongnu.org; Mon, 18 Aug 2014 18:05:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21349) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJV3S-0006My-VJ for qemu-devel@nongnu.org; Mon, 18 Aug 2014 18:05:31 -0400 From: John Snow Date: Mon, 18 Aug 2014 18:05:17 -0400 Message-Id: <1408399520-12778-2-git-send-email-jsnow@redhat.com> In-Reply-To: <1408399520-12778-1-git-send-email-jsnow@redhat.com> References: <1408399520-12778-1-git-send-email-jsnow@redhat.com> Subject: [Qemu-devel] [RFC 1/4] blockdev: add if_get_max_devs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, jsnow@redhat.com, armbru@redhat.com, stefanha@redhat.com, agraf@suse.de Signed-off-by: John Snow --- blockdev.c | 9 +++++++++ include/sysemu/blockdev.h | 1 + 2 files changed, 10 insertions(+) diff --git a/blockdev.c b/blockdev.c index 48bd9a3..58da77f 100644 --- a/blockdev.c +++ b/blockdev.c @@ -110,6 +110,15 @@ void blockdev_auto_del(BlockDriverState *bs) } } +int if_get_max_devs(BlockInterfaceType type) +{ + if (type >= IF_IDE && type < IF_COUNT) { + return if_max_devs[type]; + } + + return 0; +} + static int drive_index_to_bus_id(BlockInterfaceType type, int index) { int max_devs = if_max_devs[type]; diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h index 23a5d10..2420abd 100644 --- a/include/sysemu/blockdev.h +++ b/include/sysemu/blockdev.h @@ -48,6 +48,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); +int if_get_max_devs(BlockInterfaceType type); DriveInfo *drive_get_next(BlockInterfaceType type); DriveInfo *drive_get_by_blockdev(BlockDriverState *bs); -- 1.9.3