aboutsummaryrefslogtreecommitdiff
path: root/nbd
diff options
context:
space:
mode:
Diffstat (limited to 'nbd')
-rw-r--r--nbd/server.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/nbd/server.c b/nbd/server.c
index bd53f7baea..f5af93c253 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -18,6 +18,8 @@
*/
#include "qemu/osdep.h"
+
+#include "block/export.h"
#include "qapi/error.h"
#include "qemu/queue.h"
#include "trace.h"
@@ -80,6 +82,7 @@ struct NBDRequestData {
};
struct NBDExport {
+ BlockExport common;
int refcount;
void (*close)(NBDExport *exp);
@@ -1512,10 +1515,15 @@ NBDExport *nbd_export_new(BlockDriverState *bs, uint64_t dev_offset,
{
AioContext *ctx;
BlockBackend *blk;
- NBDExport *exp = g_new0(NBDExport, 1);
+ NBDExport *exp;
uint64_t perm;
int ret;
+ exp = g_new0(NBDExport, 1);
+ exp->common = (BlockExport) {
+ .drv = &blk_exp_nbd,
+ };
+
/*
* NBD exports are used for non-shared storage migration. Make sure
* that BDRV_O_INACTIVE is cleared and the image is ready for write
@@ -1731,6 +1739,11 @@ void nbd_export_put(NBDExport *exp)
}
}
+const BlockExportDriver blk_exp_nbd = {
+ .type = BLOCK_EXPORT_TYPE_NBD,
+ .create = nbd_export_create,
+};
+
void nbd_export_close_all(void)
{
NBDExport *exp, *next;