[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 14/22] blockdev: Move "file" to legacy_opts
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v6 14/22] blockdev: Move "file" to legacy_opts |
Date: |
Thu, 19 Dec 2013 20:47:15 +0100 |
Specifying the image filename through the "file" option is a legacy
option and should not be supported by blockdev-add (in that case, giving
a string for "file" references an existing block device).
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
---
blockdev.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 6a85961..d78961d 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -307,12 +307,11 @@ static bool check_throttle_config(ThrottleConfig *cfg,
Error **errp)
typedef enum { MEDIA_DISK, MEDIA_CDROM } DriveMediaType;
/* Takes the ownership of bs_opts */
-static DriveInfo *blockdev_init(QDict *bs_opts,
+static DriveInfo *blockdev_init(const char *file, QDict *bs_opts,
BlockInterfaceType type,
Error **errp)
{
const char *buf;
- const char *file = NULL;
const char *serial;
int ro = 0;
int bdrv_flags = 0;
@@ -354,7 +353,6 @@ static DriveInfo *blockdev_init(QDict *bs_opts,
ro = qemu_opt_get_bool(opts, "read-only", 0);
copy_on_read = qemu_opt_get_bool(opts, "copy-on-read", false);
- file = qemu_opt_get(opts, "file");
serial = qemu_opt_get(opts, "serial");
if ((buf = qemu_opt_get(opts, "discard")) != NULL) {
@@ -599,6 +597,10 @@ QemuOptsList qemu_legacy_drive_opts = {
.name = "addr",
.type = QEMU_OPT_STRING,
.help = "pci address (virtio only)",
+ },{
+ .name = "file",
+ .type = QEMU_OPT_STRING,
+ .help = "file name",
},
/* Options that are passed on, but have special semantics with -drive
*/
@@ -629,6 +631,7 @@ DriveInfo *drive_init(QemuOpts *all_opts,
BlockInterfaceType block_default_type)
const char *devaddr;
bool read_only = false;
bool copy_on_read;
+ const char *filename;
Error *local_err = NULL;
/* Change legacy command line options into QMP ones */
@@ -865,8 +868,10 @@ DriveInfo *drive_init(QemuOpts *all_opts,
BlockInterfaceType block_default_type)
}
}
+ filename = qemu_opt_get(legacy_opts, "file");
+
/* Actual block device init: Functionality shared with blockdev-add */
- dinfo = blockdev_init(bs_opts, type, &local_err);
+ dinfo = blockdev_init(filename, bs_opts, type, &local_err);
if (dinfo == NULL) {
if (error_is_set(&local_err)) {
qerror_report_err(local_err);
@@ -2203,7 +2208,7 @@ void qmp_blockdev_add(BlockdevOptions *options, Error
**errp)
qdict_flatten(qdict);
- blockdev_init(qdict, IF_NONE, &local_err);
+ blockdev_init(NULL, qdict, IF_NONE, &local_err);
if (error_is_set(&local_err)) {
error_propagate(errp, local_err);
goto fail;
@@ -2244,10 +2249,6 @@ QemuOptsList qemu_common_drive_opts = {
.type = QEMU_OPT_BOOL,
.help = "enable/disable snapshot mode",
},{
- .name = "file",
- .type = QEMU_OPT_STRING,
- .help = "disk image",
- },{
.name = "discard",
.type = QEMU_OPT_STRING,
.help = "discard operation (ignore/off, unmap/on)",
--
1.8.5.1
- [Qemu-devel] [PATCH v6 04/22] qapi: extend qdict_flatten() for QLists, (continued)
- [Qemu-devel] [PATCH v6 04/22] qapi: extend qdict_flatten() for QLists, Max Reitz, 2013/12/19
- [Qemu-devel] [PATCH v6 05/22] qemu-option: Add qemu_config_parse_qdict(), Max Reitz, 2013/12/19
- [Qemu-devel] [PATCH v6 06/22] blkdebug: Always call read_config(), Max Reitz, 2013/12/19
- [Qemu-devel] [PATCH v6 07/22] blkdebug: Use command-line in read_config(), Max Reitz, 2013/12/19
- [Qemu-devel] [PATCH v6 08/22] block: Allow reference for bdrv_file_open(), Max Reitz, 2013/12/19
- [Qemu-devel] [PATCH v6 09/22] block: Pass reference to bdrv_file_open(), Max Reitz, 2013/12/19
- [Qemu-devel] [PATCH v6 10/22] block: Allow block devices without files, Max Reitz, 2013/12/19
- [Qemu-devel] [PATCH v6 11/22] block: Add bdrv_open_image(), Max Reitz, 2013/12/19
- [Qemu-devel] [PATCH v6 12/22] block: Use bdrv_open_image() in bdrv_open(), Max Reitz, 2013/12/19
- [Qemu-devel] [PATCH v6 13/22] block: Allow recursive "file"s, Max Reitz, 2013/12/19
- [Qemu-devel] [PATCH v6 14/22] blockdev: Move "file" to legacy_opts,
Max Reitz <=
- [Qemu-devel] [PATCH v6 15/22] blkdebug: Allow command-line file configuration, Max Reitz, 2013/12/19
- [Qemu-devel] [PATCH v6 16/22] blkverify: Allow command-line configuration, Max Reitz, 2013/12/19
- [Qemu-devel] [PATCH v6 18/22] qapi: Add "errno" to the list of polluted words, Max Reitz, 2013/12/19
- [Qemu-devel] [PATCH v6 17/22] blkverify: Don't require protocol filename, Max Reitz, 2013/12/19
- [Qemu-devel] [PATCH v6 19/22] qapi: QMP interface for blkdebug and blkverify, Max Reitz, 2013/12/19
- [Qemu-devel] [PATCH v6 20/22] qemu-io: Make filename optional, Max Reitz, 2013/12/19
- [Qemu-devel] [PATCH v6 21/22] iotests: Test new blkdebug/blkverify interface, Max Reitz, 2013/12/19
- [Qemu-devel] [PATCH v6 22/22] iotests: Test file format nesting, Max Reitz, 2013/12/19