Commit Graph

103 Commits

Author SHA1 Message Date
Philippe Charnier
e1205e80e5 The .Nm utility 2002-07-06 19:34:18 +00:00
Tom Rhodes
3468b317cb more file system > filesystem 2002-05-16 04:10:46 +00:00
Dag-Erling Smørgrav
d397408818 Usage style sweep: spell "usage" with a small 'u'.
Also change one case of blatant __progname abuse (several more remain)
This commit does not touch anything in src/{contrib,crypto,gnu}/.
2002-04-22 13:44:47 +00:00
Mark Murray
b813a7142b Replace __progname with the functionally identical but more
acceptable (documented) getprogname(3).
2002-03-24 15:06:48 +00:00
Warner Losh
b70cd7ee68 o __P removed
o ansi function prototypes
o unifdef -D__STDC__
o __dead2 on usage prototype
o remove now-bogus main prototype
2002-03-20 22:57:10 +00:00
David E. O'Brien
2d68bf45bf Default to WARNS=2.
Binary builds that cannot handle this must explicitly set WARNS=0.

Reviewed by:	mike
2001-12-04 02:19:58 +00:00
Ruslan Ermilov
265c01df49 mdoc(7) police: Fixed broken xrefs. 2001-08-22 14:16:31 +00:00
Kris Kennaway
5979df34a6 Silence non-constant format string warnings by marking functions
as __printflike()/__printf0like(), adding const, or adding missing "%s"
format strings, as appropriate.

MFC after:	2 weeks
2001-08-19 08:19:37 +00:00
Dima Dorfman
7ebcc426ef Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
Kirk McKusick
f4a225c706 Update usage message with new options.
Submitted by:	Ruslan Ermilov <ru@FreeBSD.org>
2001-04-30 05:36:32 +00:00
Ruslan Ermilov
fa0379c1dd mdoc(7) police: update document date, sort xrefs, fix markup. 2001-04-27 08:28:44 +00:00
Kirk McKusick
a02a0079ca Add support for running foreground (-F) and background (-B) checks.
Traditionally, fsck is invoked before the filesystems are mounted
and all checks are done to completion at that time. If background
checking is available, fsck is invoked twice. It is first invoked
at the traditional time, before the filesystems are mounted, with
the -F flag to do checking on all the filesystems that cannot do
background checking. It is then invoked a second time, after the
system has completed going multiuser, with the -B flag to do checking
on all the filesystems that can do background checking. Unlike
the foreground checking, the background checking is started
asynchonously so that other system activity can proceed even on
the filesystems that are being checked.

