From 2292ddaeab3467c68efd9e07e17ca0c9fc510fdc Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 28 Jan 2011 11:21:41 +0100 Subject: blockdev: Make drive_add() take explicit type, index parameters Before, type & index were hidden in printf-like fmt, ... parameters, which get expanded into an option string. Rather inconvenient for uses later in this series. New IF_DEFAULT to ask for the machine's default interface. Before, that was done by having no option "if" in the option string. Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- blockdev.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'blockdev.h') diff --git a/blockdev.h b/blockdev.h index cf8fc01..0c01e08 100644 --- a/blockdev.h +++ b/blockdev.h @@ -19,6 +19,7 @@ void blockdev_auto_del(BlockDriverState *bs); #define BLOCK_SERIAL_STRLEN 20 typedef enum { + IF_DEFAULT = -1, /* for use with drive_add() only */ IF_NONE, IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD, IF_VIRTIO, IF_XEN, IF_COUNT @@ -43,7 +44,12 @@ DriveInfo *drive_get_next(BlockInterfaceType type); void drive_uninit(DriveInfo *dinfo); DriveInfo *drive_get_by_blockdev(BlockDriverState *bs); -QemuOpts *drive_add(const char *file, const char *fmt, ...) GCC_FMT_ATTR(2, 3); +QemuOpts *drive_def(const char *optstr); +QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file, + const char *fmt, ...) /*GCC_FMT_ATTR(4, 5)*/; + /* GCC_FMT_ATTR() commented out to avoid the (pretty useless) + * "zero-length gnu_printf format string" warning we insist to + * enable */ DriveInfo *drive_init(QemuOpts *arg, int default_to_scsi, int *fatal_error); /* device-hotplug */ -- cgit v1.1