block: Allow drivers to control protocol prefix at creation
This patch is pure refactoring: instead of hard-coding permission to use a protocol prefix when creating an image, the drivers can now pass in a parameter, comparable to what they could already do for opening a pre-existing image. This patch is purely mechanical (all drivers pass in true for now), but it will enable the next patch to cater to drivers that want to differ in behavior for the primary image vs. any secondary images that are opened at the same time as creating the primary image. Signed-off-by: Eric Blake <eblake@redhat.com> Message-ID: <20250915213919.3121401-5-eblake@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
67685a2331
commit
1bd7bfbc2b
12 changed files with 15 additions and 14 deletions
4
block.c
4
block.c
|
|
@ -693,7 +693,7 @@ out:
|
|||
}
|
||||
|
||||
int coroutine_fn bdrv_co_create_file(const char *filename, QemuOpts *opts,
|
||||
Error **errp)
|
||||
bool allow_protocol_prefix, Error **errp)
|
||||
{
|
||||
QemuOpts *protocol_opts;
|
||||
BlockDriver *drv;
|
||||
|
|
@ -702,7 +702,7 @@ int coroutine_fn bdrv_co_create_file(const char *filename, QemuOpts *opts,
|
|||
|
||||
GLOBAL_STATE_CODE();
|
||||
|
||||
drv = bdrv_find_protocol(filename, true, errp);
|
||||
drv = bdrv_find_protocol(filename, allow_protocol_prefix, errp);
|
||||
if (drv == NULL) {
|
||||
return -ENOENT;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue