freebsd-dev/sbin/fsck_ffs
Kirk McKusick 0a6e34e950 Fix size differences between architectures of the UFS/FFS CGSIZE macro value.
The cylinder group header structure ended with `u_int8_t cg_space[1]'
representing the beginning of the inode bitmap array. Some architectures
like the i386 rounded this up to a 4-byte boundry while other
architectures like the amd64 rounded it up to an 8-byte boundry.
Thus sizeof(struct cg) was four bytes bigger on an amd64 machine
than on an i386 machine. If a filesystem created on an i386 machine
was moved to an amd64 machine, the size of the cylinder group
calculated by the CGSIZE macro would appear to grow by four bytes.
Filesystems whose cylinder groups were exactly equal to the block
size on an i386 machine would appear to have a cylinder group that
was four bytes too big when moved to an amd64 machine. Note that
although the structure appears to be too big, it in fact is fine.
It is just the calaculation of its size that is in error.

The fix is to remove the cg_space element from the cylinder-group
structure so that the calculated size of the structure is the same
size on all architectures.

Reported by:  Tijl Coosemans
Tested by:    Tijl Coosemans and Peter Holm
MFC after:    1 week
Sponsored by: The FreeBSD Foundation
2023-05-15 12:57:15 -07:00
..
dir.c Improvement in UFS/FFS directory placement when doing mkdir(2). 2023-03-29 21:13:27 -07:00
ea.c spdx: The BSD-3-Clause-FreeBSD identifier never was, drop -FreeBSD 2023-05-12 10:44:04 -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 spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
fsutil.c Fix size differences between architectures of the UFS/FFS CGSIZE macro value. 2023-05-15 12:57:15 -07:00
gjournal.c spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
globs.c Skip Pass 5 in fsck_ffs(8) when corrupt cylinder groups remain unfixed. 2023-04-18 16:13:26 -07:00
inode.c Fix off-by-one error in fsck_ffs(8) chkrange() block-number check. 2023-05-09 13:08:10 -07:00
main.c fsck_ffs: fix the previous change that skipped pass 5 in some cases 2023-05-03 13:31:32 -07:00
Makefile pkgbase: Put ufs related tools and lib in their own package 2022-10-26 19:46:34 +02:00
Makefile.depend Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
pass1.c fsck_ffs: fix the previous change that skipped pass 5 in some cases 2023-05-03 13:31:32 -07:00
pass1b.c Flush and close getnextino cache when done using it in Pass 1b. 2022-09-03 14:15:50 -07:00
pass2.c Improvement in UFS/FFS directory placement when doing mkdir(2). 2023-03-29 21:13:27 -07:00
pass3.c Improvement in UFS/FFS directory placement when doing mkdir(2). 2023-03-29 21:13:27 -07: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 Fix size differences between architectures of the UFS/FFS CGSIZE macro value. 2023-05-15 12:57:15 -07:00
setup.c Correct several bugs in fsck_ffs(8) triggered by corrupted filesystems. 2023-03-07 15:14:47 -08:00
suj.c spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
utilities.c Remove unused includes. 2019-12-22 05:44:29 +00:00