From 13839974d14701626a2f9dcc5f8cf65783d51c11 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 28 Jan 2011 11:21:37 +0100 Subject: blockdev: New drive_get_next(), replacing qdev_init_bdrv() qdev_init_bdrv() doesn't belong into qdev.c; it's about drives, not qdevs. Rename to drive_get_next, move to blockdev.c, drop the bogus DeviceState argument, and return DriveInfo instead of BlockDriverState. Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- blockdev.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'blockdev.c') diff --git a/blockdev.c b/blockdev.c index e48d33d..699f312 100644 --- a/blockdev.c +++ b/blockdev.c @@ -93,6 +93,16 @@ int drive_get_max_bus(BlockInterfaceType type) return max_bus; } +/* Get a block device. This should only be used for single-drive devices + (e.g. SD/Floppy/MTD). Multi-disk devices (scsi/ide) should use the + appropriate bus. */ +DriveInfo *drive_get_next(BlockInterfaceType type) +{ + static int next_block_unit[IF_COUNT]; + + return drive_get(type, 0, next_block_unit[type]++); +} + DriveInfo *drive_get_by_blockdev(BlockDriverState *bs) { DriveInfo *dinfo; -- cgit v1.1