From nobody Thu Oct 30 23:52:36 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cyLWm65YTz6FnR2; Thu, 30 Oct 2025 23:52:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cyLWm2CCTz3cpW; Thu, 30 Oct 2025 23:52:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761868356; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Td+Q94n5V2X4TL6cPRNjslNnf5lgwDim9hzH3mRmDgQ=; b=HCSTNIlVHQOWDHyAJkUalvLH/i1zfGz1ENs+ctND30LZp1WBrXmEYkrEf6ziTkPzMyjCsF 8x8rrgSHCFcN88crBLV4Y7O7Jj0rkLky1kN44H41e2He4fpstb0f1sPRvCuOA0Zzq5JJI7 MyrG/V3qEBqJCQEnGBT8vHmwFhhXwkQLUor1XppeTjbcZHSzhMfEhRhXG/nzWqr2MG5BEu xiHSuDT7iMHj6ckPHNfbn72ycgLGcGEsl3rLkyS5H2fGXIdYlfz6Pg5OurFRpDhNJh1Peo zsnTmJOfzB264/QXpPtkQhTj/ZC2HQMfDCgrIlkAEbrCFDfLKZu2nWB+ifazxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761868356; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Td+Q94n5V2X4TL6cPRNjslNnf5lgwDim9hzH3mRmDgQ=; b=qQY20lUdabhl+Cee4BZ27qwpDnF3HNgE1UlnOP8AN2FeNRD/3W4KFfjnFPdyaxUfiBnwj0 YBc6iwM2lQM3jbrdJMtf7KlkR9FtzjcUAWjhbRZXTNU7o/vLTwYE67HWdclWmyO7ZEA3zb 5jbI6DLX4ZVkfWDZqmkAIwedgdqhwMQ9/2fa9vrGjF0vVyNTvIT76P4l+HZecbi9yX5Njj TnSn+j3Cyz6B6uSnPNiEQPxXAu2bPJx3JI29KXhbx7ix2XEKWchT7LUOF/yrCTzEr4M6+X rok5rCUFYsIjIh71i1Mnfkjns66nLnZJRcB0/O8/Th/1uIEW5j4RXSP1eai//g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1761868356; a=rsa-sha256; cv=none; b=xJ7f7Hz9uoMZhWgCl9xNwkTNzaJdtO4c5t6ZK4oRwMPNFDTfeWgGL70IGzSFMSd/kGht8C p32VSf4RHBEApKUjErO9HzJDIJDRM4RvBd+ee6I2ZrrjvQc3Oj2+3Td8BiusrxRwS4nI3w lrtWiJ1buAIkF3SEKGXG5nEUSQu9fB4sSB16L+OKCp7bJfX594Zsrn1qFjIsJf1sbcdECe 90eC5twGFypXoota7ZGohQdHwAoKcbyN1lEhhjfUhrZ6Jkwf5llrbrH2hDQhEDDSU3MZNT ms+5zt6iM9Dyc76T5SwAV1VJ1glvo/I5kpsCqilL1Ts3MTmhz7aQlIxuHHZs8A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cyLWm1lsBzlXy; Thu, 30 Oct 2025 23:52:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 59UNqaHs088405; Thu, 30 Oct 2025 23:52:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59UNqatS088402; Thu, 30 Oct 2025 23:52:36 GMT (envelope-from git) Date: Thu, 30 Oct 2025 23:52:36 GMT Message-Id: <202510302352.59UNqatS088402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: 201038a01ba8 - releng/15.0 - quot: Make nusers unsigned List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/releng/15.0 X-Git-Reftype: branch X-Git-Commit: 201038a01ba85b9147bbb33bc7fcad3c980cc065 Auto-Submitted: auto-generated The branch releng/15.0 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=201038a01ba85b9147bbb33bc7fcad3c980cc065 commit 201038a01ba85b9147bbb33bc7fcad3c980cc065 Author: Dag-Erling Smørgrav AuthorDate: 2025-10-20 21:41:53 +0000 Commit: Colin Percival CommitDate: 2025-10-30 23:49:43 +0000 quot: Make nusers unsigned Approved by: re (cperciva) Fixes: 195b00ec45e5 ("quot: Clean up") Reviewed by: rlibby Differential Revision: https://reviews.freebsd.org/D53224 (cherry picked from commit fa347930f89d4f9d1956573c3bd4b5987127bc12) (cherry picked from commit 2427ae41b7cf11e75f9a80d6c274a09eeb9ae979) --- usr.sbin/quot/quot.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/usr.sbin/quot/quot.c b/usr.sbin/quot/quot.c index 879580f649b9..5dda36ac8499 100644 --- a/usr.sbin/quot/quot.c +++ b/usr.sbin/quot/quot.c @@ -178,20 +178,20 @@ static struct user { daddr_t spc60; daddr_t spc90; } *users; -static int nusers; +static unsigned int nusers; static void inituser(void) { - int i; struct user *usr; + unsigned int i; if (nusers == 0) { nusers = 8; if ((users = calloc(nusers, sizeof(*users))) == NULL) errx(1, "allocate users"); } else { - for (usr = users, i = nusers; --i >= 0; usr++) { + for (usr = users, i = nusers; i-- > 0; usr++) { usr->space = usr->spc30 = usr->spc60 = usr->spc90 = 0; usr->count = 0; } @@ -201,15 +201,15 @@ inituser(void) static void usrrehash(void) { - int i; struct user *usr, *usrn; struct user *svusr; + unsigned int i; svusr = users; nusers *= 2; if ((users = calloc(nusers, sizeof(*users))) == NULL) errx(1, "allocate users"); - for (usr = svusr, i = nusers / 2; --i >= 0; usr++) { + for (usr = svusr, i = nusers / 2; i-- > 0; usr++) { for (usrn = users + usr->uid % nusers; usrn->name; usrn--) { if (usrn <= users) usrn += nusers; @@ -223,10 +223,10 @@ user(uid_t uid) { struct user *usr; struct passwd *pwd; - int i; + unsigned int i; while (1) { - for (usr = users + uid % nusers, i = nusers; --i >= 0; usr--) { + for (usr = users + uid % nusers, i = nusers; i-- > 0; usr--) { if (usr->name == NULL) { usr->uid = uid; if (noname || (pwd = getpwuid(uid)) == NULL) @@ -280,7 +280,7 @@ uses(uid_t uid, daddr_t blks, time_t act) usr->spc30 += blks; } -#define FSZCNT 512 +#define FSZCNT 512U static struct fsizes { struct fsizes *fsz_next; daddr_t fsz_first, fsz_last; @@ -292,10 +292,10 @@ static void initfsizes(void) { struct fsizes *fp; - int i; + unsigned int i; for (fp = fsizes; fp; fp = fp->fsz_next) { - for (i = FSZCNT; --i >= 0;) { + for (i = FSZCNT; i-- > 0;) { fp->fsz_count[i] = 0; fp->fsz_sz[i] = 0; } @@ -309,13 +309,12 @@ dofsizes(int fd, struct fs *super) union dinode *dp; daddr_t sz, ksz; struct fsizes *fp, **fsp; - int i; + unsigned int i; maxino = super->fs_ncg * super->fs_ipg - 1; for (inode = 0; inode < maxino; inode++) { if ((dp = get_inode(fd, super, inode)) != NULL && - !isfree(super, dp) - ) { + !isfree(super, dp)) { sz = DIP(super, dp, di_blocks); ksz = SIZE(sz); for (fsp = &fsizes; (fp = *fsp); fsp = &fp->fsz_next) { @@ -329,7 +328,7 @@ dofsizes(int fd, struct fs *super) *fsp = fp; fp->fsz_first = rounddown(ksz, FSZCNT); fp->fsz_last = fp->fsz_first + FSZCNT; - for (i = FSZCNT; --i >= 0;) { + for (i = FSZCNT; i-- > 0;) { fp->fsz_count[i] = 0; fp->fsz_sz[i] = 0; }