nbd: add reference counting to NBDExport

We will use a similar two-phase destruction for NBDExport, so we need
each NBDClient to add a reference to NBDExport.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2012-09-18 13:26:25 +02:00
parent ff2b68aa70
commit 2c8d9f0655
3 changed files with 35 additions and 6 deletions

2
nbd.h
View file

@ -81,6 +81,8 @@ typedef struct NBDClient NBDClient;
NBDExport *nbd_export_new(BlockDriverState *bs, off_t dev_offset,
off_t size, uint32_t nbdflags);
void nbd_export_close(NBDExport *exp);
void nbd_export_get(NBDExport *exp);
void nbd_export_put(NBDExport *exp);
NBDClient *nbd_client_new(NBDExport *exp, int csock,
void (*close)(NBDClient *));