From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRKJB-0003bG-9n for qemu-devel@nongnu.org; Thu, 04 Feb 2016 08:50:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRKJA-0003I4-Gf for qemu-devel@nongnu.org; Thu, 04 Feb 2016 08:50:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49999) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRKJA-0003HM-9a for qemu-devel@nongnu.org; Thu, 04 Feb 2016 08:50:52 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id DE7907AEA1 for ; Thu, 4 Feb 2016 13:50:51 +0000 (UTC) From: "Daniel P. Berrange" Date: Thu, 4 Feb 2016 13:50:18 +0000 Message-Id: <1454593822-7321-13-git-send-email-berrange@redhat.com> In-Reply-To: <1454593822-7321-1-git-send-email-berrange@redhat.com> References: <1454593822-7321-1-git-send-email-berrange@redhat.com> Subject: [Qemu-devel] [PATCH v5 12/16] nbd: use "" as a default export name if none provided List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , Max Reitz If the user does not provide an export name and the server is running the new style protocol, where export names are mandatory, use "" as the default export name if the user has not specified any. "" is defined in the NBD protocol as the default name to use in such scenarios. Signed-off-by: Daniel P. Berrange --- nbd/client.c | 4 ++-- nbd/server.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/nbd/client.c b/nbd/client.c index e91821a..89e172e 100644 --- a/nbd/client.c +++ b/nbd/client.c @@ -314,8 +314,8 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint32_t *flags, goto fail; } if (!name) { - error_setg(errp, "Server requires an export name"); - goto fail; + TRACE("Using default NBD export name \"\""); + name = ""; } if (fixedNewStyle) { /* Check our desired export is present in the diff --git a/nbd/server.c b/nbd/server.c index 8bc083e..270cf39 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -219,6 +219,7 @@ static int nbd_negotiate_send_rep_list(QIOChannel *ioc, NBDExport *exp) uint64_t magic, name_len; uint32_t opt, type, len; + TRACE("Advertizing export name '%s'", exp->name ? exp->name : ""); name_len = strlen(exp->name); magic = cpu_to_be64(NBD_REP_MAGIC); if (nbd_negotiate_write(ioc, &magic, sizeof(magic)) != sizeof(magic)) { -- 2.5.0