At the moment, only the fast filesystem supports background checking.
To be able to do background checking, a filesystem must have been
running with soft updates, not have been marked as needing a
foreground check, and be mounted and writable when the background
check is to be done (i.e., not listed as `noauto' in /etc/fstab).

These changes are the final piece needed to support background
filesystem checking. They will not have any effect until you update
your /etc/rc to invoke fsck in its new mode of operation. I am
still playing around with exactly what those changes should be
and should be committing them later this week.
2001-04-25 07:18:22 +00:00
Poul-Henning Kamp
46e78a1f19 Don't make fsck go quite _that_ fast:
In Preen mode we only checked one partition per disk device.
2001-04-07 13:24:59 +00:00
Ruslan Ermilov
18841862f0 mdoc(7) police: use .Nm instead of hardcoded name. 2001-04-04 10:36:16 +00:00
Poul-Henning Kamp
0af7bca250 This change sanitizes the way fsck deals with pass numbers.
Consider this /etc/fstab:

# Device         Mountpoint      FStype  Options    Dump    Pass#
/dev/ad1s1b      none            swap    sw         0       0
/dev/ad0s1b      none            swap    sw         0       0
/dev/ad0s1a      /               ufs     rw         1       1
/dev/ad0s1e      /home           ufs     rw         2       2
/dev/ad1s1e      /tmp            ufs     rw         2       2
/dev/ad1s1f      /usr            ufs     rw         2       2
/dev/ccd0c       /syv            ufs     rw         2       11
proc             /proc           procfs  rw         0       0

ccd0c is striped over /dev/ad0f and /dev/ad1g

Without this pass, fsck in preen mode will check ad0s1a first,
and then issue three processes in parallel:

One process doing ad0s1e
One process doing ad1s1e and ad1s1f
One process doing ccd0c

There is no way to tell it that ccd0c overlaps ad0 and ad1.

With the patch, it will do it this way:

pass 2:
One process doing ad0s1e
One process doing ad1s1e and ad1s1f

and when they are complete:

pass 11:
One process doing ccd0c

This is much faster and more sane.

Valid pass numbers are anything from 1 to INTMAX-1.

I retired the '-l' option which tried to allow people to do
something like this, but which didn't work and which complicated
the code an awful lot.
2001-03-30 08:01:34 +00:00
Ruslan Ermilov
0a5779d45b - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:33:27 +00:00
Ruslan Ermilov
fe655281c5 Set the default manual section for sbin/ to 8. 2001-03-20 18:13:31 +00:00
Ruslan Ermilov
d0353b836e mdoc(7) police: split punctuation characters + misc fixes. 2001-02-01 16:38:02 +00:00
Poul-Henning Kamp
32ff2662d1 Use macro API to <sys/queue.h>
Submitted by:	"Peter Avalos" <pavalos@theshell.com>
Reviewed by:	/sbin/md5
2000-12-30 21:05:45 +00:00
Poul-Henning Kamp
28b66787e0 When trying to deduce the diskname from the name so we can run
parallel fsck's one per drive, use the shortest prefix ending in
a digit rather than the longest prefix ending in a digit.

This makes "/dev/ad0s1a" and "/dev/ad0s2a" appear to both reside
on the disk "/dev/ad0" and consequently they will be fsck'ed
sequentially rather than in parallel as now.

In general this heuristic is rather soft and errorprone.  For
instance ccd may often reside on two or more physical disks.  A
good solution would be to look for passes larger than 1 until no
disks are found in a particular pass, that way people could put
ccd stripes in pass 3... and have them fsck'ed sequentially.

Reviewed by:	mjacob
2000-12-27 22:28:40 +00:00
Poul-Henning Kamp
dab777beb8 Use official API to <sys/queue.h> instead of groping around inside the
data structures.

Reviewed by:	imp
2000-12-27 21:38:06 +00:00
Ruslan Ermilov
1252c1bb05 Prepare for mdoc(7)NG. 2000-12-18 15:16:24 +00:00
Ruslan Ermilov
7c7fb079b9 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 16:52:27 +00:00
Ruslan Ermilov
acd99ff192 mdoc(7) police: fix errors uncovered by the new feature of the Nm macro. 2000-11-18 15:50:46 +00:00
David E. O'Brien
d4b552a910 We want the FreeBSD ID as the RCS ID, not the NetBSD one. 2000-10-10 08:57:30 +00:00
Bruce Evans
a1136a2e87 Fixed breakage of CFLAGS and misplacement of $FreeBSD$ in previous commit. 2000-10-10 06:29:33 +00:00
Adrian Chadd
9a31743869 .. fsck wrappers aftercommit #1: I don't know how these files got lost,
but they did. Oops.
2000-10-09 10:26:15 +00:00
Adrian Chadd
da7e7114d1 Reviewed by: rwatson, bp
Approved by:	rwatson
Obtained from:	NetBSD source tree

Second part of the fsck wrappers commit. This commit enables the new fsck
code (removing the fsck/* code and replacing it with the netbsd fsck
wrapper code), and enabling some FFS-based utilities to compile.

Details:

* quotacheck, fsdb required modification to use the fsck_ffs/ code rather
  than fsck/ . This might change later since quotacheck requires preen.c
  which should exist in fsck/ rather than fsck_ffs/

* src/Makefile has fsck_ffs added to it so it it built as part of the tree
  now

* share/doc/smm/03.fsck/ uses the SMM.doc/ stuff from fsck_ffs, not fsck.

I've tested this, and it shouldn't require any changes on your machine.
The fsck wrapper reads /etc/fsck and is command-line-compatible enough
to not require rc changes (well, most changes unless you want to do
anything nifty by specifying the fs types explicityly, read the man page
if you want further details on what it can do.)

This now allows us to support multiple filesystem types during bootup.
2000-10-09 10:23:31 +00:00
Kris Kennaway
21f181a06a Format string fix. 2000-10-06 23:24:45 +00:00
Kirk McKusick
91ea161570 If the lost+found directory is created by fsck, it will do a cacheino()
which sets the inoinfo's i_parent and i_dotdot to 0, but they never get
set to ROOTINO. This means that propagate will never find lost+found and
its descendents, subdirectories will remain DSTATE (instead of DFOUND)
even though they *are* correctly linked in, and pass4.c will try to
clear them unsuccessfully, thinking that there is no link count from the
DSTATE directory's parent. The result is that you need to run fsck twice
and get link count increasing errors (which are unexpected and fatal
when running in preen mode). The fix is to set i_parent and i_dotdot to
"parent" after the second cacheino() call in dir.c:allocdir().

Obtained from:	"Ethan Solomita" <ethan@geocast.com> (of the NetBSD Project)
2000-07-24 19:50:20 +00:00
Kirk McKusick
6c91ca38b0 Make a tighter test for valid inode numbers in getnextinode(). 2000-07-15 18:28:36 +00:00
Kirk McKusick
7932349eff Ensure that block and character devices as well as fifo's and sockets
all have zero length. A non-zero length panic's the kernel when one
of these is deleted.

PR:		19426
Submitted by:	Ian Dowse <iedowse@maths.tcd.ie>
Reviewed by:	dwmalone@FreeBSD.org
2000-07-12 06:19:22 +00:00
Kirk McKusick
142d8d2f40 Teach fsck about snapshot files. These changes should have no
effect on operation of fsck on filesystems without snapshots.
If you get compilation errors, be sure that you have copies of
/usr/include/sys/mount.h (1.94), /usr/include/sys/stat.h (1.21),
and /usr/include/ufs/ffs/fs.h (1.16) as of July 4, 2000 or later.
2000-07-06 02:03:11 +00:00
Kirk McKusick
e50342e665 Yesterday I had to fix a badly broken disk, and found that fsck kept dying:
DIR I=64512 CONNECTED. PARENT WAS I=4032
  fsck: cannot find inode 995904

fsdb found the inodes with no problem:

  fsdb (inum: 64512)> inode 995904
  current inode: directory
  I=995904 MODE=40777 SIZE=512
        MTIME=Feb 14 15:27:07 2000 [0 nsec]
        CTIME=Feb 14 15:27:07 2000 [0 nsec]
        ATIME=Feb 24 10:31:58 2000 [0 nsec]
  OWNER=nobody GRP=nobody LINKCNT=4 FLAGS=0 BLKCNT=2 GEN=38a41386
  Direct blocks: 8094568 0 0 0 0 0 0 0 0 0 0 0
  Indirect blocks:  0 0 0

The problem turns out to be a program logic error in fsck.  It stores
directory inodes internally in hash lists, using the number of
directories to form the hash key:

        inpp = &inphead[inumber % numdirs];

Elsewhere, however, it increments numdirs when it finds unattached
directories.  I've made the following fix, which solved the problem in
the case in hand.

Submitted by:	Greg Lehey <grog@lemis.com>
Reviewed by:	Matthew Dillon <dillon@apollo.backplane.com>
Approved by:	Kirk McKusick <mckusick@mckusick.com>
2000-02-28 20:02:41 +00:00
Peter Wemm
aa5344b7d7 Fix the use of an uninitialized variable in the previous commit.
Also, in addition to the previous log message, the last change had a fix
for the case where where f.mntfromname is a relative path like da0a.

Submitted by:	bde
2000-01-10 14:20:53 +00:00
Peter Wemm
d0e1503b8e - Style/bde changes.
- Don't use realpath as stat does the right thing.
  - Only check ufs filesystems in getmntpt.
  - Dont' bother checking that the ufs-mounted-on
    device is a special file.  It *must* be a special
    file, or ufs wouldn't have mounted it.

Submitted by:	Paul Saab <ps@yahoo-inc.com>
2000-01-10 08:21:22 +00:00
Peter Wemm
6920536967 - Forgot to nuke hotroot completely.
Submitted by:	Paul Saab <ps@yahoo-inc.com>
2000-01-10 08:18:18 +00:00
Peter Wemm
571b29ee9b Make fsck(8) do a MNT_RELOAD after cleaning for all read-only mounted
filesystems, not just for the root fs.

Reviewed by:	mckusick
Submitted by:	Paul Saab <ps@yahoo-inc.com>
1999-12-30 16:32:40 +00:00
Poul-Henning Kamp
ff180522d8 Make fsck even more char/blk dev tolerant. 1999-11-27 20:02:27 +00:00
Poul-Henning Kamp
703eaae72d Allow root-reloading also for chr devices. 1999-11-27 16:10:31 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Poul-Henning Kamp
bb7c1ea0a0 Also check against chardevs when looking for root. 1999-07-20 08:50:54 +00:00
Julian Elischer
6b100474f7 Cosmetic and documentation changes brought from earlier FreeBSD versions.
(e.g. RCS Id:)
1998-12-03 02:41:11 +00:00
Julian Elischer
d33e92f93e Reviewed by: Don Lewis <Don.Lewis@tsc.tdk.com>
Submitted by:	Kirk McKusick <mckusick@McKusick.COM>
Obtained from:	Mckusick, BSDI and a host of others

This exactly matches Kirks sources imported under the
Tag MCKUSICK2. These are as supplied by kirk with one small
change needed to compile under freeBSD.

Some FreeBSD patches will be added back, though many have been
added to Kirk's sources already.
1998-12-03 02:27:35 +00:00
Julian Elischer
233fbe28b0 These shouldn't have been checked in here..
Reviewee by:
1998-12-02 23:45:28 +00:00
Julian Elischer
f5dcaaf48e This commit was generated by cvs2svn to compensate for changes in r41461,
which included commits to RCS files with non-trunk default branches.
1998-12-02 20:53:40 +00:00
Julian Elischer
927eee5e0e Latest version of fsck from the folks at EX-CSRG specifically Kirk Mckusick.
Don Lewis and Kirk have merges nearly all FreeBSD Fixes into Kirks sources
so there is very little that needs to be re-merged.
1998-12-02 20:53:40 +00:00
Matt Jacob
3396608117 For large filesystems you can run past default resource limits causing
fsck to exit unhappily. Fix this by doing a getrlimit/setrlimit for
RLIMIT_DATA. I made the same fix in NetBSD.

Reviewed by:	dg@root.com
1998-11-05 03:26:36 +00:00
Nate Williams
e4b74ed73c - Back out softupdate change that already existed in FreeBSD from V1.6,
which caused the reference count of a directory to get doubly
  decremented.

PR:		bin/8030
Reviewed by:	nate
Submitted by:	Don Lewis <Don.Lewis@tsc.tdk.com>
1998-09-23 05:37:35 +00:00
Doug Rabson
bcaf95205c Use explicitly sized types when laying out the cylinder groups. This
bug was the cause of the 'freeing free frag' panics that people have been
seeing with FreeBSD/alpha. I have a similar patch to newfs but I've not
finished testing it.
1998-08-15 10:07:33 +00:00