diff options
author | Max Reitz <mreitz@redhat.com> | 2016-05-17 16:41:31 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-05-25 19:04:10 +0200 |
commit | 5b3639371c3e220b41cd2eae8c34c49ad38ef527 (patch) | |
tree | 0f46cc379f81b2ed90b97a36e3fd1b6687e6958a /block/vvfat.c | |
parent | 9bddf759790cf1b9c46889f8f8370c90e6ca7610 (diff) | |
download | qemu-5b3639371c3e220b41cd2eae8c34c49ad38ef527.zip qemu-5b3639371c3e220b41cd2eae8c34c49ad38ef527.tar.gz qemu-5b3639371c3e220b41cd2eae8c34c49ad38ef527.tar.bz2 |
block: Make bdrv_open() return a BDS
There are no callers to bdrv_open() or bdrv_open_inherit() left that
pass a pointer to a non-NULL BDS pointer as the first argument of these
functions, so we can finally drop that parameter and just make them
return the new BDS.
Generally, the following pattern is applied:
bs = NULL;
ret = bdrv_open(&bs, ..., &local_err);
if (ret < 0) {
error_propagate(errp, local_err);
...
}
by
bs = bdrv_open(..., errp);
if (!bs) {
ret = -EINVAL;
...
}
Of course, there are only a few instances where the pattern is really
pure.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/vvfat.c')
-rw-r--r-- | block/vvfat.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/block/vvfat.c b/block/vvfat.c index 3e484a1..a39dbe6 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -2998,12 +2998,12 @@ static int enable_write_target(BDRVVVFATState *s, Error **errp) goto err; } - s->qcow = NULL; options = qdict_new(); qdict_put(options, "driver", qstring_from_str("qcow")); - ret = bdrv_open(&s->qcow, s->qcow_filename, NULL, options, - BDRV_O_RDWR | BDRV_O_NO_FLUSH, errp); - if (ret < 0) { + s->qcow = bdrv_open(s->qcow_filename, NULL, options, + BDRV_O_RDWR | BDRV_O_NO_FLUSH, errp); + if (!s->qcow) { + ret = -EINVAL; goto err; } |