summaryrefslogtreecommitdiffstats
path: root/block.c
diff options
context:
space:
mode:
authorBenoƮt Canet <benoit@irqsave.net>2013-09-24 17:07:04 +0200
committerKevin Wolf <kwolf@redhat.com>2013-09-25 16:21:28 +0200
commit030be32184034261da14693b69e9582f6fe4af9d (patch)
treef4e1df2addee8730fa499e883690224d01d72113 /block.c
parent2fe2e2907163f6d86b6bbced776ec8f9319ca83f (diff)
downloadhqemu-030be32184034261da14693b69e9582f6fe4af9d.zip
hqemu-030be32184034261da14693b69e9582f6fe4af9d.tar.gz
block: introduce BlockDriver.bdrv_needs_filename to enable some drivers.
Some drivers will have driver specifics options but no filename. This new bool allow the block layer to treat them correctly. The .bdrv_needs_filename is set in drivers not having .bdrv_parse_filename and not having .bdrv_open. The first exception to this rule will be the quorum driver. Signed-off-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/block.c b/block.c
index 3366017..4a98250 100644
--- a/block.c
+++ b/block.c
@@ -792,7 +792,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
/* Open the image, either directly or using a protocol */
if (drv->bdrv_file_open) {
assert(file == NULL);
- assert(drv->bdrv_parse_filename || filename != NULL);
+ assert(!drv->bdrv_needs_filename || filename != NULL);
ret = drv->bdrv_file_open(bs, options, open_flags, &local_err);
} else {
if (file == NULL) {
@@ -911,7 +911,7 @@ int bdrv_file_open(BlockDriverState **pbs, const char *filename,
goto fail;
}
qdict_del(options, "filename");
- } else if (!drv->bdrv_parse_filename && !filename) {
+ } else if (drv->bdrv_needs_filename && !filename) {
error_setg(errp, "The '%s' block driver requires a file name",
drv->format_name);
ret = -EINVAL;
OpenPOWER on IntegriCloud