From patchwork Thu Jan 21 16:37:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 8083071 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 08A149F440 for ; Thu, 21 Jan 2016 16:42:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 71EC0204FF for ; Thu, 21 Jan 2016 16:42:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C4A4D203F7 for ; Thu, 21 Jan 2016 16:42:24 +0000 (UTC) Received: from localhost ([::1]:48684 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMIJU-0004ot-69 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 Jan 2016 11:42:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMIF6-0004r3-LQ for qemu-devel@nongnu.org; Thu, 21 Jan 2016 11:37:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMIF5-0004Ez-Ig for qemu-devel@nongnu.org; Thu, 21 Jan 2016 11:37:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38772) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMIF3-0004De-LY; Thu, 21 Jan 2016 11:37:49 -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 3E3A73BF55F; Thu, 21 Jan 2016 16:37:49 +0000 (UTC) Received: from t530wlan.home.berrange.com.com (vpn1-6-170.ams2.redhat.com [10.36.6.170]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0LGbXn7001020; Thu, 21 Jan 2016 11:37:48 -0500 From: "Daniel P. Berrange" To: qemu-devel@nongnu.org Date: Thu, 21 Jan 2016 16:37:23 +0000 Message-Id: <1453394247-2267-11-git-send-email-berrange@redhat.com> In-Reply-To: <1453394247-2267-1-git-send-email-berrange@redhat.com> References: <1453394247-2267-1-git-send-email-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Paolo Bonzini , qemu-block@nongnu.org Subject: [Qemu-devel] [PATCH v4 10/14] 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 fb14270..fb29451 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -217,6 +217,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)) {