freebsd-nq/sbin/dump
Kirk McKusick b21582ee03 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
2022-07-30 22:51:38 -07:00
..
cache.c
dump.8 dump(8): clarify the recommended use of cache and snapshots 2020-12-28 21:56:58 +00:00
dump.h Clean up global variable declarations in the dump and restore 2020-04-04 00:56:56 +00:00
dumprmt.c Clean up global variable declarations in the dump and restore 2020-04-04 00:56:56 +00:00
itime.c Clean up global variable declarations in the dump and restore 2020-04-04 00:56:56 +00:00
main.c Add a flags parameter to the ffs_sbget() function that reads UFS superblocks. 2022-07-30 22:51:38 -07:00
Makefile
Makefile.depend
optr.c
pathnames.h Clean up global variable declarations in the dump and restore 2020-04-04 00:56:56 +00:00
tape.c Clean up some function and variable names. 2020-06-23 21:11:40 +00:00
traverse.c ufs: Rework shortlink handling to avoid subobject overflows 2022-01-02 20:55:36 +00:00
unctime.c