Commit Graph

148 Commits

Author SHA1 Message Date
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
84958ed05f - implement -F; treat provided filesystems as images in regular files
- replace "filesystem" with "file system" as appropriate
- grammar fixes
2001-08-15 03:54:53 +00:00
lukem
d6e3055ff1 minor whitespace cleanup 2001-08-15 03:40:50 +00:00
hubertf
1adda5370d EVEN IF YOU SCREAM, THE COMMANT IS STILL CALLED fsck_ffs ! 2001-07-04 22:43:35 +00:00
wiz
73f545bb5b Drop arguments of .Os. 2001-06-05 11:22:41 +00:00
christos
28e741ef5e fix compile errors. 2001-02-23 07:51:41 +00:00
cgd
8a986b2e96 convert to use getprogname() 2001-02-19 22:48:57 +00:00
christos
566662ba06 remove redundant declarations 2001-02-04 21:25:54 +00:00
thorpej
9c45d4b02d In pass 5, check alternate superblocks for consistency with
the current in-core master superblock, and fix them up if
they're incorrect.  Move the code that writes the alternate
superblocks if (cvtlevel || doswap) into pass 5 for efficiency.

Reviewd by Charles Hannum, and used by me to fix up a curdled
file system.
2001-01-26 17:37:16 +00:00
mycroft
1fa165bd82 Fix a rather glaring byte-swapping bug: di_size is 64 bits, not 16. 2001-01-23 02:35:51 +00:00
mycroft
521984e793 Whoops; call propagate() with the right child inode number. (Doesn't break
anything, but it would have made reconnect less efficient.)
2001-01-10 08:26:20 +00:00
mycroft
f5a9d5eadc Abstract the code to attach a directory to its parent's child list into a
separate function, and call it from multiple places in linkup() to handle
reconnects and creation of /lost+found.
2001-01-10 08:22:20 +00:00
mycroft
d722519e03 Make sure the rotor values are non-negative. 2001-01-09 11:20:00 +00:00
mycroft
a48409305d A minor tweak. 2001-01-09 09:25:32 +00:00
enami
6c06fd4f9f Don't swap cg_clustersum(cg)[0]. It doesn't actually exists and it's
actually tail of free block bitmap.

XXX swap_cg() should be shared with newfs.
2001-01-09 09:08:35 +00:00
mycroft
c4c9a7ecc0 Remove a bogus piece of code that was never used. 2001-01-09 06:05:10 +00:00
mycroft
66418680d4 The reconnect algorithm was historically O(n^4).
Some years ago I made it O(n^2).
Someone helpfully made it O(n^4) again.
Today I'm making it O(n).
If that's not good enough, I don't know what else to do.  B-)

Technical details:
* The graph traversal in propagate() is modified to be able to start from any
  point in the tree.  To handle certain exceptional cases, it is also modified
  to work in two passes, marking the tree with a special tag and then changing
  it to DFOUND.
* The reconnect case now modifies the child/sibling pointers and calls
  propagate() to propagate the connection state starting with the reconnected
  directory.

