From nobody Fri Nov 14 06:41:31 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1585261932; cv=none; d=zohomail.com; s=zohoarc; b=GSHFWDCbBewPNXY1iXHHVoJGd8dMGgv1vdUzM0zFdea1j43zS2mElAQcXQBNsNRXXwe3NXCl4e1Ll1r3+I6JxPS5AWyKmzkJT+o/ti958ErIw6jpWkwUx95TYk3sZs2a28udf3LcEE4V88k9kZ6lWAUYOX+RNrOsVAIfohGXnfA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585261932; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=YBRAdZSum7slsAPGovqqlyFqpgUjqJhoi03R04g10bk=; b=evDHbtzBZEubrnOFMOKI58ez3YaqygV0XhOoMTtUkfQyJufloaZVNIL1/rcjDrAHjgs+Ymjr/TXR+DAVwjTgge2+Br6vlUIW9p7ekRWqG+9Mjp4qfgrr1nCsODdz1mfr8x9q8M6glzduVaLstbJXJFdavxUcrEk8RxBvKnx9SFo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585261932933888.2769242671042; Thu, 26 Mar 2020 15:32:12 -0700 (PDT) Received: from localhost ([::1]:33598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHb2p-0007ox-HG for importer@patchew.org; Thu, 26 Mar 2020 18:32:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55798) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHb15-0006ek-A2 for qemu-devel@nongnu.org; Thu, 26 Mar 2020 18:30:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHb13-0007ZC-Vv for qemu-devel@nongnu.org; Thu, 26 Mar 2020 18:30:23 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:60355) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHb13-0006G6-Or for qemu-devel@nongnu.org; Thu, 26 Mar 2020 18:30:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=YBRAdZSum7slsAPGovqqlyFqpgUjqJhoi03R04g10bk=; b=lbTBw CWT0n02DHIYTX3FR5TnpEPETUKcriFZiMarMLKCuV2DWKxg0KUrd4tkkCjEcIGdLk+5EBux+ZpPZw llqCfefva1zj9yyHiWXC6/YgAKFlrpb7SOnucVcpiFy9wE5FVvauWJvuWd0mZUGqXopaBwzu/dTGn b9DfbdJI+2F83tPdAwZjv96dZMUrXBpqE61n+oQQW4J7TbyyVetb/GZw4rPAJWFhO6sMAI/l9e3Pm 5hPdkIg/j3tmcaxPyhRTIbezUHEqi8lC70GMp75jeJ/iPinut07cTkLl/gCySnSH+Sjth9uEpbAIa pTRDkAzrzVo41PQo1fEJqEScN6UZQ==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Thu, 26 Mar 2020 22:24:37 +0100 Subject: [PATCH v5 2/6] 9pfs readdir: rename max_count -> maxsize To: qemu-devel@nongnu.org Cc: Greg Kurz X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 91.194.90.13 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Although the 9p protocol specs use the term 'max_count' as argument for Treaddir, let's rename our variables for that to 'maxsize' instead, because 'max_count' is semantically completely wrong. This variable does not count integral entries, it is rather a maximum size (in bytes) of the destination (response) buffer being filled. Since this is just refactoring, hence this patch does not introduce any behaviour change at all. Signed-off-by: Christian Schoenebeck --- hw/9pfs/9p.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 9e046f7acb..1aff4f1fa8 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -2162,7 +2162,7 @@ static int v9fs_xattr_read(V9fsState *s, V9fsPDU *pdu= , V9fsFidState *fidp, =20 static int coroutine_fn v9fs_do_readdir_with_stat(V9fsPDU *pdu, V9fsFidState *fidp, - uint32_t max_count) + uint32_t maxsize) { V9fsPath path; V9fsStat v9stat; @@ -2199,7 +2199,7 @@ static int coroutine_fn v9fs_do_readdir_with_stat(V9f= sPDU *pdu, if (err < 0) { break; } - if ((count + v9stat.size + 2) > max_count) { + if ((count + v9stat.size + 2) > maxsize) { v9fs_readdir_unlock(&fidp->fs.dir); =20 /* Ran out of buffer. Set dir back to old position and return = */ @@ -2332,7 +2332,7 @@ static size_t v9fs_readdir_data_size(V9fsString *name) } =20 static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu, V9fsFidState *fidp, - int32_t max_count) + int32_t maxsize) { size_t size; V9fsQID qid; @@ -2357,7 +2357,7 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu,= V9fsFidState *fidp, } v9fs_string_init(&name); v9fs_string_sprintf(&name, "%s", dent->d_name); - if ((count + v9fs_readdir_data_size(&name)) > max_count) { + if ((count + v9fs_readdir_data_size(&name)) > maxsize) { v9fs_readdir_unlock(&fidp->fs.dir); =20 /* Ran out of buffer. Set dir back to old position and return = */ @@ -2432,20 +2432,20 @@ static void coroutine_fn v9fs_readdir(void *opaque) size_t offset =3D 7; uint64_t initial_offset; int32_t count; - uint32_t max_count; + uint32_t maxsize; V9fsPDU *pdu =3D opaque; V9fsState *s =3D pdu->s; =20 retval =3D pdu_unmarshal(pdu, offset, "dqd", &fid, - &initial_offset, &max_count); + &initial_offset, &maxsize); if (retval < 0) { goto out_nofid; } - trace_v9fs_readdir(pdu->tag, pdu->id, fid, initial_offset, max_count); + trace_v9fs_readdir(pdu->tag, pdu->id, fid, initial_offset, maxsize); =20 /* Enough space for a R_readdir header: size[4] Rreaddir tag[2] count[= 4] */ - if (max_count > s->msize - 11) { - max_count =3D s->msize - 11; + if (maxsize > s->msize - 11) { + maxsize =3D s->msize - 11; warn_report_once( "9p: bad client: T_readdir with count > msize - 11" ); @@ -2465,7 +2465,7 @@ static void coroutine_fn v9fs_readdir(void *opaque) } else { v9fs_co_seekdir(pdu, fidp, initial_offset); } - count =3D v9fs_do_readdir(pdu, fidp, max_count); + count =3D v9fs_do_readdir(pdu, fidp, maxsize); if (count < 0) { retval =3D count; goto out; --=20 2.20.1