From nobody Tue Feb 10 19:14:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499441484665230.40140374422776; Fri, 7 Jul 2017 08:31:24 -0700 (PDT) Received: from localhost ([::1]:57138 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTVE2-00026f-9n for importer@patchew.org; Fri, 07 Jul 2017 11:31:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTVCJ-0000sZ-DE for qemu-devel@nongnu.org; Fri, 07 Jul 2017 11:29:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTVCH-0001FY-Py for qemu-devel@nongnu.org; Fri, 07 Jul 2017 11:29:35 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:2980 helo=relay.sw.ru) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dTVCH-0001Cl-8h for qemu-devel@nongnu.org; Fri, 07 Jul 2017 11:29:33 -0400 Received: from kvm.sw.ru (msk-vpn.virtuozzo.com [195.214.232.6]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id v67FTIuW028047; Fri, 7 Jul 2017 18:29:20 +0300 (MSK) From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Date: Fri, 7 Jul 2017 18:29:16 +0300 Message-Id: <20170707152918.23086-9-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.11.1 In-Reply-To: <20170707152918.23086-1-vsementsov@virtuozzo.com> References: <20170707152918.23086-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x [fuzzy] X-Received-From: 195.214.232.25 Subject: [Qemu-devel] [PATCH v3 08/10] nbd/server: rename clientflags var in nbd_negotiate_options X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: vsementsov@virtuozzo.com, stefanha@redhat.com, den@openvz.org, pbonzini@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Rename 'clientflags' to just 'option'. This variable has nothing to do with flags, but is a single integer representing the option requested by the client. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake --- nbd/server.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/nbd/server.c b/nbd/server.c index 1eeafccaca..c4d64fb3ad 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -415,7 +415,7 @@ static int nbd_negotiate_options(NBDClient *client, Err= or **errp) =20 while (1) { int ret; - uint32_t clientflags, length; + uint32_t option, length; uint64_t magic; =20 if (nbd_read(client->ioc, &magic, sizeof(magic), errp) < 0) { @@ -428,12 +428,12 @@ static int nbd_negotiate_options(NBDClient *client, E= rror **errp) return -EINVAL; } =20 - if (nbd_read(client->ioc, &clientflags, - sizeof(clientflags), errp) < 0) { + if (nbd_read(client->ioc, &option, + sizeof(option), errp) < 0) { error_prepend(errp, "read failed: "); return -EINVAL; } - clientflags =3D be32_to_cpu(clientflags); + option =3D be32_to_cpu(option); =20 if (nbd_read(client->ioc, &length, sizeof(length), errp) < 0) { error_prepend(errp, "read failed: "); @@ -441,15 +441,15 @@ static int nbd_negotiate_options(NBDClient *client, E= rror **errp) } length =3D be32_to_cpu(length); =20 - TRACE("Checking option 0x%" PRIx32, clientflags); + TRACE("Checking option 0x%" PRIx32, option); if (client->tlscreds && client->ioc =3D=3D (QIOChannel *)client->sioc) { QIOChannel *tioc; if (!fixedNewstyle) { - error_setg(errp, "Unsupported option 0x%" PRIx32, clientfl= ags); + error_setg(errp, "Unsupported option 0x%" PRIx32, option); return -EINVAL; } - switch (clientflags) { + switch (option) { case NBD_OPT_STARTTLS: tioc =3D nbd_negotiate_handle_starttls(client, length, err= p); if (!tioc) { @@ -462,7 +462,7 @@ static int nbd_negotiate_options(NBDClient *client, Err= or **errp) case NBD_OPT_EXPORT_NAME: /* No way to return an error to client, so drop connection= */ error_setg(errp, "Option 0x%x not permitted before TLS", - clientflags); + option); return -EINVAL; =20 default: @@ -471,21 +471,21 @@ static int nbd_negotiate_options(NBDClient *client, E= rror **errp) } ret =3D nbd_negotiate_send_rep_err(client->ioc, NBD_REP_ERR_TLS_REQD, - clientflags, errp, + option, errp, "Option 0x%" PRIx32 "not permitted before TLS= ", - clientflags); + option); if (ret < 0) { return ret; } /* Let the client keep trying, unless they asked to quit */ - if (clientflags =3D=3D NBD_OPT_ABORT) { + if (option =3D=3D NBD_OPT_ABORT) { return 1; } break; } } else if (fixedNewstyle) { - switch (clientflags) { + switch (option) { case NBD_OPT_LIST: ret =3D nbd_negotiate_handle_list(client, length, errp); if (ret < 0) { @@ -497,7 +497,7 @@ static int nbd_negotiate_options(NBDClient *client, Err= or **errp) /* NBD spec says we must try to reply before * disconnecting, but that we must also tolerate * guests that don't wait for our reply. */ - nbd_negotiate_send_rep(client->ioc, NBD_REP_ACK, clientfla= gs, + nbd_negotiate_send_rep(client->ioc, NBD_REP_ACK, option, &local_err); =20 if (local_err !=3D NULL) { @@ -518,12 +518,12 @@ static int nbd_negotiate_options(NBDClient *client, E= rror **errp) if (client->tlscreds) { ret =3D nbd_negotiate_send_rep_err(client->ioc, NBD_REP_ERR_INVALID, - clientflags, errp, + option, errp, "TLS already enabled"= ); } else { ret =3D nbd_negotiate_send_rep_err(client->ioc, NBD_REP_ERR_POLICY, - clientflags, errp, + option, errp, "TLS not configured"); } if (ret < 0) { @@ -536,10 +536,10 @@ static int nbd_negotiate_options(NBDClient *client, E= rror **errp) } ret =3D nbd_negotiate_send_rep_err(client->ioc, NBD_REP_ERR_UNSUP, - clientflags, errp, + option, errp, "Unsupported option 0x%" PRIx32, - clientflags); + option); if (ret < 0) { return ret; } @@ -550,12 +550,12 @@ static int nbd_negotiate_options(NBDClient *client, E= rror **errp) * If broken new-style we should drop the connection * for anything except NBD_OPT_EXPORT_NAME */ - switch (clientflags) { + switch (option) { case NBD_OPT_EXPORT_NAME: return nbd_negotiate_handle_export_name(client, length, er= rp); =20 default: - error_setg(errp, "Unsupported option 0x%" PRIx32, clientfl= ags); + error_setg(errp, "Unsupported option 0x%" PRIx32, option); return -EINVAL; } } --=20 2.11.1