aboutsummaryrefslogtreecommitdiff
path: root/qemu-io.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2009-07-15 23:11:21 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-07-16 17:28:50 -0500
commit1db6947dafa7f33a309130ccbf461748adac6da0 (patch)
treeee4e04904ede795295071cb8e74e03336594c292 /qemu-io.c
parent087389847207063df194a1b85ff907f54dd51d0a (diff)
qemu-io: use BDRV_O_FILE to implement the growable open option
Instead of doing our own check for protocols which fails because raw isn't formally a protocol but special cased in find_protocol specify the BDRV_O_FILE option to use the same code as bdrv_file_open does. While we're at it also add the missing documentation for -g to the main qemu-io help string. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qemu-io.c')
-rw-r--r--qemu-io.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/qemu-io.c b/qemu-io.c
index 1bf94e1cda..6c35a071c4 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -1237,23 +1237,19 @@ static int openfile(char *name, int flags, int growable)
if (!bs)
return 1;
+ if (growable) {
+ flags |= BDRV_O_FILE;
+ }
+
if (bdrv_open(bs, name, flags) == -1) {
fprintf(stderr, "%s: can't open device %s\n", progname, name);
bs = NULL;
return 1;
}
-
if (growable) {
- if (!bs->drv || !bs->drv->protocol_name) {
- fprintf(stderr,
- "%s: only protocols can be opened growable\n",
- progname);
- return 1;
- }
bs->growable = 1;
}
-
return 0;
}
@@ -1365,6 +1361,7 @@ static void usage(const char *name)
" -r, --read-only export read-only\n"
" -s, --snapshot use snapshot file\n"
" -n, --nocache disable host cache\n"
+" -g, --growable allow file to grow (only applies to protocols)\n"
" -m, --misalign misalign allocations for O_DIRECT\n"
" -h, --help display this help and exit\n"
" -V, --version output version information and exit\n"