From nobody Mon Oct 20 21:43:42 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 4cr87g0R02z6DBmr; Mon, 20 Oct 2025 21:43:43 +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 4cr87f6hmDz3Z5m; Mon, 20 Oct 2025 21:43:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760996623; 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=Grhon+mfUR232YCSzeO25hdqeAkhNuIVWt5jBwqHsqg=; b=qxy1d66wzHpF5nv59F7D9G6EXmLQGThawbLBjGyKMHTZpEgi3nmblcV+1l+rMqpfHs4/eE qlMBfZg8i5fYZwqLzVQXNnZOC073vqplEkHX+Tz2YBjpkxnZjOLIEKe5EXwdBG4KTKNv2/ vKYsjDv1LC240ljo/gqzKFMar9vSxDFw/aob7NioXzidvkHHcQx+8ouWsX2CID/GXkjJAs iS2UbfDdYmqFeahg9X0Xe/VodzjjoMQtUaBS+sp1jpOK9uL7QvQm0tbL24rATETTEe4Byc kr2ld/BjY8iawteGsrtVDo2qyx6s4zz583gvk5JyAgp7eRMqhdLp1F2RzxuOFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760996623; 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=Grhon+mfUR232YCSzeO25hdqeAkhNuIVWt5jBwqHsqg=; b=oHo37BJl94oKcHbFegEvddNa/1c8qIH1ponJTfxR/KStNdDPuKG9zzSaKChTZFaaYZQ8PC gocUVROUmHwOV1JRKDuVxHlcf50gHPeZ8SqzZjYaHwhzTLYBEjChfAVdLZOrSmxzv0DxLt ZNQEkkp+UcqdDww45awx9m+L/ujV+/o+XRoF23wW41IFaPImvxx+Jg29rYENmQd5dGA+B7 ZxeTTDdBYbc8hRIV7JHF2SePjPfWW4ZsJryQiUAAG6OZTd1qwIxFZxzghq7EkOPBI1bPg0 QQmkKw/pUNfI+GvxdpHT8V++WpGb7OvFwFE1o4ERFbLU+aEieW860dt38FfCoA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760996623; a=rsa-sha256; cv=none; b=ZmAp/P2Nw3Qk9+/o7Ep/DCNyW2xyofJfv0pOzkOoeACYecQmyCUpbRbBSYDsHa+CTlE5n8 EVOGAL8zV1rPgj+/ns5odSlKGfE+nE9kFKwfnZ4NfCsxyzladtd7MlkUwRUVXIwg3RJFMP XVyxhjRxrq8kYD/E184GhAMaFKud8D2IDj76W9KHCC6dsgIeLn/Km5uwZMo9VApccEejdt ekus17I8GAaZAoyxMdoRNHKIrkr0kVcfzfu8cPQOM0kx1zKcgbr0uccD/SOpURFTeLV+Dx qdkoULwDiAwkq1yCs4WS033UMiqUcjm7qvSO78CLVuN1d8kgPvZuFxWLwoUxTA== 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 4cr87f6FQYzWqf; Mon, 20 Oct 2025 21:43:42 +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 59KLhgPf066157; Mon, 20 Oct 2025 21:43:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59KLhgnQ066155; Mon, 20 Oct 2025 21:43:42 GMT (envelope-from git) Date: Mon, 20 Oct 2025 21:43:42 GMT Message-Id: <202510202143.59KLhgnQ066155@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 2427ae41b7cf - stable/15 - 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: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 2427ae41b7cf11e75f9a80d6c274a09eeb9ae979 Auto-Submitted: auto-generated The branch stable/15 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=2427ae41b7cf11e75f9a80d6c274a09eeb9ae979 commit 2427ae41b7cf11e75f9a80d6c274a09eeb9ae979 Author: Dag-Erling Smørgrav AuthorDate: 2025-10-20 21:41:53 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-10-20 21:43:20 +0000 quot: Make nusers unsigned Fixes: 195b00ec45e5 ("quot: Clean up") Reviewed by: rlibby Differential Revision: https://reviews.freebsd.org/D53224 (cherry picked from commit fa347930f89d4f9d1956573c3bd4b5987127bc12) --- 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; }