History log of /freebsd-current/sbin/dumpfs/dumpfs.c
Revision Date Author Comments
# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix


# 51e16cb8 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

sbin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# eba230af 25-Sep-2023 John Baldwin <jhb@FreeBSD.org>

Purge more stray embedded $FreeBSD$ strings

These do not use __FBSDID but instead use bare char arrays.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41957


# 02b7bf07 06-Aug-2023 Kirk McKusick <mckusick@FreeBSD.org>

Improve dumpfs(8) error messages when a cylinder group read fails.

Previously dumpfs(8) exited when a cylinder group read failed (such
as a cylinder-group check-hash failure). Now an error message
indicating the cylinder group number and the type of failure is
printed and the output continues for the remaining cylinder groups.

MFC-after: 1 week
Sponsored-by: The FreeBSD Foundation


# 2e7797cd 30-Apr-2023 Kirk McKusick <mckusick@FreeBSD.org>

Yet another try to fix printf format conflict.

I find it very annoying that there is no FreeBSD infrastructure to
determine failures across architectures other than to check in
changes and then have Jenkins find them.

Suggested by: Jessica Clarke
MFC after: 1 week


# 6995e6b3 29-Apr-2023 Kirk McKusick <mckusick@FreeBSD.org>

Fix printf format conflict

MFC after: 1 week


# 04997e19 29-Apr-2023 Kirk McKusick <mckusick@FreeBSD.org>

Additional output from dumpfs(8).

Provide an additional line of output for the superblock giving the
computed size of the cylinder group (CGSIZE macro) along with the
details needed to calculate it.

MFC after: 1 week


# e6886616 13-Aug-2022 Kirk McKusick <mckusick@FreeBSD.org>

Move the ability to search for alternate UFS superblocks from fsck_ffs(8)
into ffs_sbsearch() to allow use by other parts of the system.

Historically only fsck_ffs(8), the UFS filesystem checker, had code
to track down and use alternate UFS superblocks. Since fsdb(8) used
much of the fsck_ffs(8) implementation it had some ability to track
down alternate superblocks.

This change extracts the code to track down alternate superblocks
from fsck_ffs(8) and puts it into a new function ffs_sbsearch() in
sys/ufs/ffs/ffs_subr.c. Like ffs_sbget() and ffs_sbput() also found
in ffs_subr.c, these functions can be used directly by the kernel
subsystems. Additionally they are exported to the UFS library,
libufs(8) so that they can be used by user-level programs. The new
functions added to libufs(8) are sbfind(3) that is an alternative
to sbread(3) and sbsearch(3) that is an alternative to sbget(3).
See their manual pages for further details.

The utilities that have been changed to search for superblocks are
dumpfs(8), fsdb(8), ffsinfo(8), and fsck_ffs(8). Also, the prtblknos(8)
tool found in tools/diag/prtblknos searches for superblocks.

The UFS specific mount code uses the superblock search interface
when mounting the root filesystem and when the administrator doing
a mount(8) command specifies the force flag (-f). The standalone UFS
boot code (found in stand/libsa/ufs.c) uses the superblock search
code in the hope of being able to get the system up and running so
that fsck_ffs(8) can be used to get the filesystem cleaned up.

The following utilities have not been changed to search for
superblocks: clri(8), tunefs(8), snapinfo(8), fstyp(8), quot(8),
dump(8), fsirand(8), growfs(8), quotacheck(8), gjournal(8), and
glabel(8). When these utilities fail, they do report the cause of
the failure. The one exception is the tasting code used to try and
figure what a given disk contains. The tasting code will remain
silent so as not to put out a slew of messages as it trying to taste
every new mass storage device that shows up.

Reviewed by: kib
Reviewed by: Warner Losh
Tested by: Peter Holm
Differential Revision: https://reviews.freebsd.org/D36053
Sponsored by: The FreeBSD Foundation


# b21582ee 30-Jul-2022 Kirk McKusick <mckusick@FreeBSD.org>

Add a flags parameter to the ffs_sbget() function that reads UFS superblocks.

