From patchwork Tue Feb 16 16:34:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 583561 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 345181402DD for ; Wed, 17 Feb 2016 03:54:31 +1100 (AEDT) Received: from localhost ([::1]:48056 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVitR-0003gM-BF for incoming@patchwork.ozlabs.org; Tue, 16 Feb 2016 11:54:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVib2-00047k-Su for qemu-devel@nongnu.org; Tue, 16 Feb 2016 11:35:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVib1-0007Lm-VU for qemu-devel@nongnu.org; Tue, 16 Feb 2016 11:35:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40326) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVib1-0007Le-QW for qemu-devel@nongnu.org; Tue, 16 Feb 2016 11:35:27 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 75B308EA34 for ; Tue, 16 Feb 2016 16:35:27 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-51.ams2.redhat.com [10.36.112.51]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1GGYlLt023440; Tue, 16 Feb 2016 11:35:26 -0500 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 16 Feb 2016 17:34:42 +0100 Message-Id: <1455640486-6101-25-git-send-email-pbonzini@redhat.com> In-Reply-To: <1455640486-6101-1-git-send-email-pbonzini@redhat.com> References: <1455640486-6101-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 24/28] nbd: use "" as a default export name if none provided X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Daniel P. Berrange" 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 Message-Id: <1455129674-17255-13-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini --- 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 be5f08d..5e47ac7 100644 --- a/nbd/client.c +++ b/nbd/client.c @@ -315,8 +315,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 3d2fb10..9fee1d4 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -220,6 +220,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)) {