mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
block/export: Move refcount from NBDExport to BlockExport
Having a refcount makes sense for all types of block exports. It is also a prerequisite for keeping a list of all exports at the BlockExport level. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-Id: <20200924152717.287415-14-kwolf@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
dbc9e94a23
commit
c69de1bef5
5 changed files with 64 additions and 43 deletions
|
@ -24,12 +24,27 @@ typedef struct BlockExportDriver {
|
|||
|
||||
/* Creates and starts a new block export */
|
||||
BlockExport *(*create)(BlockExportOptions *, Error **);
|
||||
|
||||
/*
|
||||
* Frees a removed block export. This function is only called after all
|
||||
* references have been dropped.
|
||||
*/
|
||||
void (*delete)(BlockExport *);
|
||||
} BlockExportDriver;
|
||||
|
||||
struct BlockExport {
|
||||
const BlockExportDriver *drv;
|
||||
|
||||
/*
|
||||
* Reference count for this block export. This includes strong references
|
||||
* both from the owner (qemu-nbd or the monitor) and clients connected to
|
||||
* the export.
|
||||
*/
|
||||
int refcount;
|
||||
};
|
||||
|
||||
BlockExport *blk_exp_add(BlockExportOptions *export, Error **errp);
|
||||
void blk_exp_ref(BlockExport *exp);
|
||||
void blk_exp_unref(BlockExport *exp);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue