freebsd-dev/sbin/fsck_ffs
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
..
dir.c Eliminate an unnecessary rerun request in fsck_ffs. 2021-09-22 16:20:19 -07:00
ea.c [skip ci] correct a few SPDX license tags 2021-07-07 13:52:20 -06:00
fsck_ffs.8 Correct the location of the first backup superblock in fsck_ffs.8. 2019-08-07 16:56:00 +00:00
fsck.h Clean up comments in fsck.h. 2022-05-10 16:06:15 -07:00
fsutil.c Ask to look for alternate UFS2 superblocks when the standard one is unusable. 2022-07-20 22:52:10 -07:00
gjournal.c Rewrite the disk I/O management system in fsck_ffs(8). Other than 2021-01-07 15:03:15 -08:00
globs.c Have fsck_ffs(8) properly correct superblock check-hash failures. 2022-02-04 11:47:48 -08:00
inode.c Properly specify the level of indirect block being looked up. 2022-05-05 16:58:03 -07:00
main.c fsck_ffs(8): Fix a typo in a source code comment 2022-04-09 14:38:00 +02:00
Makefile
Makefile.depend
pass1.c Ensure that files with no allocated blocks are trimmed to zero length. 2021-05-11 14:52:26 -07:00
pass1b.c Fix fsck_ffs Pass 1b error exit "bad inode number 256 to nextinode". 2021-05-19 14:39:24 -07:00
pass2.c Rewrite the disk I/O management system in fsck_ffs(8). Other than 2021-01-07 15:03:15 -08:00
pass3.c Rewrite the disk I/O management system in fsck_ffs(8). Other than 2021-01-07 15:03:15 -08:00
pass4.c Rewrite the disk I/O management system in fsck_ffs(8). Other than 2021-01-07 15:03:15 -08:00
pass5.c Use proper type (ino_t) for inode numbers to avoid improper sign extention 2020-10-25 21:04:07 +00:00
setup.c Add a flags parameter to the ffs_sbget() function that reads UFS superblocks. 2022-07-30 22:51:38 -07:00
suj.c Remove #define _KERNEL hacks from libprocstat 2021-02-21 11:38:21 +02:00
utilities.c Remove unused includes. 2019-12-22 05:44:29 +00:00