mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
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>
This commit is contained in:
parent
b6076afcab
commit
a6ff798966
5 changed files with 57 additions and 36 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue