block: Use child_of_bds in remaining places
Replace child_file by child_of_bds in all remaining places (excluding tests). Signed-off-by: Max Reitz <mreitz@redhat.com> Message-Id: <20200513110544.176672-28-mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
b3af2af43b
commit
58944401d6
3
block.c
3
block.c
@ -3406,7 +3406,8 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
|
|||||||
BlockDriverState *file_bs;
|
BlockDriverState *file_bs;
|
||||||
|
|
||||||
file_bs = bdrv_open_child_bs(filename, options, "file", bs,
|
file_bs = bdrv_open_child_bs(filename, options, "file", bs,
|
||||||
&child_file, 0, true, &local_err);
|
&child_of_bds, BDRV_CHILD_IMAGE,
|
||||||
|
true, &local_err);
|
||||||
if (local_err) {
|
if (local_err) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -215,8 +215,8 @@ BlockDriverState *bdrv_backup_top_append(BlockDriverState *source,
|
|||||||
source->supported_zero_flags);
|
source->supported_zero_flags);
|
||||||
|
|
||||||
bdrv_ref(target);
|
bdrv_ref(target);
|
||||||
state->target = bdrv_attach_child(top, target, "target", &child_file, 0,
|
state->target = bdrv_attach_child(top, target, "target", &child_of_bds,
|
||||||
errp);
|
BDRV_CHILD_DATA, errp);
|
||||||
if (!state->target) {
|
if (!state->target) {
|
||||||
bdrv_unref(target);
|
bdrv_unref(target);
|
||||||
bdrv_unref(top);
|
bdrv_unref(top);
|
||||||
|
@ -167,8 +167,8 @@ static int blk_log_writes_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Open the log file */
|
/* Open the log file */
|
||||||
s->log_file = bdrv_open_child(NULL, options, "log", bs, &child_file, 0,
|
s->log_file = bdrv_open_child(NULL, options, "log", bs, &child_of_bds,
|
||||||
false, &local_err);
|
BDRV_CHILD_METADATA, false, &local_err);
|
||||||
if (local_err) {
|
if (local_err) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
|
@ -441,6 +441,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
BDRVRawState *s = bs->opaque;
|
BDRVRawState *s = bs->opaque;
|
||||||
bool has_size;
|
bool has_size;
|
||||||
uint64_t offset, size;
|
uint64_t offset, size;
|
||||||
|
BdrvChildRole file_role;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = raw_read_options(options, &offset, &has_size, &size, errp);
|
ret = raw_read_options(options, &offset, &has_size, &size, errp);
|
||||||
@ -448,8 +449,18 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, 0,
|
/*
|
||||||
false, errp);
|
* Without offset and a size limit, this driver behaves very much
|
||||||
|
* like a filter. With any such limit, it does not.
|
||||||
|
*/
|
||||||
|
if (offset || has_size) {
|
||||||
|
file_role = BDRV_CHILD_DATA | BDRV_CHILD_PRIMARY;
|
||||||
|
} else {
|
||||||
|
file_role = BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY;
|
||||||
|
}
|
||||||
|
|
||||||
|
bs->file = bdrv_open_child(NULL, options, "file", bs, &child_of_bds,
|
||||||
|
file_role, false, errp);
|
||||||
if (!bs->file) {
|
if (!bs->file) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user