summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ifs
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1998-12-03 02:41:11 +0000
committerjulian <julian@FreeBSD.org>1998-12-03 02:41:11 +0000
commitd77705b6d872e99ed9c1fe6ed1a27d8678cf7117 (patch)
tree18fe73766fe3f4bc6e842030267ad53b47f58fc5 /sbin/fsck_ifs
parent64959e9518a11a823d591af2ed4f7c4c28ccb71a (diff)
downloadFreeBSD-src-d77705b6d872e99ed9c1fe6ed1a27d8678cf7117.zip
FreeBSD-src-d77705b6d872e99ed9c1fe6ed1a27d8678cf7117.tar.gz
Cosmetic and documentation changes brought from earlier FreeBSD versions.
(e.g. RCS Id:)
Diffstat (limited to 'sbin/fsck_ifs')
-rw-r--r--sbin/fsck_ifs/dir.c11
-rw-r--r--sbin/fsck_ifs/fsck_ifs.844
-rw-r--r--sbin/fsck_ifs/inode.c5
-rw-r--r--sbin/fsck_ifs/main.c15
-rw-r--r--sbin/fsck_ifs/pass1.c5
-rw-r--r--sbin/fsck_ifs/pass1b.c5
-rw-r--r--sbin/fsck_ifs/pass2.c6
-rw-r--r--sbin/fsck_ifs/pass3.c5
-rw-r--r--sbin/fsck_ifs/pass4.c5
-rw-r--r--sbin/fsck_ifs/pass5.c5
-rw-r--r--sbin/fsck_ifs/preen.c4
-rw-r--r--sbin/fsck_ifs/setup.c5
-rw-r--r--sbin/fsck_ifs/utilities.c8
13 files changed, 91 insertions, 32 deletions
diff --git a/sbin/fsck_ifs/dir.c b/sbin/fsck_ifs/dir.c
index ceb66e6..71e8a05b 100644
--- a/sbin/fsck_ifs/dir.c
+++ b/sbin/fsck_ifs/dir.c
@@ -32,7 +32,11 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95";
+#endif
+static const char rcsid[] =
+ "$Id: dir.c,v 1.12 1998/09/23 05:37:35 nate Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -519,6 +523,13 @@ linkup(orphan, parentdir, name)
pwarn("DIR I=%lu CONNECTED. ", orphan);
if (parentdir != (ino_t)-1) {
printf("PARENT WAS I=%lu\n", (u_long)parentdir);
+ /*
+ * The parent directory, because of the ordering
+ * guarantees, has had the link count incremented
+ * for the child, but no entry was made. This
+ * fixes the parent link count so that fsck does
+ * not need to be rerun.
+ */
inoinfo(parentdir)->ino_linkcnt++;
}
if (preen == 0)
diff --git a/sbin/fsck_ifs/fsck_ifs.8 b/sbin/fsck_ifs/fsck_ifs.8
index 20c867f..5ce5e0f 100644
--- a/sbin/fsck_ifs/fsck_ifs.8
+++ b/sbin/fsck_ifs/fsck_ifs.8
@@ -11,7 +11,7 @@
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
+.\" must display the following acknowledgment:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
@@ -31,6 +31,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)fsck.8 8.4 (Berkeley) 5/9/95
+.\" $Id: fsck.8,v 1.11 1998/06/15 07:07:12 charnier Exp $
.\"
.Dd November 15, 1996
.Dt FSCK 8
@@ -55,13 +56,13 @@
.Ar ...
.Sh DESCRIPTION
The first form of
-.Nm fsck
+.Nm
preens a standard set of filesystems or the specified filesystems.
It is normally used in the script
.Pa /etc/rc
during automatic reboot.
Here
-.Nm fsck
+.Nm
reads the table
.Pa /etc/fstab
to determine which filesystems to check.
@@ -74,12 +75,18 @@ running one process per disk drive.
The disk drive containing each filesystem is inferred from the longest prefix
of the device name that ends in a digit; the remaining characters are assumed
to be the partition designator.
-In preening mode,
-filesystems that are marked clean are skipped.
+.Pp
+In "preen" mode the clean flag of each filesystem's superblock is examined
+and only those filesystems that
+are not marked clean are checked.
Filesystems are marked clean when they are unmounted,
when they have been mounted read-only, or when
-.Nm fsck
+.Nm
runs on them successfully.
+If the
+.Fl f
+option is specified, the filesystems
+will be checked regardless of the state of their clean flag.
.Pp
The kernel takes care that only a restricted class of innocuous filesystem
inconsistencies can happen unless hardware or software failures intervene.
@@ -99,7 +106,7 @@ Counts in the super-block wrong
.El
.Pp
These are the only inconsistencies that
-.Nm fsck
+.Nm
with the
.Fl p
option will correct; if it encounters other inconsistencies, it exits
@@ -107,7 +114,7 @@ with an abnormal return status and an automatic reboot will then fail.
For each corrected inconsistency one or more lines will be printed
identifying the filesystem on which the correction will take place,
and the nature of the correction. After successfully correcting a filesystem,
-.Nm fsck
+.Nm
will print the number of files on that filesystem,
the number of used and free blocks,
and the percentage of fragmentation.
@@ -115,7 +122,7 @@ and the percentage of fragmentation.
If sent a
.Dv QUIT
signal,
-.Nm fsck
+.Nm
will finish the filesystem checks, then exit with an abnormal
return status that causes an automatic reboot to fail.
This is useful when you want to finish the filesystem checks during an
@@ -125,7 +132,7 @@ but do not want the machine to come up multiuser after the checks complete.
Without the
.Fl p
option,
-.Nm fsck
+.Nm
audits and interactively repairs inconsistent conditions for filesystems.
If the filesystem is inconsistent the operator is prompted for concurrence
before each correction is attempted.
@@ -141,7 +148,7 @@ is to wait for the operator to respond
or
.Li no .
If the operator does not have write permission on the filesystem
-.Nm fsck
+.Nm
will default to a
.Fl n
action.
@@ -155,7 +162,7 @@ and
combined.
.Pp
The following flags are interpreted by
-.Nm fsck .
+.Nm Ns .
.Bl -tag -width indent
.It Fl b
Use the block specified immediately after the flag as
@@ -181,7 +188,7 @@ If maxcontig is equal to one, delete any existing segment maps.
.El
.Pp
In interactive mode,
-.Nm fsck
+.Nm
will list the conversion to be made
and ask whether the conversion should be done.
If a negative answer is given,
@@ -216,7 +223,7 @@ by all users on the system should use a more restrictive
set of permissions such as 700.
.It Fl n
Assume a no response to all questions asked by
-.Nm fsck
+.Nm
except for
.Ql CONTINUE? ,
which is assumed to be affirmative;
@@ -225,13 +232,13 @@ do not open the filesystem for writing.
Preen filesystems (see above).
.It Fl y
Assume a yes response to all questions asked by
-.Nm fsck ;
+.Nm Ns ;
this should be used with great caution as this is a free license
to continue after essentially unlimited trouble has been encountered.
.El
.Pp
If no filesystems are given to
-.Nm fsck
+.Nm
then a default list of filesystems is read from
the file
.Pa /etc/fstab .
@@ -301,13 +308,14 @@ contains default list of filesystems to check.
.El
.Sh DIAGNOSTICS
The diagnostics produced by
-.Nm fsck
+.Nm
are fully enumerated and explained in Appendix A of
.Rs
.%T "Fsck \- The UNIX File System Check Program"
.Re
.Sh SEE ALSO
-.Xr fstab 5 ,
.Xr fs 5 ,
+.Xr fstab 5 ,
+.Xr fsdb 8 ,
.Xr newfs 8 ,
.Xr reboot 8
diff --git a/sbin/fsck_ifs/inode.c b/sbin/fsck_ifs/inode.c
index a54f2ce..5a8acd2 100644
--- a/sbin/fsck_ifs/inode.c
+++ b/sbin/fsck_ifs/inode.c
@@ -32,7 +32,11 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95";
+#endif
+static const char rcsid[] =
+ "$Id: inode.c,v 1.16 1998/08/01 18:03:28 dfr Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -629,6 +633,7 @@ allocino(request, type)
dp->di_flags = 0;
dp->di_atime = time(NULL);
dp->di_mtime = dp->di_ctime = dp->di_atime;
+ dp->di_mtimensec = dp->di_ctimensec = dp->di_atimensec = 0;
dp->di_size = sblock.fs_fsize;
dp->di_blocks = btodb(sblock.fs_fsize);
n_files++;
diff --git a/sbin/fsck_ifs/main.c b/sbin/fsck_ifs/main.c
index 681ee6dc..bcf0021 100644
--- a/sbin/fsck_ifs/main.c
+++ b/sbin/fsck_ifs/main.c
@@ -38,7 +38,11 @@ static const char copyright[] =
#endif /* not lint */
#ifndef lint
-static const char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95";
+#if 0
+static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95";
+#endif
+static const char rcsid[] =
+ "$Id: main.c,v 1.15 1998/11/05 03:26:36 mjacob Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -52,7 +56,6 @@ static const char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95";
#include <err.h>
#include <fstab.h>
-#include <string.h>
#include "fsck.h"
@@ -209,10 +212,16 @@ checkfilesys(filesys, mntpt, auxdata, child)
case 0:
if (preen)
pfatal("CAN'T CHECK FILE SYSTEM.");
- /* fall through */
+ return (0);
case -1:
+ pwarn("clean, %ld free ", sblock.fs_cstotal.cs_nffree +
+ sblock.fs_frag * sblock.fs_cstotal.cs_nbfree);
+ printf("(%d frags, %d blocks, %.1f%% fragmentation)\n",
+ sblock.fs_cstotal.cs_nffree, sblock.fs_cstotal.cs_nbfree,
+ sblock.fs_cstotal.cs_nffree * 100.0 / sblock.fs_dsize);
return (0);
}
+
/*
* Cleared if any questions answered no. Used to decide if
* the superblock should be marked clean.
diff --git a/sbin/fsck_ifs/pass1.c b/sbin/fsck_ifs/pass1.c
index 1ce4471..0d3fc47 100644
--- a/sbin/fsck_ifs/pass1.c
+++ b/sbin/fsck_ifs/pass1.c
@@ -32,11 +32,14 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95";
+#endif
+static const char rcsid[] =
+ "$Id: pass1.c,v 1.13 1998/07/06 19:11:35 bde Exp $";
#endif /* not lint */
#include <sys/param.h>
-#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ufs/dir.h>
diff --git a/sbin/fsck_ifs/pass1b.c b/sbin/fsck_ifs/pass1b.c
index 65ff49c..9380382 100644
--- a/sbin/fsck_ifs/pass1b.c
+++ b/sbin/fsck_ifs/pass1b.c
@@ -32,11 +32,14 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)pass1b.c 8.4 (Berkeley) 4/28/95";
+#endif
+static const char rcsid[] =
+ "$Id: pass1b.c,v 1.4 1998/06/15 07:07:17 charnier Exp $";
#endif /* not lint */
#include <sys/param.h>
-#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
diff --git a/sbin/fsck_ifs/pass2.c b/sbin/fsck_ifs/pass2.c
index 7a61d1d..878bcbe 100644
--- a/sbin/fsck_ifs/pass2.c
+++ b/sbin/fsck_ifs/pass2.c
@@ -32,15 +32,17 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)pass2.c 8.9 (Berkeley) 4/28/95";
+#endif
+static const char rcsid[] =
+ "$Id: pass2.c,v 1.7 1998/06/15 07:07:18 charnier Exp $";
#endif /* not lint */
#include <sys/param.h>
-#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ufs/dir.h>
-#include <ufs/ffs/fs.h>
#include <err.h>
#include <string.h>
diff --git a/sbin/fsck_ifs/pass3.c b/sbin/fsck_ifs/pass3.c
index 6320755..f91f2c1 100644
--- a/sbin/fsck_ifs/pass3.c
+++ b/sbin/fsck_ifs/pass3.c
@@ -32,11 +32,14 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)pass3.c 8.2 (Berkeley) 4/27/95";
+#endif
+static const char rcsid[] =
+ "$Id: pass3.c,v 1.4 1998/06/15 07:07:18 charnier Exp $";
#endif /* not lint */
#include <sys/param.h>
-#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ufs/dir.h>
diff --git a/sbin/fsck_ifs/pass4.c b/sbin/fsck_ifs/pass4.c
index 48c5090..77b03ee 100644
--- a/sbin/fsck_ifs/pass4.c
+++ b/sbin/fsck_ifs/pass4.c
@@ -32,11 +32,14 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95";
+#endif
+static const char rcsid[] =
+ "$Id: pass4.c,v 1.4 1998/06/15 07:07:19 charnier Exp $";
#endif /* not lint */
#include <sys/param.h>
-#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
diff --git a/sbin/fsck_ifs/pass5.c b/sbin/fsck_ifs/pass5.c
index d492a18..d546e3f 100644
--- a/sbin/fsck_ifs/pass5.c
+++ b/sbin/fsck_ifs/pass5.c
@@ -32,11 +32,14 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)pass5.c 8.9 (Berkeley) 4/28/95";
+#endif
+static const char rcsid[] =
+ "$Id: pass5.c,v 1.14 1998/08/15 10:07:33 dfr Exp $";
#endif /* not lint */
#include <sys/param.h>
-#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
diff --git a/sbin/fsck_ifs/preen.c b/sbin/fsck_ifs/preen.c
index ba0140b..cc8bba6 100644
--- a/sbin/fsck_ifs/preen.c
+++ b/sbin/fsck_ifs/preen.c
@@ -32,7 +32,11 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95";
+#endif
+static const char rcsid[] =
+ "$Id: preen.c,v 1.9 1998/06/15 07:07:20 charnier Exp $";
#endif /* not lint */
#include <sys/param.h>
diff --git a/sbin/fsck_ifs/setup.c b/sbin/fsck_ifs/setup.c
index 5a842f4..88a7b6b 100644
--- a/sbin/fsck_ifs/setup.c
+++ b/sbin/fsck_ifs/setup.c
@@ -32,13 +32,16 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95";
+#endif
+static const char rcsid[] =
+ "$Id: setup.c,v 1.12 1998/06/28 19:23:03 bde Exp $";
#endif /* not lint */
#define DKTYPENAMES
#include <sys/param.h>
#include <sys/stat.h>
-#include <sys/ioctl.h>
#include <sys/disklabel.h>
#include <sys/file.h>
diff --git a/sbin/fsck_ifs/utilities.c b/sbin/fsck_ifs/utilities.c
index 5ea02b6..b072964 100644
--- a/sbin/fsck_ifs/utilities.c
+++ b/sbin/fsck_ifs/utilities.c
@@ -32,11 +32,14 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95";
+#endif
+static const char rcsid[] =
+ "$Id: utilities.c,v 1.8 1998/06/15 07:07:21 charnier Exp $";
#endif /* not lint */
#include <sys/param.h>
-#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ufs/dir.h>
@@ -286,7 +289,7 @@ ckfini(markclean)
free((char *)bp);
}
if (bufhead.b_size != cnt)
- errx(EEXIT, "Panic: lost %d buffers", bufhead.b_size - cnt);
+ errx(EEXIT, "panic: lost %d buffers", bufhead.b_size - cnt);
pbp = pdirbp = (struct bufarea *)0;
if (sblock.fs_clean != markclean) {
sblock.fs_clean = markclean;
@@ -524,7 +527,6 @@ void
catchquit(sig)
int sig;
{
-
printf("returning to single-user after filesystem check\n");
returntosingle = 1;
(void)signal(SIGQUIT, SIG_DFL);
OpenPOWER on IntegriCloud