From nobody Fri Oct 17 11:55:24 2025 X-Original-To: dev-commits-src-main@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 4cp3DF2jS0z6D9TZ; Fri, 17 Oct 2025 11:55:25 +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 4cp3DF15l1z3PcN; Fri, 17 Oct 2025 11:55:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760702125; 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=0WGH1Q71hHEwtBLuryH02ttH16oVTV8SXKXFDovvYWU=; b=gzqFc+ia8nmxDJRk/xOKhn2jYOd4GPF09+esIYBHeZLGApMq5GPJjEDaRqAzcXLI9TiBHR GcqZWvDMlO3ebk5MLlY4ksSOTJCSYvVUNyst5HzXPghgZcu5TIRl2LhYCkO13+1L8IHezm L0jb5NDRtuL8QVJRXEVNL+uTSCn4kiNWhtB7qOmIcb9/aR2z1Xv0TZUI7Ct2X8XKCXytLC MQd4QEfSBDrO4NcrhJ7UWOU5JjjMZnoCZGdLykmUY0gnFH8A4/eUbuZUSqITXjViTEU+lb ZlONIztQtFJk7ndg+ACuAomGEn3gThVXTJSp7nxa4iPF0BIIUQb6MQx7SB/Siw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760702125; 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=0WGH1Q71hHEwtBLuryH02ttH16oVTV8SXKXFDovvYWU=; b=QSMj1hhZ88XI6llSnty2bpEMBPabuSVACyx5TD8NnQ8cYEili5O9eOuwLyj8QzWs3ukGc5 hVhO0tO5ZJu5qvtdKr2afdt7NkHrB6AIhL6rDxAEyGt4jUNJCxkv702jI1RRfZtAN3Z3ab X1qcSZrQ0K1ETQnFoL9CpMN6n67wTIgLN9XjPaIl8W9G2MCVNKP0wDvDxFPujksDb5Cplq I+eSXJh7D62VP99QH7o63PyUcx3972wCKkBdFqQ5pfHhw2ej/5ifEuKExOve14PZm1FVT9 OdNT4H5ekEbewXQa71DqAIcavYavDf+Ci0CP4OFke0WgOJwjozRwdHKQWkVahw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760702125; a=rsa-sha256; cv=none; b=VwGR740ZCv00JtdXEZbzodjk9PwkrG3GorW8oAoGhgw3O+NZklpwaX6j0+IinE9mMMNqFr C+c46Aa2zRJJ8tRmZAKPMOe9hy4FVZbELxrmg4V76ZQh4FjEuQmU3WTNSiwF0W7QviLQ7D ZcUaYmpFWrUPR11nPIoKBm4KU28+9h+3BrFaSLtv93cB9k6Q+jj6KGjLIsY4/J2TX2sCNr aTnxByfc5HcUVwrVxu0O+ZUSBlOcK2fCxWExIAlgyNab5euLObxsJscb0hCU/UrPooK5kh DAwuVXinYQq8LMcQHTW1mDJNxJMS3Cs/8vO2A4/aQ6AOT1zIt2a/skBwZxEnOw== 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 4cp3DF0hhZztMf; Fri, 17 Oct 2025 11:55:25 +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 59HBtOPC004733; Fri, 17 Oct 2025 11:55:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59HBtOna004730; Fri, 17 Oct 2025 11:55:24 GMT (envelope-from git) Date: Fri, 17 Oct 2025 11:55:24 GMT Message-Id: <202510171155.59HBtOna004730@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 8209311c51d3 - main - quot: Drop the -h option List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 8209311c51d34c81edec8d09778201cb6e67c6a5 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=8209311c51d34c81edec8d09778201cb6e67c6a5 commit 8209311c51d34c81edec8d09778201cb6e67c6a5 Author: Dag-Erling Smørgrav AuthorDate: 2025-10-17 11:55:07 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-10-17 11:55:07 +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 --- 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;