diff options
author | Kevin Wolf <kwolf@redhat.com> | 2020-09-24 17:27:02 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2020-10-02 15:46:40 +0200 |
commit | a6ff7989662d659aed0888670e77e68cb8c9bd81 (patch) | |
tree | 67af6fa4a55dce3eb78a40f53433ffc49a38e59b /include/block/export.h | |
parent | b6076afcabc7a3947d0b212b956f4575e6795c56 (diff) |
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>
Diffstat (limited to 'include/block/export.h')
-rw-r--r-- | include/block/export.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/block/export.h b/include/block/export.h index e6f96f4e1e..cf9b1c9dad 100644 --- a/include/block/export.h +++ b/include/block/export.h @@ -22,8 +22,14 @@ typedef struct BlockExportDriver { /* The export type that this driver services */ BlockExportType type; + /* + * The size of the driver-specific state that contains BlockExport as its + * first field. + */ + size_t instance_size; + /* Creates and starts a new block export */ - BlockExport *(*create)(BlockExportOptions *, Error **); + int (*create)(BlockExport *, BlockExportOptions *, Error **); /* * Frees a removed block export. This function is only called after all |