aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/nbd-client.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/block/nbd-client.c b/block/nbd-client.c
index 80dc8cf..d7d8829 100644
--- a/block/nbd-client.c
+++ b/block/nbd-client.c
@@ -1012,13 +1012,13 @@ static QIOChannelSocket *nbd_establish_connection(SocketAddress *saddr,
return sioc;
}
-int nbd_client_init(BlockDriverState *bs,
- SocketAddress *saddr,
- const char *export,
- QCryptoTLSCreds *tlscreds,
- const char *hostname,
- const char *x_dirty_bitmap,
- Error **errp)
+static int nbd_client_connect(BlockDriverState *bs,
+ SocketAddress *saddr,
+ const char *export,
+ QCryptoTLSCreds *tlscreds,
+ const char *hostname,
+ const char *x_dirty_bitmap,
+ Error **errp)
{
NBDClientSession *client = nbd_get_client_session(bs);
int ret;
@@ -1071,8 +1071,6 @@ int nbd_client_init(BlockDriverState *bs,
bs->supported_zero_flags |= BDRV_REQ_MAY_UNMAP;
}
- qemu_co_mutex_init(&client->send_mutex);
- qemu_co_queue_init(&client->free_sema);
client->sioc = sioc;
if (!client->ioc) {
@@ -1105,3 +1103,20 @@ int nbd_client_init(BlockDriverState *bs,
return ret;
}
}
+
+int nbd_client_init(BlockDriverState *bs,
+ SocketAddress *saddr,
+ const char *export,
+ QCryptoTLSCreds *tlscreds,
+ const char *hostname,
+ const char *x_dirty_bitmap,
+ Error **errp)
+{
+ NBDClientSession *client = nbd_get_client_session(bs);
+
+ qemu_co_mutex_init(&client->send_mutex);
+ qemu_co_queue_init(&client->free_sema);
+
+ return nbd_client_connect(bs, saddr, export, tlscreds, hostname,
+ x_dirty_bitmap, errp);
+}