From 6dc1667d6881add34e9bad48ac2a848134ea8a6d Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 17 Jan 2019 13:36:46 -0600 Subject: nbd/client: Move export name into NBDExportInfo Refactor the 'name' parameter of nbd_receive_negotiate() from being a separate parameter into being part of the in-out 'info'. This also spills over to a simplification of nbd_opt_go(). The main driver for this refactoring is that an upcoming patch would like to add support to qemu-nbd to list information about all exports available on a server, where the name(s) will be provided by the server instead of the client. But another benefit is that we can now allow the client to explicitly specify the empty export name "" even when connecting to an oldstyle server (even if qemu is no longer such a server after commit 7f7dfe2a). Signed-off-by: Eric Blake Reviewed-by: Richard W.M. Jones Reviewed-by: Vladimir Sementsov-Ogievskiy Message-Id: <20190117193658.16413-10-eblake@redhat.com> --- block/nbd-client.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'block/nbd-client.c') diff --git a/block/nbd-client.c b/block/nbd-client.c index ef32075971..3309376bc1 100644 --- a/block/nbd-client.c +++ b/block/nbd-client.c @@ -999,10 +999,11 @@ int nbd_client_init(BlockDriverState *bs, client->info.structured_reply = true; client->info.base_allocation = true; client->info.x_dirty_bitmap = g_strdup(x_dirty_bitmap); - ret = nbd_receive_negotiate(QIO_CHANNEL(sioc), export, - tlscreds, hostname, + client->info.name = g_strdup(export ?: ""); + ret = nbd_receive_negotiate(QIO_CHANNEL(sioc), tlscreds, hostname, &client->ioc, &client->info, errp); g_free(client->info.x_dirty_bitmap); + g_free(client->info.name); if (ret < 0) { logout("Failed to negotiate with the NBD server\n"); return ret; -- cgit v1.2.3-55-g7522