From nobody Mon Oct 20 16:11:39 2025 X-Original-To: dev-commits-src-branches@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 4cr0mW5tYDz6CgN2; Mon, 20 Oct 2025 16:11:39 +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 4cr0mW36jJz3VQY; Mon, 20 Oct 2025 16:11:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760976699; 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=1tSrqHq01XBfz+8YhKvEjIhST/w5GUP0+4mcoHviJHk=; b=kCWdykfDZggIh4hC9LONqyRpmj3GziFISaJpGeruJKExuN2rw/m8TOiXMtoFw25JiT8l/q DdRK5mfmJLJOgq7MVAyKC7DhlHamC0Zt8yNPRKIRdRep6LTkFDny/Gimqnaz0Q7DNIOJAc OVyDMDLfeHB27UG9CqWpZH4prDBn+4fEJg1AgI89g0HGBBy2jt4LIrp3WqvWzaVG205Wmd Ynv8ZKiPx1CJvU/nDv9a2/FhR6d2AxuUTbGwC7w+PbS2/AjJ/byR+DANU2oaYo4GJk7Ol4 2ATZx8TTATyt8nCi29Bh7fIAOH34Z59HX5tjQJZBy9tCX0iN894hD+zVcz1ozQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760976699; 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=1tSrqHq01XBfz+8YhKvEjIhST/w5GUP0+4mcoHviJHk=; b=i8X+xXs4vstkj1+/smhP3aZlhsqNKsQqKY0sVWb67tfXioB7eo+AkZeFh8eUpsullO2ibY 7XLuDCYP2VXGv2NCyYb6sU1A3v0a99UVmcLwGDiBApXD7+v4vhbztiHI20cxaUfjgAxN5T n60Po2/Hn409yO0gHF+5Om3IX9OvV3kqDh8VLvpV6twEJMRoLEYSpauKoQWZ/8JPh64ZlF ENidJXO+4LRlPOze9lzz7AF1WWhVy1ZDZJXg4F5kf/+XcQSLdHWSv2qsmixgeYbdQIN6fd wA/35/WJyeNDaGEZIUyAt9E5wrTLnIag5egm/EbTAy3SSwzL8H7wyRc/xFi+lQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760976699; a=rsa-sha256; cv=none; b=ZOuQIxftnQlPEG/3k5+qfBKiJoQsEY0VedCGhSsb78t74qSv06vROum/5HUTbO5vNW6Vm/ 2u7Vy/fOQMUj8D+uMQS1CWX/Txe9OQQojMnqvsyIfrSQUfprAn5D2yRN/zq8boxFagcv/J 5PRqQgAgra8snyvf2R/xOKF7lpiYnH8A/bCVvPzjjhS50dSXxNnZhD8plsDr7obebvXkkv HL/mukTOOQH6HQsPDTVGF2sjhA7rjPuUSqO03srwjMdxiZm5+8uBCllIlEPnR04N06JaSF UIuAZrMusFWW8rNEb4r125uPrn5zh3+wtrBc02fjaJRCALYMr/ry0QmVYA7sdg== 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 4cr0mW2RWMz4ZN; Mon, 20 Oct 2025 16:11:39 +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 59KGBdOK036422; Mon, 20 Oct 2025 16:11:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59KGBdE9036419; Mon, 20 Oct 2025 16:11:39 GMT (envelope-from git) Date: Mon, 20 Oct 2025 16:11:39 GMT Message-Id: <202510201611.59KGBdE9036419@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: c0d4bbcb8069 - stable/15 - quot: Drop the -h option List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: c0d4bbcb8069bd64f6ad070c099ebcf7cfde3e72 Auto-Submitted: auto-generated The branch stable/15 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=c0d4bbcb8069bd64f6ad070c099ebcf7cfde3e72 commit c0d4bbcb8069bd64f6ad070c099ebcf7cfde3e72 Author: Dag-Erling Smørgrav AuthorDate: 2025-10-17 11:55:07 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-10-20 16:11:22 +0000 quot: Drop the -h option There was probably a time, more than 30 years ago, when the actual size of a file had to be calculated and this option saved time, but all it does today is give incorrect results for no benefit. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D53132 (cherry picked from commit 8209311c51d34c81edec8d09778201cb6e67c6a5) --- usr.sbin/quot/quot.8 | 6 +----- usr.sbin/quot/quot.c | 36 ++++-------------------------------- 2 files changed, 5 insertions(+), 37 deletions(-) diff --git a/usr.sbin/quot/quot.8 b/usr.sbin/quot/quot.8 index 8da0625b246c..32e666e2a863 100644 --- a/usr.sbin/quot/quot.8 +++ b/usr.sbin/quot/quot.8 @@ -35,7 +35,7 @@ .Nd display disk space occupied by each user .Sh SYNOPSIS .Nm -.Op Fl cfhknv +.Op Fl cfknv .Op Fl a | Ar filesystem ... .Sh DESCRIPTION The @@ -53,10 +53,6 @@ number of files in this category, and aggregate total of blocks in files with this or lower size. .It Fl f For each user, display count of files and space occupied. -.It Fl h -Estimate the number of blocks in each file based on its size. -Note that this does not account for sparse files and is no faster than -reporting the accurate block count. .It Fl k Force the numbers to be reported in kilobyte counts. By default, all sizes are reported in 512-byte block counts. diff --git a/usr.sbin/quot/quot.c b/usr.sbin/quot/quot.c index ad9f65c94877..323648d8d550 100644 --- a/usr.sbin/quot/quot.c +++ b/usr.sbin/quot/quot.c @@ -55,7 +55,6 @@ /* some flags of what to do: */ static bool all; static bool count; -static bool estimate; static bool unused; static void (*func)(int, struct fs *); static long blocksize; @@ -63,7 +62,6 @@ static char *header; static int headerlen; static union dinode *get_inode(int, struct fs *, ino_t); -static int virtualblocks(struct fs *, union dinode *); static int isfree(struct fs *, union dinode *); static void inituser(void); static void usrrehash(void); @@ -149,33 +147,9 @@ get_inode(int fd, struct fs *super, ino_t ino) return ((union dinode *)di2); } -#define actualblocks(fs, dp) DIP(fs, dp, di_blocks) - -static int virtualblocks(struct fs *super, union dinode *dp) -{ - off_t nblk, sz; - - sz = DIP(super, dp, di_size); - - if (lblkno(super, sz) >= UFS_NDADDR) { - nblk = blkroundup(super, sz); - sz = lblkno(super, nblk); - sz = (sz - UFS_NDADDR + NINDIR(super) - 1) / NINDIR(super); - while (sz > 0) { - nblk += sz * super->fs_bsize; - /* sz - 1 rounded up */ - sz = (sz - 1 + NINDIR(super) - 1) / NINDIR(super); - } - } else - nblk = fragroundup(super, sz); - - return nblk / 512; -} - static int isfree(struct fs *super, union dinode *dp) { - switch (DIP(super, dp, di_mode) & IFMT) { case IFIFO: case IFLNK: /* should check FASTSYMLINK? */ @@ -337,8 +311,7 @@ dofsizes(int fd, struct fs *super) if ((dp = get_inode(fd, super, inode)) != NULL && !isfree(super, dp) ) { - sz = estimate ? virtualblocks(super, dp) : - actualblocks(super, dp); + sz = DIP(super, dp, di_blocks); ksz = SIZE(sz); for (fsp = &fsizes; (fp = *fsp); fsp = &fp->fsz_next) { if (ksz < fp->fsz_last) @@ -386,8 +359,7 @@ douser(int fd, struct fs *super) if ((dp = get_inode(fd, super, inode)) != NULL && !isfree(super, dp)) { uses(DIP(super, dp, di_uid), - estimate ? virtualblocks(super, dp) : - actualblocks(super, dp), + DIP(super, dp, di_blocks), DIP(super, dp, di_atime)); } } @@ -454,7 +426,7 @@ donames(int fd, struct fs *super) static void usage(void) { - fprintf(stderr, "usage: quot [-cfhknv] [-a | filesystem ...]\n"); + fprintf(stderr, "usage: quot [-cfknv] [-a | filesystem ...]\n"); exit(1); } @@ -514,7 +486,7 @@ main(int argc, char *argv[]) count = true; break; case 'h': - estimate = true; + /* ignored for backward compatibility */ break; case 'k': blocksize = 1024;