From nobody Sun Oct 5 21:10:52 2025 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 1499689179768568.5191370544657; Mon, 10 Jul 2017 05:19:39 -0700 (PDT) Received: from localhost ([::1]:40491 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUXf8-0005OO-71 for importer@patchew.org; Mon, 10 Jul 2017 08:19:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUXag-0001og-T9 for qemu-devel@nongnu.org; Mon, 10 Jul 2017 08:15:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUXac-0002hH-2L for qemu-devel@nongnu.org; Mon, 10 Jul 2017 08:15:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51633) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dUXaZ-0002d5-Ab; Mon, 10 Jul 2017 08:14:55 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5662FC058EA1; Mon, 10 Jul 2017 12:14:54 +0000 (UTC) Received: from red.redhat.com (ovpn-121-60.rdu2.redhat.com [10.10.121.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90452756AE; Mon, 10 Jul 2017 12:14:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5662FC058EA1 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=eblake@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5662FC058EA1 From: Eric Blake To: qemu-devel@nongnu.org Date: Mon, 10 Jul 2017 07:14:32 -0500 Message-Id: <20170710121434.5047-10-eblake@redhat.com> In-Reply-To: <20170710121434.5047-1-eblake@redhat.com> References: <20170710121434.5047-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 10 Jul 2017 12:14:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 09/11] 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: Paolo Bonzini , Vladimir Sementsov-Ogievskiy , "open list:Network Block Dev..." 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" From: Vladimir Sementsov-Ogievskiy 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 Message-Id: <20170707152918.23086-9-vsementsov@virtuozzo.com> Signed-off-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 1eeafcc..c4d64fb 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -415,7 +415,7 @@ static int nbd_negotiate_options(NBDClient *client, Err= or **errp) while (1) { int ret; - uint32_t clientflags, length; + uint32_t option, length; uint64_t magic; 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; } - 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); 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); - 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; 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); 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); default: - error_setg(errp, "Unsupported option 0x%" PRIx32, clientfl= ags); + error_setg(errp, "Unsupported option 0x%" PRIx32, option); return -EINVAL; } } --=20 2.9.4