From nobody Wed Feb 23 18:29:23 2022 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 98F2F19C9D48; Wed, 23 Feb 2022 18:29:23 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K3l1b3tqDz3PdK; Wed, 23 Feb 2022 18:29:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645640963; 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=uVHqlEchlfvViTrTlnJgRe4u/ZVTDWUq29+f6gc6QwE=; b=Cpiwt6+EjIN9KOHOKnP5oRrb0UbbXny4+wU8BpJDAj84yFZ4clDoUwMBJlEnYBQJdHfPV3 L0KxHUSAQUSBUurZ0ntkdF1tV0RgsrP9S5SxJNB69ip1rluX4bR+RQhBc5+4AjuGWoR6XK GSPLPVcmUuvfz1x1j0ESpZmsJCNY7d9kMa8989mOuNSzyRvrcr00yeSAnzB0DQHHIUEPpu PjKdAr3o+9UI0Eqd17DPzIBDKOQUZswAXBAKqcxqGGkG2H8r9WvSz0HE1tGwdKfFY5y0ap VUTmKhrC/zt2B5g2XjJKb5unJTu4UmawkhKYoFyzY/ZY1FHzX5EVOOimsUMApw== 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 659451D30E; Wed, 23 Feb 2022 18:29:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21NITNmM043124; Wed, 23 Feb 2022 18:29:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21NITNu9043123; Wed, 23 Feb 2022 18:29:23 GMT (envelope-from git) Date: Wed, 23 Feb 2022 18:29:23 GMT Message-Id: <202202231829.21NITNu9043123@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Robert Wing Subject: git: 0add00229d54 - stable/13 - dumpfs(8): add option to only print superblock information 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: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0add00229d540ef8a98b38594ffbb8fc0dbc292c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645640963; 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=uVHqlEchlfvViTrTlnJgRe4u/ZVTDWUq29+f6gc6QwE=; b=qzMus3eFXlT+Nhma4xxkseufxiAtWDUm/VSrstBgTfblErRYVfig6sLV/U9tnoDdOBCztK c56j0w9Prtt67u5tUZaXgLynQYKW2n2iPl8RJ7LFA9kna3R8UiihAtghrUF/8uW0lWVVEK ocPgtZ2XQMNrT5RBz6TjkwNXDuTCueYalvKc8N9+8FBoCQQKbx3znQk+P9xn5d8sbj+KfG QfiUBCzBSYXrBO6cusI5yGVukoKQU/puPOJ4r6QJycYoQVCFFcXnTJJGJkEdDwukmfa3A4 5ukFDrc7oRJp97CEvM5TdICjb3EL7HfxG+imNDVQhubPG5EzM/e26DHDzPOWtg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645640963; a=rsa-sha256; cv=none; b=QTNIgRnduETNLgpdzh9mmg5wBU4TjlohWNinK8hedt1skY3sURMAqhiDNThcMPmC/m4Fn+ GH/pHC1trlP9FdjzvXC8pwikf7r83Zji5o64VS8VnVMTvjw3Wv0WIU0qZxOs4iY2/ISfvt 7zuLt8HVCpv9qa7DYpJoSY390bKbFe2Rj/asKgnrNGGM8AodyJAZh457FPIZemr5q/bALQ qDl9XKtDO2Vzou3qK46prcFCJrUVCVIQzWQtjnd8NcJpbjtI+PtIL+k0I5gzBoPTlTb28x 5FKx9h33NEbgAbIbZPgHLbzjtQFvvdvyLMuly4EeNaKcxEb8xwSqIKWciRuX9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=0add00229d540ef8a98b38594ffbb8fc0dbc292c commit 0add00229d540ef8a98b38594ffbb8fc0dbc292c Author: Robert Wing AuthorDate: 2021-07-02 22:18:17 +0000 Commit: Robert Wing CommitDate: 2022-02-23 18:27:27 +0000 dumpfs(8): add option to only print superblock information Add an option to dumpfs, `-s`, that only prints the super block information. Reviewed by: chs, imp Differential Revision: https://reviews.freebsd.org/D30881 (cherry picked from commit dc3548453689b30ad712e4391a99d3e7df0cad40) --- sbin/dumpfs/dumpfs.8 | 12 +++++++++--- sbin/dumpfs/dumpfs.c | 17 +++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/sbin/dumpfs/dumpfs.8 b/sbin/dumpfs/dumpfs.8 index 5938282cc257..ec5b12550447 100644 --- a/sbin/dumpfs/dumpfs.8 +++ b/sbin/dumpfs/dumpfs.8 @@ -28,7 +28,7 @@ .\" @(#)dumpfs.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd May 16, 2013 +.Dd July 2, 2021 .Dt DUMPFS 8 .Os .Sh NAME @@ -39,6 +39,7 @@ .Op Fl f .Op Fl l .Op Fl m +.Op Fl s .Ar filesys | device .Sh DESCRIPTION The @@ -46,9 +47,10 @@ The utility prints out the UFS super block and cylinder group information for the file system or special device specified, unless the .Fl f , -.Fl l +.Fl l , +.Fl m , or -.Fl m +.Fl s flag is specified. The listing is very long and detailed. This @@ -97,6 +99,10 @@ The .Fl r flag is needed if the filesystem uses .Xr gjournal 8 . +.Pp +If +.Fl s +is specified, only the super block information is printed. .Sh SEE ALSO .Xr fs 5 , .Xr fsck 8 , diff --git a/sbin/dumpfs/dumpfs.c b/sbin/dumpfs/dumpfs.c index 3ac59ccc0875..7c43cf4489a8 100644 --- a/sbin/dumpfs/dumpfs.c +++ b/sbin/dumpfs/dumpfs.c @@ -81,7 +81,7 @@ static const char rcsid[] = static struct uufsd disk; -static int dumpfs(const char *); +static int dumpfs(const char *, int); static int dumpfsid(void); static int dumpcg(void); static int dumpfreespace(const char *, int); @@ -96,11 +96,11 @@ int main(int argc, char *argv[]) { const char *name; - int ch, dofreespace, domarshal, dolabel, eval; + int ch, dofreespace, domarshal, dolabel, dosb, eval; - dofreespace = domarshal = dolabel = eval = 0; + dofreespace = domarshal = dolabel = dosb = eval = 0; - while ((ch = getopt(argc, argv, "lfm")) != -1) { + while ((ch = getopt(argc, argv, "lfms")) != -1) { switch (ch) { case 'f': dofreespace++; @@ -111,6 +111,9 @@ main(int argc, char *argv[]) case 'l': dolabel = 1; break; + case 's': + dosb = 1; + break; case '?': default: usage(); @@ -139,7 +142,7 @@ main(int argc, char *argv[]) else if (dolabel) eval |= dumpfsid(); else - eval |= dumpfs(name); + eval |= dumpfs(name, dosb); ufs_disk_close(&disk); } exit(eval); @@ -154,7 +157,7 @@ dumpfsid(void) } static int -dumpfs(const char *name) +dumpfs(const char *name, int dosb) { time_t fstime, fsmtime; int64_t fssize; @@ -324,6 +327,8 @@ dumpfs(const char *name) printf("blocks in last group %ld\n\n", (long)((fssize % afs.fs_fpg) / afs.fs_frag)); } + if (dosb) + return (0); while ((i = cgread(&disk)) != 0) { if (i == -1 || dumpcg()) goto err;