On 01/11/2018 01:52 PM, Kevin Wolf wrote: > Currently, qcow2_create() only parses the QemuOpts and then calls > qcow2_create2() for the actual image creation, which includes both the > creation of the actual file on the file system and writing a valid empty > qcow2 image into that file. > > The plan is that qcow2_create2() becomes the function that implements > the functionality for a future 'blockdev-create' QMP command, which only > creates the qcow2 layer on an already opened file node. > > This is a first step towards that goal: Let's move out anything that > deals with the protocol layer from qcow2_create2() into qcow2_create(). > This means that qcow2_create2() doesn't need a file name any more. > > Signed-off-by: Kevin Wolf <kw...@redhat.com> > --- > block/qcow2.c | 64 > +++++++++++++++++++++++++++++++++++------------------------ > 1 file changed, 38 insertions(+), 26 deletions(-) > > diff --git a/block/qcow2.c b/block/qcow2.c > index 4348b2c0c5..b02bc39a01 100644 > --- a/block/qcow2.c > +++ b/block/qcow2.c > @@ -2690,7 +2690,7 @@ static uint64_t > qcow2_opt_get_refcount_bits_del(QemuOpts *opts, int version, > return refcount_bits; > } > > -static int qcow2_create2(const char *filename, int64_t total_size, > +static int qcow2_create2(BlockDriverState *bs, int64_t total_size,
Might be worth adding a high-level comment before the two functions to document the division of labor, rather than just the commit message. > @@ -2962,12 +2948,38 @@ static int qcow2_create(const char *filename, > QemuOpts *opts, Error **errp) > > refcount_order = ctz32(refcount_bits); > > - ret = qcow2_create2(filename, size, backing_file, backing_fmt, flags, > + /* Create and open the file (protocol layer */ Closing ) With the nit fixed, Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature