|
|
22c213 |
From 25c528b30f8774f33e957d14060805398da524d9 Mon Sep 17 00:00:00 2001
|
|
|
22c213 |
From: Maxim Levitsky <mlevitsk@redhat.com>
|
|
|
22c213 |
Date: Thu, 26 Mar 2020 20:23:06 +0000
|
|
|
22c213 |
Subject: [PATCH 1/4] block: pass BlockDriver reference to the .bdrv_co_create
|
|
|
22c213 |
|
|
|
22c213 |
RH-Author: Maxim Levitsky <mlevitsk@redhat.com>
|
|
|
22c213 |
Message-id: <20200326202307.9264-2-mlevitsk@redhat.com>
|
|
|
22c213 |
Patchwork-id: 94447
|
|
|
22c213 |
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 1/2] block: pass BlockDriver reference to the .bdrv_co_create
|
|
|
22c213 |
Bugzilla: 1816007
|
|
|
22c213 |
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
|
|
22c213 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
22c213 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
22c213 |
|
|
|
22c213 |
This will allow the reuse of a single generic .bdrv_co_create
|
|
|
22c213 |
implementation for several drivers.
|
|
|
22c213 |
No functional changes.
|
|
|
22c213 |
|
|
|
22c213 |
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
|
|
22c213 |
Message-Id: <20200326011218.29230-2-mlevitsk@redhat.com>
|
|
|
22c213 |
Reviewed-by: Denis V. Lunev <den@openvz.org>
|
|
|
22c213 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
22c213 |
(cherry picked from commit b92902dfeaafbceaf744ab7473f2d070284f6172)
|
|
|
22c213 |
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
|
|
22c213 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
22c213 |
---
|
|
|
22c213 |
block.c | 3 ++-
|
|
|
22c213 |
block/crypto.c | 3 ++-
|
|
|
22c213 |
block/file-posix.c | 4 +++-
|
|
|
22c213 |
block/file-win32.c | 4 +++-
|
|
|
22c213 |
block/gluster.c | 3 ++-
|
|
|
22c213 |
block/nfs.c | 4 +++-
|
|
|
22c213 |
block/parallels.c | 3 ++-
|
|
|
22c213 |
block/qcow.c | 3 ++-
|
|
|
22c213 |
block/qcow2.c | 4 +++-
|
|
|
22c213 |
block/qed.c | 3 ++-
|
|
|
22c213 |
block/raw-format.c | 4 +++-
|
|
|
22c213 |
block/rbd.c | 3 ++-
|
|
|
22c213 |
block/sheepdog.c | 4 +++-
|
|
|
22c213 |
block/ssh.c | 4 +++-
|
|
|
22c213 |
block/vdi.c | 4 +++-
|
|
|
22c213 |
block/vhdx.c | 3 ++-
|
|
|
22c213 |
block/vmdk.c | 4 +++-
|
|
|
22c213 |
block/vpc.c | 6 ++++--
|
|
|
22c213 |
include/block/block_int.h | 3 ++-
|
|
|
22c213 |
19 files changed, 49 insertions(+), 20 deletions(-)
|
|
|
22c213 |
|
|
|
22c213 |
diff --git a/block.c b/block.c
|
|
|
22c213 |
index ec29b1e..f9a1c5b 100644
|
|
|
22c213 |
--- a/block.c
|
|
|
22c213 |
+++ b/block.c
|
|
|
22c213 |
@@ -482,7 +482,8 @@ static void coroutine_fn bdrv_create_co_entry(void *opaque)
|
|
|
22c213 |
CreateCo *cco = opaque;
|
|
|
22c213 |
assert(cco->drv);
|
|
|
22c213 |
|
|
|
22c213 |
- ret = cco->drv->bdrv_co_create_opts(cco->filename, cco->opts, &local_err);
|
|
|
22c213 |
+ ret = cco->drv->bdrv_co_create_opts(cco->drv,
|
|
|
22c213 |
+ cco->filename, cco->opts, &local_err);
|
|
|
22c213 |
error_propagate(&cco->err, local_err);
|
|
|
22c213 |
cco->ret = ret;
|
|
|
22c213 |
}
|
|
|
22c213 |
diff --git a/block/crypto.c b/block/crypto.c
|
|
|
22c213 |
index 2482383..970d463 100644
|
|
|
22c213 |
--- a/block/crypto.c
|
|
|
22c213 |
+++ b/block/crypto.c
|
|
|
22c213 |
@@ -539,7 +539,8 @@ fail:
|
|
|
22c213 |
return ret;
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
-static int coroutine_fn block_crypto_co_create_opts_luks(const char *filename,
|
|
|
22c213 |
+static int coroutine_fn block_crypto_co_create_opts_luks(BlockDriver *drv,
|
|
|
22c213 |
+ const char *filename,
|
|
|
22c213 |
QemuOpts *opts,
|
|
|
22c213 |
Error **errp)
|
|
|
22c213 |
{
|
|
|
22c213 |
diff --git a/block/file-posix.c b/block/file-posix.c
|
|
|
22c213 |
index fd29372..a2e0a74 100644
|
|
|
22c213 |
--- a/block/file-posix.c
|
|
|
22c213 |
+++ b/block/file-posix.c
|
|
|
22c213 |
@@ -2346,7 +2346,9 @@ out:
|
|
|
22c213 |
return result;
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
-static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts,
|
|
|
22c213 |
+static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
|
|
22c213 |
+ const char *filename,
|
|
|
22c213 |
+ QemuOpts *opts,
|
|
|
22c213 |
Error **errp)
|
|
|
22c213 |
{
|
|
|
22c213 |
BlockdevCreateOptions options;
|
|
|
22c213 |
diff --git a/block/file-win32.c b/block/file-win32.c
|
|
|
22c213 |
index 77e8ff7..1585983 100644
|
|
|
22c213 |
--- a/block/file-win32.c
|
|
|
22c213 |
+++ b/block/file-win32.c
|
|
|
22c213 |
@@ -588,7 +588,9 @@ static int raw_co_create(BlockdevCreateOptions *options, Error **errp)
|
|
|
22c213 |
return 0;
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
-static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts,
|
|
|
22c213 |
+static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
|
|
22c213 |
+ const char *filename,
|
|
|
22c213 |
+ QemuOpts *opts,
|
|
|
22c213 |
Error **errp)
|
|
|
22c213 |
{
|
|
|
22c213 |
BlockdevCreateOptions options;
|
|
|
22c213 |
diff --git a/block/gluster.c b/block/gluster.c
|
|
|
22c213 |
index 4fa4a77..0aa1f2c 100644
|
|
|
22c213 |
--- a/block/gluster.c
|
|
|
22c213 |
+++ b/block/gluster.c
|
|
|
22c213 |
@@ -1130,7 +1130,8 @@ out:
|
|
|
22c213 |
return ret;
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
-static int coroutine_fn qemu_gluster_co_create_opts(const char *filename,
|
|
|
22c213 |
+static int coroutine_fn qemu_gluster_co_create_opts(BlockDriver *drv,
|
|
|
22c213 |
+ const char *filename,
|
|
|
22c213 |
QemuOpts *opts,
|
|
|
22c213 |
Error **errp)
|
|
|
22c213 |
{
|
|
|
22c213 |
diff --git a/block/nfs.c b/block/nfs.c
|
|
|
22c213 |
index 9a6311e..cc2413d 100644
|
|
|
22c213 |
--- a/block/nfs.c
|
|
|
22c213 |
+++ b/block/nfs.c
|
|
|
22c213 |
@@ -662,7 +662,9 @@ out:
|
|
|
22c213 |
return ret;
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
-static int coroutine_fn nfs_file_co_create_opts(const char *url, QemuOpts *opts,
|
|
|
22c213 |
+static int coroutine_fn nfs_file_co_create_opts(BlockDriver *drv,
|
|
|
22c213 |
+ const char *url,
|
|
|
22c213 |
+ QemuOpts *opts,
|
|
|
22c213 |
Error **errp)
|
|
|
22c213 |
{
|
|
|
22c213 |
BlockdevCreateOptions *create_options;
|
|
|
22c213 |
diff --git a/block/parallels.c b/block/parallels.c
|
|
|
22c213 |
index 7a01997..6d4ed77 100644
|
|
|
22c213 |
--- a/block/parallels.c
|
|
|
22c213 |
+++ b/block/parallels.c
|
|
|
22c213 |
@@ -609,7 +609,8 @@ exit:
|
|
|
22c213 |
goto out;
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
-static int coroutine_fn parallels_co_create_opts(const char *filename,
|
|
|
22c213 |
+static int coroutine_fn parallels_co_create_opts(BlockDriver *drv,
|
|
|
22c213 |
+ const char *filename,
|
|
|
22c213 |
QemuOpts *opts,
|
|
|
22c213 |
Error **errp)
|
|
|
22c213 |
{
|
|
|
22c213 |
diff --git a/block/qcow.c b/block/qcow.c
|
|
|
22c213 |
index fce8989..8973e4e 100644
|
|
|
22c213 |
--- a/block/qcow.c
|
|
|
22c213 |
+++ b/block/qcow.c
|
|
|
22c213 |
@@ -934,7 +934,8 @@ exit:
|
|
|
22c213 |
return ret;
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
-static int coroutine_fn qcow_co_create_opts(const char *filename,
|
|
|
22c213 |
+static int coroutine_fn qcow_co_create_opts(BlockDriver *drv,
|
|
|
22c213 |
+ const char *filename,
|
|
|
22c213 |
QemuOpts *opts, Error **errp)
|
|
|
22c213 |
{
|
|
|
22c213 |
BlockdevCreateOptions *create_options = NULL;
|
|
|
22c213 |
diff --git a/block/qcow2.c b/block/qcow2.c
|
|
|
22c213 |
index 83b1fc0..71067c6 100644
|
|
|
22c213 |
--- a/block/qcow2.c
|
|
|
22c213 |
+++ b/block/qcow2.c
|
|
|
22c213 |
@@ -3558,7 +3558,9 @@ out:
|
|
|
22c213 |
return ret;
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
-static int coroutine_fn qcow2_co_create_opts(const char *filename, QemuOpts *opts,
|
|
|
22c213 |
+static int coroutine_fn qcow2_co_create_opts(BlockDriver *drv,
|
|
|
22c213 |
+ const char *filename,
|
|
|
22c213 |
+ QemuOpts *opts,
|
|
|
22c213 |
Error **errp)
|
|
|
22c213 |
{
|
|
|
22c213 |
BlockdevCreateOptions *create_options = NULL;
|
|
|
22c213 |
diff --git a/block/qed.c b/block/qed.c
|
|
|
22c213 |
index d8c4e5f..1af9b3c 100644
|
|
|
22c213 |
--- a/block/qed.c
|
|
|
22c213 |
+++ b/block/qed.c
|
|
|
22c213 |
@@ -720,7 +720,8 @@ out:
|
|
|
22c213 |
return ret;
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
-static int coroutine_fn bdrv_qed_co_create_opts(const char *filename,
|
|
|
22c213 |
+static int coroutine_fn bdrv_qed_co_create_opts(BlockDriver *drv,
|
|
|
22c213 |
+ const char *filename,
|
|
|
22c213 |
QemuOpts *opts,
|
|
|
22c213 |
Error **errp)
|
|
|
22c213 |
{
|
|
|
22c213 |
diff --git a/block/raw-format.c b/block/raw-format.c
|
|
|
22c213 |
index 3a76ec7..93b25e1 100644
|
|
|
22c213 |
--- a/block/raw-format.c
|
|
|
22c213 |
+++ b/block/raw-format.c
|
|
|
22c213 |
@@ -419,7 +419,9 @@ static int raw_has_zero_init_truncate(BlockDriverState *bs)
|
|
|
22c213 |
return bdrv_has_zero_init_truncate(bs->file->bs);
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
-static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts,
|
|
|
22c213 |
+static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
|
|
22c213 |
+ const char *filename,
|
|
|
22c213 |
+ QemuOpts *opts,
|
|
|
22c213 |
Error **errp)
|
|
|
22c213 |
{
|
|
|
22c213 |
return bdrv_create_file(filename, opts, errp);
|
|
|
22c213 |
diff --git a/block/rbd.c b/block/rbd.c
|
|
|
22c213 |
index 027cbcc..8847259 100644
|
|
|
22c213 |
--- a/block/rbd.c
|
|
|
22c213 |
+++ b/block/rbd.c
|
|
|
22c213 |
@@ -425,7 +425,8 @@ static int qemu_rbd_co_create(BlockdevCreateOptions *options, Error **errp)
|
|
|
22c213 |
return qemu_rbd_do_create(options, NULL, NULL, errp);
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
-static int coroutine_fn qemu_rbd_co_create_opts(const char *filename,
|
|
|
22c213 |
+static int coroutine_fn qemu_rbd_co_create_opts(BlockDriver *drv,
|
|
|
22c213 |
+ const char *filename,
|
|
|
22c213 |
QemuOpts *opts,
|
|
|
22c213 |
Error **errp)
|
|
|
22c213 |
{
|
|
|
22c213 |
diff --git a/block/sheepdog.c b/block/sheepdog.c
|
|
|
22c213 |
index cfa8433..a8a7e32 100644
|
|
|
22c213 |
--- a/block/sheepdog.c
|
|
|
22c213 |
+++ b/block/sheepdog.c
|
|
|
22c213 |
@@ -2157,7 +2157,9 @@ out:
|
|
|
22c213 |
return ret;
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
-static int coroutine_fn sd_co_create_opts(const char *filename, QemuOpts *opts,
|
|
|
22c213 |
+static int coroutine_fn sd_co_create_opts(BlockDriver *drv,
|
|
|
22c213 |
+ const char *filename,
|
|
|
22c213 |
+ QemuOpts *opts,
|
|
|
22c213 |
Error **errp)
|
|
|
22c213 |
{
|
|
|
22c213 |
BlockdevCreateOptions *create_options = NULL;
|
|
|
22c213 |
diff --git a/block/ssh.c b/block/ssh.c
|
|
|
22c213 |
index b4375cf..84e9282 100644
|
|
|
22c213 |
--- a/block/ssh.c
|
|
|
22c213 |
+++ b/block/ssh.c
|
|
|
22c213 |
@@ -963,7 +963,9 @@ fail:
|
|
|
22c213 |
return ret;
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
-static int coroutine_fn ssh_co_create_opts(const char *filename, QemuOpts *opts,
|
|
|
22c213 |
+static int coroutine_fn ssh_co_create_opts(BlockDriver *drv,
|
|
|
22c213 |
+ const char *filename,
|
|
|
22c213 |
+ QemuOpts *opts,
|
|
|
22c213 |
Error **errp)
|
|
|
22c213 |
{
|
|
|
22c213 |
BlockdevCreateOptions *create_options;
|
|
|
22c213 |
diff --git a/block/vdi.c b/block/vdi.c
|
|
|
22c213 |
index 0142da7..e1a11f2 100644
|
|
|
22c213 |
--- a/block/vdi.c
|
|
|
22c213 |
+++ b/block/vdi.c
|
|
|
22c213 |
@@ -896,7 +896,9 @@ static int coroutine_fn vdi_co_create(BlockdevCreateOptions *create_options,
|
|
|
22c213 |
return vdi_co_do_create(create_options, DEFAULT_CLUSTER_SIZE, errp);
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
-static int coroutine_fn vdi_co_create_opts(const char *filename, QemuOpts *opts,
|
|
|
22c213 |
+static int coroutine_fn vdi_co_create_opts(BlockDriver *drv,
|
|
|
22c213 |
+ const char *filename,
|
|
|
22c213 |
+ QemuOpts *opts,
|
|
|
22c213 |
Error **errp)
|
|
|
22c213 |
{
|
|
|
22c213 |
QDict *qdict = NULL;
|
|
|
22c213 |
diff --git a/block/vhdx.c b/block/vhdx.c
|
|
|
22c213 |
index f02d261..33e57cd 100644
|
|
|
22c213 |
--- a/block/vhdx.c
|
|
|
22c213 |
+++ b/block/vhdx.c
|
|
|
22c213 |
@@ -2046,7 +2046,8 @@ delete_and_exit:
|
|
|
22c213 |
return ret;
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
-static int coroutine_fn vhdx_co_create_opts(const char *filename,
|
|
|
22c213 |
+static int coroutine_fn vhdx_co_create_opts(BlockDriver *drv,
|
|
|
22c213 |
+ const char *filename,
|
|
|
22c213 |
QemuOpts *opts,
|
|
|
22c213 |
Error **errp)
|
|
|
22c213 |
{
|
|
|
22c213 |
diff --git a/block/vmdk.c b/block/vmdk.c
|
|
|
22c213 |
index 20e909d..eb726f2 100644
|
|
|
22c213 |
--- a/block/vmdk.c
|
|
|
22c213 |
+++ b/block/vmdk.c
|
|
|
22c213 |
@@ -2588,7 +2588,9 @@ exit:
|
|
|
22c213 |
return blk;
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
-static int coroutine_fn vmdk_co_create_opts(const char *filename, QemuOpts *opts,
|
|
|
22c213 |
+static int coroutine_fn vmdk_co_create_opts(BlockDriver *drv,
|
|
|
22c213 |
+ const char *filename,
|
|
|
22c213 |
+ QemuOpts *opts,
|
|
|
22c213 |
Error **errp)
|
|
|
22c213 |
{
|
|
|
22c213 |
Error *local_err = NULL;
|
|
|
22c213 |
diff --git a/block/vpc.c b/block/vpc.c
|
|
|
22c213 |
index a655502..6df75e2 100644
|
|
|
22c213 |
--- a/block/vpc.c
|
|
|
22c213 |
+++ b/block/vpc.c
|
|
|
22c213 |
@@ -1089,8 +1089,10 @@ out:
|
|
|
22c213 |
return ret;
|
|
|
22c213 |
}
|
|
|
22c213 |
|
|
|
22c213 |
-static int coroutine_fn vpc_co_create_opts(const char *filename,
|
|
|
22c213 |
- QemuOpts *opts, Error **errp)
|
|
|
22c213 |
+static int coroutine_fn vpc_co_create_opts(BlockDriver *drv,
|
|
|
22c213 |
+ const char *filename,
|
|
|
22c213 |
+ QemuOpts *opts,
|
|
|
22c213 |
+ Error **errp)
|
|
|
22c213 |
{
|
|
|
22c213 |
BlockdevCreateOptions *create_options = NULL;
|
|
|
22c213 |
QDict *qdict;
|
|
|
22c213 |
diff --git a/include/block/block_int.h b/include/block/block_int.h
|
|
|
22c213 |
index 96e327b..7ff81be 100644
|
|
|
22c213 |
--- a/include/block/block_int.h
|
|
|
22c213 |
+++ b/include/block/block_int.h
|
|
|
22c213 |
@@ -136,7 +136,8 @@ struct BlockDriver {
|
|
|
22c213 |
void (*bdrv_close)(BlockDriverState *bs);
|
|
|
22c213 |
int coroutine_fn (*bdrv_co_create)(BlockdevCreateOptions *opts,
|
|
|
22c213 |
Error **errp);
|
|
|
22c213 |
- int coroutine_fn (*bdrv_co_create_opts)(const char *filename,
|
|
|
22c213 |
+ int coroutine_fn (*bdrv_co_create_opts)(BlockDriver *drv,
|
|
|
22c213 |
+ const char *filename,
|
|
|
22c213 |
QemuOpts *opts,
|
|
|
22c213 |
Error **errp);
|
|
|
22c213 |
int (*bdrv_make_empty)(BlockDriverState *bs);
|
|
|
22c213 |
--
|
|
|
22c213 |
1.8.3.1
|
|
|
22c213 |
|