Rather than trying to shoehorn flags into the requested superblock
address, create a separate flags parameter to the ffs_sbget()
function in sys/ufs/ffs/ffs_subr.c. The ffs_sbget() function is
used both in the kernel and in user-level utilities through export
to the sbget() function in the libufs(3) library (see sbget(3)
for details). The kernel uses ffs_sbget() when mounting UFS
filesystems, in the glabel(8) and gjournal(8) GEOM utilities,
and in the standalone library used when booting the system
from a UFS root filesystem.

The ffs_sbget() function reads the superblock located at the byte
offset specified by its sblockloc parameter. The value UFS_STDSB
may be specified for sblockloc to request that the standard
location for the superblock be read.

The two existing options are now flags:

UFS_NOHASHFAIL will note if the check hash is wrong but will still
return the superblock. This is used by the bootstrap code to
give the system a chance to come up so that fsck can be run to
correct the problem.

UFS_NOMSG indicates that superblock inconsistency error messages
should not be printed. It is used by programs like fsck that
want to print their own error message and programs like glabel(8)
that just want to know if a UFS filesystem exists on a partition.

One additional flag is added:

UFS_NOCSUM causes only the superblock itself to be returned, but does
not read in any auxiliary data structures like the cylinder group
summary information. It is used by clients like glabel(8) that
just want to check for possible filesystem types. Using UFS_NOCSUM
skips the superblock checks for csum data which allows superblocks
that have corrupted csum data to be read and used.

The validate_sblock() function checks that the superblock has not
been corrupted in a way that can crash or hang the system. Unless
the UFS_NOMSG flag is specified, it will print out any errors that
it finds. Prior to this commit, validate_sblock() returned as soon
as it found an inconsistency so would print at most one message.
It now does all its checks so when UFS_NOMSG has not been specified
will print out everything that it finds inconsistent.

Sponsored by: The FreeBSD Foundation


# bf24d17f 24-Jul-2022 Kirk McKusick <mckusick@FreeBSD.org>

Have dumpfs(8) ignore superblock check-hash failures.

Set the STDSB_NOHASHFAIL request so that dumpfs(8) can print out
filesystem details even when the superblock checksum is incorrect.


# 1297a704 24-Jul-2022 Kirk McKusick <mckusick@FreeBSD.org>

Output fs_csaddr rather than fs_old_csaddr for UFS1 filesystems.

Since fs_csaddr is what will actually be used, show that value rather
than the historic and possibly incorrect value for UFS1 filesystems.


# dc354845 02-Jul-2021 Robert Wing <rew@FreeBSD.org>

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


# a9d9cfff 01-May-2020 Chuck Silvers <chs@FreeBSD.org>

Print the fs last-mounted time too.

Reviewed by: mckusick
Approved by: mckusick (mentor)
Sponsored by: Netflix


# 068beacf 08-Feb-2018 Kirk McKusick <mckusick@FreeBSD.org>

