Commit 1db6947d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Anthony Liguori
Browse files

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: default avatarChristoph Hellwig <>
Signed-off-by: default avatarAnthony Liguori <>
parent 08738984
......@@ -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) {
"%s: only protocols can be opened growable\n",
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"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment