[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v7 20/24] qemu-io: Make filename optional
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v7 20/24] qemu-io: Make filename optional |
Date: |
Fri, 20 Dec 2013 19:28:20 +0100 |
Giving a filename is actually not essential, since it can be specified
through the options as well - on the contrary: Sometimes a filename must
not be given.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
---
qemu-io.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/qemu-io.c b/qemu-io.c
index f180813..a0e0e22 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -160,11 +160,13 @@ static int open_f(BlockDriverState *bs, int argc, char
**argv)
flags |= BDRV_O_RDWR;
}
- if (optind != argc - 1) {
+ if (optind == argc - 1) {
+ return openfile(argv[optind], flags, growable, opts);
+ } else if (optind == argc) {
+ return openfile(NULL, flags, growable, opts);
+ } else {
return qemuio_command_usage(&open_cmd);
}
-
- return openfile(argv[optind], flags, growable, opts);
}
static int quit_f(BlockDriverState *bs, int argc, char **argv)
--
1.8.5.1
- [Qemu-devel] [PATCH v7 10/24] block: Allow block devices without files, (continued)
- [Qemu-devel] [PATCH v7 10/24] block: Allow block devices without files, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 11/24] block: Add bdrv_open_image(), Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 12/24] block: Use bdrv_open_image() in bdrv_open(), Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 13/24] block: Allow recursive "file"s, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 15/24] blkdebug: Allow command-line file configuration, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 14/24] blockdev: Move "file" to legacy_opts, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 16/24] blkverify: Allow command-line configuration, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 17/24] blkverify: Don't require protocol filename, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 18/24] qapi: Add "errno" to the list of polluted words, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 19/24] qapi: QMP interface for blkdebug and blkverify, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 20/24] qemu-io: Make filename optional,
Max Reitz <=
- [Qemu-devel] [PATCH v7 21/24] tests: Add test for qdict_array_split(), Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 22/24] tests: Add test for qdict_flatten(), Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 23/24] iotests: Test new blkdebug/blkverify interface, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 24/24] iotests: Test file format nesting, Max Reitz, 2013/12/20