The goal of this change is to prevent accidental foot shooting by
folks running filesystems created on check-hash enabled kernels
(which I will call "new") on a non-check-hash enabled kernels (which
I will call "old). The idea here is to detect when a filesystem is
run on an old kernel and flag the filesystem so that when it gets
moved back to a new kernel, it will not start getting a slew of
check-hash errors.

Back when the UFS version 2 filesystem was created, it added a file
flag FS_INDEXDIRS that was to be set on any filesystem that kept
some sort of on-disk indexing for directories. The idea was precisely
to solve the issue we have today. Specifically that a newer kernel
that supported indexing would be able to tell that the filesystem
had been run on an older non-indexing kernel and that the indexes
should not be used until they had been rebuilt. Since we have never
implemented on-disk directory indicies, the FS_INDEXDIRS flag is
cleared every time any UFS version 2 filesystem ever created is
mounted for writing.

This commit repurposes the FS_INDEXDIRS flag as the FS_METACKHASH
flag. Thus, the FS_METACKHASH is definitively known to have always
been cleared. The FS_INDEXDIRS flag has been moved to a new block
of flags that will always be cleared starting with this commit
(until they get used to implement some future feature which needs
to detect that the filesystem was mounted on a kernel that predates
the new feature).

If a filesystem with check-hashes enabled is mounted on an old
kernel the FS_METACKHASH flag is cleared. When that filesystem is
mounted on a new kernel it will see that the FS_METACKHASH has been
cleared and clears all of the fs_metackhash flags. To get them
re-enabled the user must run fsck (in interactive mode without the
-y flag) which will ask for each supported check hash whether it
should be rebuilt and enabled. When fsck is run in its default preen
mode, it will just ignore the check hashes so they will remain
disabled.

The kernel has always disabled any check hash functions that it
does not support, so as more types of check hashes are added, we
will get a non-surprising result. Specifically if filesystems get
moved to kernels supporting fewer of the check hashes, those that
are not supported will be disabled. If the filesystem is moved back
to a kernel with more of the check-hashes available and fsck is run
interactively to rebuild them, then their checking will resume.
Otherwise just the smaller subset will be checked.

A side effect of this commit is that filesystems running with
cylinder-group check hashes will stop having them checked until
fsck is run to re-enable them (since none of them currently have
the FS_METACKHASH flag set). So, if you want check hashes enabled
on your filesystems after booting a kernel with these changes, you
need to run fsck to enable them. Any newly created filesystems will
have check hashes enabled. If in doubt as to whether you have check
hashes emabled, run dumpfs and look at the list of enabled flags
at the end of the superblock details.


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# 75e3597a 21-Sep-2017 Kirk McKusick <mckusick@FreeBSD.org>

Continuing efforts to provide hardening of FFS, this change adds a
check hash to cylinder groups. If a check hash fails when a cylinder
group is read, no further allocations are attempted in that cylinder
group until it has been fixed by fsck. This avoids a class of
filesystem panics related to corrupted cylinder group maps. The
hash is done using crc32c.

Check hases are added only to UFS2 and not to UFS1 as UFS1 is primarily
used in embedded systems with small memories and low-powered processors
which need as light-weight a filesystem as possible.

Specifics of the changes:

sys/sys/buf.h:
Add BX_FSPRIV to reserve a set of eight b_xflags that may be used
by individual filesystems for their own purpose. Their specific
definitions are found in the header files for each filesystem
that uses them. Also add fields to struct buf as noted below.

sys/kern/vfs_bio.c:
It is only necessary to compute a check hash for a cylinder
group when it is actually read from disk. When calling bread,
you do not know whether the buffer was found in the cache or
read. So a new flag (GB_CKHASH) and a pointer to a function to
perform the hash has been added to breadn_flags to say that the
function should be called to calculate a hash if the data has
been read. The check hash is placed in b_ckhash and the B_CKHASH
flag is set to indicate that a read was done and a check hash
calculated. Though a rather elaborate mechanism, it should
also work for check hashing other metadata in the future. A
kernel internal API change was to change breada into a static
fucntion and add flags and a function pointer to a check-hash
function.

sys/ufs/ffs/fs.h:
Add flags for types of check hashes; stored in a new word in the
superblock. Define corresponding BX_ flags for the different types
of check hashes. Add a check hash word in the cylinder group.

sys/ufs/ffs/ffs_alloc.c:
In ffs_getcg do the dance with breadn_flags to get a check hash and
if one is provided, check it.

sys/ufs/ffs/ffs_vfsops.c:
Copy across the BX_FFSTYPES flags in background writes.
Update the check hash when writing out buffers that need them.

sys/ufs/ffs/ffs_snapshot.c:
Recompute check hash when updating snapshot cylinder groups.

sys/libkern/crc32.c:
lib/libufs/Makefile:
lib/libufs/libufs.h:
lib/libufs/cgroup.c:
Include libkern/crc32.c in libufs and use it to compute check
hashes when updating cylinder groups.

Four utilities are affected:

sbin/newfs/mkfs.c:
Add the check hashes when building the cylinder groups.

sbin/fsck_ffs/fsck.h:
sbin/fsck_ffs/fsutil.c:
Verify and update check hashes when checking and writing cylinder groups.

sbin/fsck_ffs/pass5.c:
Offer to add check hashes to existing filesystems.
Precompute check hashes when rebuilding cylinder group
(although this will be done when it is written in fsutil.c
it is necessary to do it early before comparing with the old
cylinder group)

sbin/dumpfs/dumpfs.c
Print out the new check hash flag(s)

sbin/fsdb/Makefile:
Needs to add libufs now used by pass5.c imported from fsck_ffs.

Reviewed by: kib
Tested by: Peter Holm (pho)


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# 2c953857 01-May-2016 Marcelo Araujo <araujo@FreeBSD.org>

Use MIN macro from sys/param.h.

MFC after: 2 weeks


# 24211a0a 26-May-2015 Andrey V. Elsukov <ae@FreeBSD.org>

Print leading zeroes of UFS2 fs_id like we do for UFS1.

PR: 156908
MFC after: 1 week


# 9d384d4d 16-May-2013 Kirk McKusick <mckusick@FreeBSD.org>

When running the -m option to generate a newfs(8) command suitable for
recreating the filesystem, check for and output the -i, -k, and -l
options if appropriate.

Note the remaining deficiencies of the -m option in the dumpfs(8)
manual page. Specifically that newfs(8) options -E, -R, -S, and -T
options are not handled and that -p is not useful so is omitted.
Also document that newfs(8) options -n and -r are neither checked
for nor output but should be. The -r flag is needed if the filesystem
uses gjournal(8).

PR: bin/163992
Reported by: Dieter <freebsd@sopwith.solgatos.com>
Submitted by: Andy Kosela <akosela@andykosela.com>
MFC after: 1 week


# 3e8b8459 16-May-2013 Kirk McKusick <mckusick@FreeBSD.org>

Clean up trailing whitespace.

Submitted by: Andy Kosela
MFC after: 1 week


# baa12a84 22-Mar-2013 Kirk McKusick <mckusick@FreeBSD.org>

The purpose of this change to the FFS layout policy is to reduce the
running time for a full fsck. It also reduces the random access time
for large files and speeds the traversal time for directory tree walks.

The key idea is to reserve a small area in each cylinder group
immediately following the inode blocks for the use of metadata,
specifically indirect blocks and directory contents. The new policy
is to preferentially place metadata in the metadata area and
everything else in the blocks that follow the metadata area.

The size of this area can be set when creating a filesystem using
newfs(8) or changed in an existing filesystem using tunefs(8).
Both utilities use the `-k held-for-metadata-blocks' option to
specify the amount of space to be held for metadata blocks in each
cylinder group. By default, newfs(8) sets this area to half of
minfree (typically 4% of the data area).

This work was inspired by a paper presented at Usenix's FAST '13:
www.usenix.org/conference/fast13/ffsck-fast-file-system-checker

Details of this implementation appears in the April 2013 of ;login:
www.usenix.org/publications/login/april-2013-volume-38-number-2.
A copy of the April 2013 ;login: paper can also be downloaded
from: www.mckusick.com/publications/faster_fsck.pdf.

Reviewed by: kib
Tested by: Peter Holm
MFC after: 4 weeks


# 549f62fa 30-Oct-2012 Edward Tomasz Napierala <trasz@FreeBSD.org>

Fix problem with geom_label(4) not recognizing UFS labels on filesystems
extended using growfs(8). The problem here is that geom_label checks if
the filesystem size recorded in UFS superblock is equal to the provider
(i.e. device) size. This check cannot be removed due to backward
compatibility. On the other hand, in most cases growfs(8) cannot set
fs_size in the superblock to match the provider size, because, differently
from newfs(8), it cannot recompute cylinder group sizes.

To fix this problem, add another superblock field, fs_providersize, used
only for this purpose. The geom_label(4) will attach if either fs_size
(filesystem created with newfs(8)) or fs_providersize (filesystem expanded
using growfs(8)) matches the device size.

PR: kern/165962
Reviewed by: mckusick
Sponsored by: FreeBSD Foundation


# 73ea379e 21-Oct-2012 Eitan Adler <eadler@FreeBSD.org>

Add support for gjournal to dumpfs

PR: 165821
Submitted by: Andreas Longwitz <longwitz@incore.de>
Approved by: cperciva
MFC after: 3 days


# 4ff79fdf 26-Dec-2011 Christian Brueffer <brueffer@FreeBSD.org>

Add missing -l flag to usage().

PR: 163629
Submitted by: olgeni
MFC after: 1 week


# 2162cff1 13-Dec-2011 Ed Schouten <ed@FreeBSD.org>

Staticify dumpfs.

This tool only consists of a single C file, so we can simply mark
everything except main() static. This seems to shave off about 8% of the
binary size.


# 1efe3c6b 04-Nov-2011 Ed Schouten <ed@FreeBSD.org>

Add missing static keywords for global variables to tools in sbin/.

These tools declare global variables without using the static keyword,
even though their use is limited to a single C-file, or without placing
an extern declaration of them in the proper header file.


# ef84bb4c 14-Jul-2011 Xin LI <delphij@FreeBSD.org>

Use _PATH_DEV and make the format more consistent with GEOM_LABEL.

Submitted by: ivoras


# e293d087 14-Jul-2011 Xin LI <delphij@FreeBSD.org>

Add a -l option to show file system's corresponding /dev/ufsid path.
This is useful for scripts that converts existing system's fstab to
use their /dev/ufsid devices.

MFC after: 2 weeks


# 9775d5eb 23-Mar-2011 Juli Mallett <jmallett@FreeBSD.org>

Add support for displaying newfs flags for SU+J and TRIM.


# a738d4cf 28-Dec-2010 Konstantin Belousov <kib@FreeBSD.org>

Add support for FS_TRIM to user-mode UFS utilities.

Reviewed by: mckusick, pjd, pho
Tested by: pho
MFC after: 1 month


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 113db2dd 24-Apr-2010 Jeff Roberson <jeff@FreeBSD.org>

- Merge soft-updates journaling from projects/suj/head into head. This
brings in support for an optional intent log which eliminates the need
for background fsck on unclean shutdown.

Sponsored by: iXsystems, Yahoo!, and Juniper.
With help from: McKusick and Peter Holm


# 0718d64d 18-Apr-2010 Edward Tomasz Napierala <trasz@FreeBSD.org>

MFC r200796:

Implement NFSv4 ACL support for UFS.

Reviewed by: rwatson


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 256aec2d 08-Feb-2010 Ruslan Ermilov <ru@FreeBSD.org>

MFC: r198231: Properly re-create "-s size" argument to newfs(8).


# 2be621fa 22-Jan-2010 Gavin Atkinson <gavin@FreeBSD.org>

Merge r201647 from head:
Print leading zeros in the UFS2 FSID.

PR: bin/142155
Submitted by: Efstratios Karatzas gpf.kira gmail.com
Approved by: ed (mentor, implicit)


# 8f701116 06-Jan-2010 Gavin Atkinson <gavin@FreeBSD.org>

Print leading zeros in the UFS2 FSID.

PR: bin/142155
Submitted by: Efstratios Karatzas gpf.kira gmail.com
Approved by: ed (mentor)
MFC after: 2 weeks


# 9340fc72 21-Dec-2009 Edward Tomasz Napierala <trasz@FreeBSD.org>

Implement NFSv4 ACL support for UFS.

Reviewed by: rwatson


# f807cca1 19-Oct-2009 Ruslan Ermilov <ru@FreeBSD.org>

Properly re-create "-s size" argument to newfs(8).


# 6458691c 27-Jan-2009 Robert Watson <rwatson@FreeBSD.org>

Print disk offets as %jd rather than %lld; I fixed one before committing
but missed the other, which breaks 64-bit builds.

Reported by: bf <bf2006a at yahoo dot com>
MFC after: 1 week


# fd15d586 28-Jan-2009 Robert Watson <rwatson@FreeBSD.org>

Add a new flag to dumpfs(8), -f, which causes dumpfs to list all free
fragments in the file system by fragment (block) number. This new
mode does the necessary arithmetic to generate absolute fragment
numbers rather than than the cg-relative numbers printed in the default
mode.

If -f is passed once, contiguous fragment ranges are collapsed into
an X-Y format as free block lists are currently printed in regular
dumpfs output, but if specified twice, all block numbers are printed
individually, allowing both compact and more script-friendly
representation.

This proves quite handy when attempting to recover deleted data, as it
allows exclusion of non-deleted data from blocks searched.
MFC after: 1 week
Discussed with: jeff, Richard Clayton <richard dot clayton at cl.cam.ac.uk>
Sponsored by: Google, Inc.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 5a9dc069 31-Oct-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Teach about new fields (cg_unrefs and fs_unrefs) and new FS_GJOURNAL flag.

Sponsored by: home.pl


# 4c723140 09-Apr-2004 Mark Murray <markm@FreeBSD.org>

Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp


# 0482f576 06-Dec-2003 Don Lewis <truckman@FreeBSD.org>

Reinstate 1.40 -- swap avgfilesize and avgfpdir column order.

MFC after: 3 days


# 40814588 30-Nov-2003 Don Lewis <truckman@FreeBSD.org>

I forgot about the code freeze, so back this out.


# c9648f4e 30-Nov-2003 Don Lewis <truckman@FreeBSD.org>

Swap avgfilesize and avgfpdir order to give better column alignment.


# 88beb5c9 16-Nov-2003 Don Lewis <truckman@FreeBSD.org>

Print the dirpref avgfilesize and avgfpdir parameters.

MFC after: 2 weeks


# 657c605c 14-Nov-2003 Johan Karlsson <johan@FreeBSD.org>

Make this WARNS=2 clean by
- using (intmax_t) and %j instead of %q

Tested by: make universe


# feff4d85 09-Jun-2003 Juli Mallett <jmallett@FreeBSD.org>

Marshal newfs -L (filesystem volume names), the names are not marshalled
with any quoting, but that should be OK for re-input, regardless.


# 363c1852 14-Feb-2003 Kirk McKusick <mckusick@FreeBSD.org>

Correct lines incorrectly added to the copyright message. Add missing period.

Submitted by: Bruce Evans <bde@zeta.org.au>
Sponsored by: DARPA & NAI Labs.


# c715b047 31-Jan-2003 Gordon Tetlow <gordon@FreeBSD.org>

Bring in support for volume labels to the filesystem utilities.

Reviewed by: mckusick


# bbef019c 23-Jan-2003 Nate Lawson <njl@FreeBSD.org>

Parse both old flags location and new one. Print out new flags including
acls, multilabel, and location updated.


# 2a6b42f1 18-Jan-2003 Juli Mallett <jmallett@FreeBSD.org>

Kill initialisation and shadow warnings. Half-hearted cleanup (e.g. only the
more important ones) of format warnings. XXX Lots of this assumes int32 can
be printed with %d. Yuck.

Reviewed by: bde


# 87d35aad 19-Jan-2003 Juli Mallett <jmallett@FreeBSD.org>

Add support to marshal a filesystem to a newfs(8) command that could be used
to create it. A small number of options are not marshalled as they are things
it would be dumb to spit out, as they are used by internal computations, and
newfs may change them, or they may not be directly apparent.


# bc82f903 18-Jan-2003 Juli Mallett <jmallett@FreeBSD.org>

Let libufs handle all the work with regard to going through a list of cgs, now.


# a778dc9c 18-Jan-2003 Juli Mallett <jmallett@FreeBSD.org>

Use libufs to read one cylinder group from the disk at a time.


# 684d26ea 18-Jan-2003 Juli Mallett <jmallett@FreeBSD.org>

Simplify the main function now that libufs will hunt for the disk for us.


# cbd866f4 17-Jan-2003 Juli Mallett <jmallett@FreeBSD.org>

Simplify conditional.


# ada981b2 26-Nov-2002 Kirk McKusick <mckusick@FreeBSD.org>

Create a new 32-bit fs_flags word in the superblock. Add code to move
the old 8-bit fs_old_flags to the new location the first time that the
filesystem is mounted by a new kernel. One of the unused flags in
fs_old_flags is used to indicate that the flags have been moved.
Leave the fs_old_flags word intact so that it will work properly if
used on an old kernel.

Change the fs_sblockloc superblock location field to be in units
of bytes instead of in units of filesystem fragments. The old units
did not work properly when the fragment size exceeeded the superblock
size (8192). Update old fs_sblockloc values at the same time that
the flags are moved.

Suggested by: BOUWSMA Barry <freebsd-misuser@netscum.dyndns.dk>
Sponsored by: DARPA & NAI Labs.


# 26e77779 17-Nov-2002 Peter Wemm <peter@FreeBSD.org>

Deal with the possibility that time_t != int32_t. Otherwise ia64 thought
the fs_old_size was the half part of fs_old_time etc.


# dcf31dd1 05-Nov-2002 Juli Mallett <jmallett@FreeBSD.org>

Use more non-b0rked error reporting. Print the disk we are trying to open
and (we have the disk error from libufs? the disk error: the errno).

Requested by: bde, <many>


# 7d8939c5 22-Oct-2002 Juli Mallett <jmallett@FreeBSD.org>

Forgot to include <errno.h> when using 'errno' here.


# b9125e96 22-Oct-2002 Juli Mallett <jmallett@FreeBSD.org>

When errno is not set, do not use warn(3).


# 3fb61032 22-Oct-2002 Juli Mallett <jmallett@FreeBSD.org>

Use the libufs_printerror() function, which hopefully will deconfuse users
getting error cases in a libufsificated dumpfs(8).

Poked by: kkenn


# 60b9ade0 11-Aug-2002 Juli Mallett <jmallett@FreeBSD.org>

Simplify some things to use libufs-provided functionality here, such as the
version of UFS on a disk, and bread() instead of other types of idiocy.

Obtained from: jmallett_libufs Perforce branch.


# a1baa513 11-Jul-2002 Juli Mallett <jmallett@FreeBSD.org>

Remove unused variables due to libufs(3) commit. Clean up extraneous use of
semicolon at closing paren of a function body.


# d67caa29 11-Jul-2002 Juli Mallett <jmallett@FreeBSD.org>

Convert dumpfs(8) to libufs(3), rather than rolling local functions for a
number of things.


# 1c85e6a3 21-Jun-2002 Kirk McKusick <mckusick@FreeBSD.org>

This commit adds basic support for the UFS2 filesystem. The UFS2
filesystem expands the inode to 256 bytes to make space for 64-bit
block pointers. It also adds a file-creation time field, an ability
to use jumbo blocks per inode to allow extent like pointer density,
and space for extended attributes (up to twice the filesystem block
size worth of attributes, e.g., on a 16K filesystem, there is space
for 32K of attributes). UFS2 fully supports and runs existing UFS1
filesystems. New filesystems built using newfs can be built in either
UFS1 or UFS2 format using the -O option. In this commit UFS1 is
the default format, so if you want to build UFS2 format filesystems,
you must specify -O 2. This default will be changed to UFS2 when
UFS2 proves itself to be stable. In this commit the boot code for
reading UFS2 filesystems is not compiled (see /sys/boot/common/ufsread.c)
as there is insufficient space in the boot block. Once the size of the
boot block is increased, this code can be defined.

Things to note: the definition of SBSIZE has changed to SBLOCKSIZE.
The header file <ufs/ufs/dinode.h> must be included before
<ufs/ffs/fs.h> so as to get the definitions of ufs2_daddr_t and
ufs_lbn_t.

Still TODO:
Verify that the first level bootstraps work for all the architectures.
Convert the utility ffsinfo to understand UFS2 and test growfs.
Add support for the extended attribute storage. Update soft updates
to ensure integrity of extended attribute storage. Switch the
current extended attribute interfaces to use the extended attribute
storage. Add the extent like functionality (framework is there,
but is currently never used).

Sponsored by: DARPA & NAI Labs.
Reviewed by: Poul-Henning Kamp <phk@freebsd.org>


# 75766e17 12-May-2002 Poul-Henning Kamp <phk@FreeBSD.org>

Sigh, more BBSIZE related breakage.

Sponsored by: DARPA & NAI Labs.


# b70cd7ee 20-Mar-2002 Warner Losh <imp@FreeBSD.org>

o __P removed
o ansi function prototypes
o unifdef -D__STDC__
o __dead2 on usage prototype
o remove now-bogus main prototype


# 3d438ad6 20-Mar-2002 David E. O'Brien <obrien@FreeBSD.org>

Remove 'register' keyword.
It does not help modern compilers, and some may take some hit from it.
(I also found several functions that listed *every* of its 10 local vars with
"register" -- just how many free registers do people think machines have?)


# f55ff3f3 15-Jan-2001 Ian Dowse <iedowse@FreeBSD.org>

The ffs superblock includes a 128-byte region for use by temporary
in-core pointers to summary information. An array in this region
(fs_csp) could overflow on filesystems with a very large number of
cylinder groups (~16000 on i386 with 8k blocks). When this happens,
other fields in the superblock get corrupted, and fsck refuses to
check the filesystem.

Solve this problem by replacing the fs_csp array in 'struct fs'
with a single pointer, and add padding to keep the length of the
128-byte region fixed. Update the kernel and userland utilities
to use just this single pointer.

With this change, the kernel no longer makes use of the superblock
fields 'fs_csshift' and 'fs_csmask'. Add a comment to newfs/mkfs.c
to indicate that these fields must be calculated for compatibility
with older kernels.

Reviewed by: mckusick


# 7f3dea24 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 56d253f6 17-Jul-1999 Mike Pritchard <mpp@FreeBSD.org>

Print out the fields that are set in fs_flags.


# e0e25bba 27-Jun-1999 Poul-Henning Kamp <phk@FreeBSD.org>

Print out the fs_id field.


# 074fad21 15-Jun-1998 Philippe Charnier <charnier@FreeBSD.org>

Add rcsid. Remove unused #includes.


# 25ab4f55 20-Apr-1998 Robert Nordier <rnordier@FreeBSD.org>

Check bytes read to prevent random error message.


# 2b7c05c6 29-Jun-1997 Bruce Evans <bde@FreeBSD.org>

Print fs_maxfilesize.


# 19e1457b 28-Mar-1997 Peter Wemm <peter@FreeBSD.org>

Make this compile after the fsirand changes that deleted two fields.
I was not sure whether the fs_id fields should be printed in the clear
in case of sniffing over a network login etc. It might be an idea
to have somebody with spare time go through and find any other missing
fields that should be reported.

Definate 2.2.x/2.1.x candidate since it breaks the build.


# 9d1741b9 10-Mar-1997 Peter Wemm <peter@FreeBSD.org>

Merge from Lite2


# 1811bdf3 11-Mar-1997 Peter Wemm <peter@FreeBSD.org>

Import some CSRG 4.4BSD-Lite2 components for sbin onto vendor branch.
(note that some of these have already been imported, this is a no-op)


# c6507082 21-Oct-1996 Poul-Henning Kamp <phk@FreeBSD.org>

dumpfs blindly trusts that it has been handed a filesystem.
If the magic is bad, don't waste our time.

Submitted by: Giles Lean Giles Lean <giles@nemeton.com.au>
Obtained from: NetBSD PR bin/249


# 7976d4aa 22-Jun-1996 Peter Wemm <peter@FreeBSD.org>

Fix a couple of bogus casts to off_t that caused dumpfs to lseek negative
on filesystems > 2GB (which causes the disk slice code to call Debugger!!)


# 9eb98cec 01-Oct-1994 David Greenman <dg@FreeBSD.org>

Corrected message when no rotational position table is found.


# 31fdf44c 20-Aug-1994 David Greenman <dg@FreeBSD.org>

Added a "clean" field to the output - to show the state of the clean flag.


# 8fae3551 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite sbin Sources

Note: XNSrouted and routed NOT imported here, they shall be imported with
usr.sbin.