Pray that you never encounter a file system trashed enough for this to matter.
2001-01-09 05:51:14 +00:00
mycroft
3f2ff10f4c Try to cope with cs_ndir being wacky (too large or, particularly when using -b,
too damn small) by setting a minimum (1024) and maximum (maxino + 1).  This
prevents certain operations getting REALLY slow when -b is used, and also
avoids overallocating memory if the superblock is hosed.
2001-01-09 05:39:27 +00:00
lukem
f7650338ca use %ll_ instead of the less standard %q_ 2001-01-05 02:02:57 +00:00
simonb
6714e09fe2 Need an lfdir global variable now. 2000-12-14 00:32:22 +00:00
scw
9482a2a194 Some more `extern's for initialised globals. 2000-12-13 22:38:15 +00:00
mycroft
078acb237c Fix an annoyingly incorrect message. 2000-12-13 03:04:51 +00:00
is
9979da6cbb Format string cleanups by Bill Sommerfeld. 2000-10-10 20:24:49 +00:00
castor
d02d10e226 Fix an evil ugly bug which causes files placed into lost+found to
be inconsistent, and unremovable. From Ethan Solomita <ethan@geocast.com>.
Reviewed by fvdl.
2000-08-03 14:52:39 +00:00
mycroft
9496d82675 Add a missing newline in one message.
(The fact that I got this message using softdep should probably disturb
someone...)
2000-07-14 02:43:44 +00:00
christos
c1936bfd69 - ARGH /brick fvdl
- Put back the change from revision 1.31
1999-12-12 23:53:26 +00:00
bouyer
15ca2512dc Add a missing '\n'. 1999-11-28 20:03:17 +00:00
mrg
f6bf35c814 fix lp64 lossage. 1999-11-17 00:29:54 +00:00
fvdl
f2651c65ac Fix %d <-> long mismatch. 1999-11-15 20:31:51 +00:00
fvdl
5a92829791 Update for softdep code. 1999-11-15 19:19:41 +00:00
fvdl
a905c40444 Changes for softdep code. 1999-11-15 19:18:24 +00:00
christos
0e578b8b02 make sure that we don't try to allocate negative memory when blks == 0. 1999-09-06 19:52:28 +00:00
is
69741f8d3d Fix typo. 1999-05-01 20:04:14 +00:00
mycroft
f6590b22cd Clean up SYNOPSIS formatting. 1999-03-07 11:02:05 +00:00
bouyer
3e3f9c7795 #include machine/bswap.h and remove -lutil. 1999-01-15 13:32:05 +00:00
christos
7b57bf6d78 Adjust for DKTYPENAME changes. 1998-11-12 16:19:47 +00:00
thorpej
df7e58ed2e Use DINODE_SIZE rather than sizeof(struct dinode) and/or pointer arithmetic. 1998-10-23 01:13:33 +00:00
ross
029a64cc29 from Erik Bertelsen <erik@mediator.uni-c.dk>
{ put } { in } { lots } { of } { these } { to } { shut } { up } { egcs }
1998-08-25 19:18:12 +00:00
mycroft
519d858510 __AUDIT__ cleanup. 1998-07-28 19:22:54 +00:00
mycroft
217e6f7a7e const poisoning. 1998-07-26 20:32:42 +00:00
mycroft
2d452ae63c Remove redundant declaration. 1998-07-26 20:28:55 +00:00
msaitoh
6e6138d601 fix typo. 1998-05-25 10:41:57 +00:00
mycroft
72a3da3933 copyback_cg() tried to copy too much if the cylinder group info was smaller
than 8k.  From PR 5404.
1998-05-06 02:45:09 +00:00
kleink
38103c73ff Need <time.h> for time() prototype. 1998-04-01 15:55:43 +00:00
kleink
3072a632c5 Need <time.h> for ctime() and time() prototypes. 1998-04-01 15:38:58 +00:00
mrg
8578360272 use extern int over extern 1998-03-30 02:07:59 +00:00
bouyer
9aaa32d9a7 Add support for non-native byteorder FFS, and converting byteorder.
Also, be a bit more conservative with the clean flag: don't mark the FS
clean when we know there may still be errors (user anserwed 'n' to
a question, or fsck says "you must rerun fsck").
1998-03-18 17:01:23 +00:00
fvdl
e5bc90f40c Merge with Lite2 + local changes 1998-03-01 02:20:01 +00:00
mjacob
b6558b2b59 Hmmm..fsck_ffs has to really be able to alwasy work, and if you've got
a *huge* (like 600GB) filesystem, you need to not be limited by resource
limits.
1997-11-02 01:42:44 +00:00
mycroft
e96e918e60 Use bsd.subdir.mk as appropriate. 1997-10-11 09:34:07 +00:00