Commit Graph

36 Commits

Author SHA1 Message Date
lukem
e3ba61f9f3 Incorporate fix by iedowse @ FreeBSD to allow disks with large numbers of
cylinder groups to work correctly, with minor modifications by me to work
with our FFS_EI code.  From the FreeBSD commit message:

	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
2001-09-02 01:58:30 +00:00
lukem
c56418af73 some improvements from freebsd/openbsd
- replace the unused fs_headswitch and fs_trkseek with fs_id[2], bringing
  our struct fs closer to that in freebsd & openbsd (& solaris FWIW)
- dumpfs: improve warning message when cpc == 0
2001-08-30 14:37:25 +00:00
lukem
1b81d6353d 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.
2001-08-17 02:18:46 +00:00
lukem
69124d8ff2 call ffs_sb_swap() with ns=1, otherwise dumpfs core dumps on other endian fses 2001-08-15 05:52:28 +00:00
lukem
e4ec9e7a11 - ansi KNF
- add -F flag to specify "argument is an fs image" (effectively a no-op,
  but here for consistency with other tools).
2001-08-14 01:02:02 +00:00
lukem
1c37a982fa enable WARNS=2 2001-07-29 09:59:12 +00:00
lukem
bdf152b906 fix time display bug introduced in previous commit [hi christos! ;]
because it was using an unitialised variable.  change:
	ctime(&t); foo.bar = t
into
	t = foo.bar; ctime(&t)
2001-07-26 05:49:00 +00:00
christos
b0d96d85f8 make this compile again. 2001-02-23 08:52:00 +00:00
lukem
c2aa46e7c2 use %ll_ instead of the less standard %q_ 2001-01-05 03:27:26 +00:00
pk
3357e41c5c Dump softdep mode. 2000-01-18 20:24:19 +00:00
thorpej
246f73e1a0 Fix a printf format warning on the Alpha. 1999-04-13 00:16:24 +00:00
mycroft
9052a41924 Display fs_maxfilesize, and clean up some other formatting. 1999-04-05 19:54:45 +00:00
garbled
d1407362ba More and more .Os cleanups. .Os is defined in the tmac.doc-common file,
so we shouldn't override it with versions in the manpages.  Many more to
come.
1999-03-22 18:43:46 +00:00
bouyer
3e3f9c7795 #include machine/bswap.h and remove -lutil. 1999-01-15 13:32:05 +00:00
ross
b1934d6034 {} fixes from Erik Bertelsen <erik@erik-be.uni-c.dk> (PR 6047) to shut up egcs. 1998-08-27 20:31:00 +00:00
mycroft
1f86e5830d const poisoning. 1998-07-27 00:52:00 +00:00
bouyer
8e1f7e498a Add support for non-native byteorder FFS. 1998-03-18 17:19:14 +00:00
mrg
e180ed08d5 fix compile warnings on the alpha. 1997-10-19 09:23:29 +00:00
lukem
328c1f1d90 WARNSify 1997-10-17 00:16:55 +00:00
lukem
ea2eef1424 resolve conflicts 1997-09-16 03:13:18 +00:00
lukem
a18d6f1948 fix typo. from msaitoh@spa.is.uec.ac.jp, [misc/3584] 1997-05-07 23:19:03 +00:00
lukem
0dbf4ab9b1 Determine filesystem level (ref: fsck_ffs(8) -c ...) and display it.
Code was derivied from observing how fsck_ffs `upgrades' to a given
level, and has been tested on recent NetBSD filesystems (reports as "3"),
SunOS ("1"), and ULTRIX ("0"). I haven't found a filesystem of level
"2" to test, but the code should detect it. Fixes [bin/1353]
1997-04-26 05:41:32 +00:00
pk
7dd8344d86 Avoid arithmetic overflow (Tor Egge; PR#1768). 1996-01-09 21:23:36 +00:00
mycroft
7bffa9e3f0 Print out the `clean' field. 1995-04-12 21:23:24 +00:00
cgd
0114e805ce convert to new RCS Id conventions; reduce my headache 1995-03-18 14:54:19 +00:00
glass
572e2d63e3 keep you from dumpfs-ing a filesystem with a bad magic #. fixes bug 249. fix 98% from Giles Lean 1994-12-26 22:11:31 +00:00
cgd
06e2955ff1 specify man pages the new way. 1994-12-22 10:44:04 +00:00
mycroft
8ffd59e28b err(3)/warn(3) cleanup 1994-09-23 02:18:30 +00:00
mycroft
ccfa3742b5 Update from 4.4-Lite, with local changes. 1994-06-08 18:57:30 +00:00
cgd
e82c231da3 need <sys/time.h> 1994-04-25 18:23:19 +00:00
mycroft
e9d867ef50 Add RCS identifiers. 1993-08-01 17:54:45 +00:00
mycroft
dfb9caab49 Add RCS indentifiers. 1993-08-01 07:32:48 +00:00
mycroft
cda4f8f6ee Add RCS identifiers. 1993-08-01 05:37:30 +00:00
cgd
06be60083d changed "Id" to "Header" for rcsids 1993-03-23 00:22:59 +00:00
cgd
346aa5dd48 added rcs ids to all files 1993-03-22 08:04:00 +00:00
cgd
61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00