From nobody Thu Oct 30 23:52:33 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 4cyLWk3K3bz6FnWX; Thu, 30 Oct 2025 23:52:34 +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 4cyLWk0Xtwz3c9G; Thu, 30 Oct 2025 23:52:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761868354; 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=tnh2eBKOcFwXVo6aT7UptcRuMhoLh9w5hvZ9BY+70Xc=; b=bQY5cRoSSCQbMDrbClcqVH+JhkXXzZ1tOXLmannxioyIcADVmcUcGzTzW3LTQDWbqineuP M4zjM+5NPBRCGPUmWFRc2zbB3ZENgP5mmo0bTHXooATYEcN2Wu8n05DWKhYN0EsGx5E1xq Wr+WQardXxKZ58sc5VtKmav8gC7vSzjzusum6jzul7MckYZisDuusWV2159lZ6jAGen8f4 y/VK5mfTMIybCBLNu7SXt1TEN2pp+d/fafaoVKWhNcNQGyJzMaLn4eSq+/IPQ+k4hCfBY3 AHj8m2aNUL2JHjhnRYt020TotomYxU8GO79D3czt8/+Jb8cjV62nH5FQLHP0Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761868354; 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=tnh2eBKOcFwXVo6aT7UptcRuMhoLh9w5hvZ9BY+70Xc=; b=DxkDLsdtnPLHKG85k2310VDlPtF+hkl10NGFagAgbAelIeDV16b6U2N1NLTrqDYdqaALbj Cr9JR720EC50p+DhnMPYUtuE88vufqDh8PrV15b14WcyK+c9APmerIVTwCc26tXeUqNc3U PQmNPopTAG184cw4edfEag55c8P+8z57WCmxt0NyumkDWxpdf0aMXepx+E2o4+jTC+q57B kCMvvaKyG1iXWUsOZ1/sZWpYTqaFzSV47sTJ9twffVRpLDTfkhnpsYNXvD1/qCj1sNiLNK 6b3dUxop5kH+pjkheU6nDKKCdR8pWIcuquFFPkLjMWyWv+H2O5bfGwwkP6C06g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1761868354; a=rsa-sha256; cv=none; b=Nq8R49iHS2KIJzpoMTBT2vNM8gKuppfsI+BZwy9T9vM5lL/qPBg7w9F6jh+5R06YwOhLnM xgbe9h7/8xF2aRvZDEDNjG9jbHV3oZGqawVEuiS68RP3kXOmy5kiWLr+yBFTwgKgfIJ0/h Hq70qfFXB/y8RUmKhCYR5nazFoYrN9IeFEHVKgzpGWiJxhZwv4rn4/Oi7jdbPidiWLqt58 ZFAqYswUP3dJxvM1qibe++seqXsgaQBZ0emU2DBdk2v6bwP/SPqCqkfi/RM4Zxx68ooRC1 HRebgOF7gL1jp+Co5VtXSSwJXQOoxtXm8f+h3Wtqwa/D+vL0z7xgVzzzWsmP8w== 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 4cyLWk002fzlF2; Thu, 30 Oct 2025 23:52:33 +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 59UNqXH7088328; Thu, 30 Oct 2025 23:52:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59UNqXam088325; Thu, 30 Oct 2025 23:52:33 GMT (envelope-from git) Date: Thu, 30 Oct 2025 23:52:33 GMT Message-Id: <202510302352.59UNqXam088325@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: 08dda8c96941 - releng/15.0 - quot: Drop the -h option 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: 08dda8c96941c4a82e06056e5838a5bc45510407 Auto-Submitted: auto-generated The branch releng/15.0 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=08dda8c96941c4a82e06056e5838a5bc45510407 commit 08dda8c96941c4a82e06056e5838a5bc45510407 Author: Dag-Erling Smørgrav AuthorDate: 2025-10-17 11:55:07 +0000 Commit: Colin Percival CommitDate: 2025-10-30 23:48:41 +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. Approved by: re (cperciva) Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D53132 (cherry picked from commit 8209311c51d34c81edec8d09778201cb6e67c6a5) (cherry picked from commit c0d4bbcb8069bd64f6ad070c099ebcf7cfde3e72) --- 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;