We are going to add one more option of enum type. Let's refactor option
parsing so that we can simply work with BlockdevOptionsCbw object.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@openvz.org>
---
block/copy-before-write.c | 55 ++++++++++++++++++++-------------------
1 file changed, 28 insertions(+), 27 deletions(-)
diff --git a/block/copy-before-write.c b/block/copy-before-write.c
index a8a06fdc09..6877ff893a 100644
--- a/block/copy-before-write.c
+++ b/block/copy-before-write.c
@@ -376,6 +365,14 @@ static int cbw_open(BlockDriverState *bs, QDict *options,
int flags,
BDRVCopyBeforeWriteState *s = bs->opaque;
BdrvDirtyBitmap *bitmap = NULL;
int64_t cluster_size;
+ g_autoptr(BlockdevOptions) full_opts = NULL;
+ BlockdevOptionsCbw *opts;
+
+ full_opts = cbw_parse_options(options, errp);
+ if (!full_opts) {
+ return -EINVAL;
+ }
+ opts = &full_opts->u.copy_before_write;