block/export: Allocate BlockExport in blk_exp_add()
commita6ff7989662d659aed0888670e77e68cb8c9bd81
authorKevin Wolf <kwolf@redhat.com>
Thu, 24 Sep 2020 15:27:02 +0000 (24 17:27 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 2 Oct 2020 13:46:40 +0000 (2 15:46 +0200)
tree67af6fa4a55dce3eb78a40f53433ffc49a38e59b
parentb6076afcabc7a3947d0b212b956f4575e6795c56
block/export: Allocate BlockExport in blk_exp_add()

Instead of letting the driver allocate and return the BlockExport
object, allocate it already in blk_exp_add() and pass it. This allows us
to initialise the generic part before calling into the driver so that
the driver can just use these values instead of having to parse the
options a second time.

For symmetry, move freeing the BlockExport to blk_exp_unref().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200924152717.287415-17-kwolf@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/export/export.c
blockdev-nbd.c
include/block/export.h
include/block/nbd.h
nbd/server.c