Subject: CVS commit: basesrc/usr.sbin/quotacheck
To: None <>
From: Luke Mewburn <>
List: source-changes
Date: 08/17/2001 05:18:49
Module Name:	basesrc
Committed By:	lukem
Date:		Fri Aug 17 02:18:49 UTC 2001

Modified Files:
	basesrc/sbin/badsect: badsect.c
	basesrc/sbin/clri: clri.c
	basesrc/sbin/dump: ffs_inode.c
	basesrc/sbin/fsck_ffs: fsck.h pass5.c setup.c
	basesrc/sbin/fsirand: fsirand.c
	basesrc/sbin/newfs: mkfs.c
	basesrc/sbin/tunefs: tunefs.c
	basesrc/usr.sbin/dumpfs: dumpfs.c
	basesrc/usr.sbin/quotacheck: quotacheck.c
	syssrc/sys/ufs/ffs: ffs_bswap.c ffs_extern.h ffs_vfsops.c

Log Message:
remove third argument (`int ns') from ffs_sb_swap(), and let ffs_sb_swap()
determine the endianness of the `struct fs *o' superblock from o->fs_magic
and set needswap as necessary, rather than trusting the caller to get
it right.  invariably, almost every caller of ffs_sb_swap() was calling it
with ns set to the wrong value for ns anyway!
ansi KNF ffs_bswap.c declarations whilst here.

this fixes all sorts of problems when trying to use other-endian file systems,
notably the kernel trying to access memory *way* off, possibly corrupting or
panicing, and userland programs SEGVing and/or corrupting things (e.g,
"fsck_ffs -B"  to swap a file system endianness).

whilst the previous rev of ffs_bswap.c (1.10, 2000/12/23) made this problem
worse, i suspect that the problem was always there and previous versions
just happened not to trash things at the wrong time.

FFS_EI should now be a lot more stable.

To generate a diff of this commit:
cvs rdiff -r1.19 -r1.20 basesrc/sbin/badsect/badsect.c
cvs rdiff -r1.13 -r1.14 basesrc/sbin/clri/clri.c
cvs rdiff -r1.6 -r1.7 basesrc/sbin/dump/ffs_inode.c
cvs rdiff -r1.26 -r1.27 basesrc/sbin/fsck_ffs/fsck.h \
cvs rdiff -r1.44 -r1.45 basesrc/sbin/fsck_ffs/setup.c
cvs rdiff -r1.13 -r1.14 basesrc/sbin/fsirand/fsirand.c
cvs rdiff -r1.50 -r1.51 basesrc/sbin/newfs/mkfs.c
cvs rdiff -r1.20 -r1.21 basesrc/sbin/tunefs/tunefs.c
cvs rdiff -r1.26 -r1.27 basesrc/usr.sbin/dumpfs/dumpfs.c
cvs rdiff -r1.21 -r1.22 basesrc/usr.sbin/quotacheck/quotacheck.c
cvs rdiff -r1.10 -r1.11 syssrc/sys/ufs/ffs/ffs_bswap.c
cvs rdiff -r1.18 -r1.19 syssrc/sys/ufs/ffs/ffs_extern.h
cvs rdiff -r1.82 -r1.83 syssrc/sys/ufs/ffs/ffs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.