summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ifs
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1998-06-15 07:07:21 +0000
committercharnier <charnier@FreeBSD.org>1998-06-15 07:07:21 +0000
commit07d25baf9d301d4d3b992e1580348ad73ce0894d (patch)
treeffaf174e4a683dcae9a8359aefb9854eea4bdab4 /sbin/fsck_ifs
parent9d674a7e985bdb87f5fa37da111245b1e6f5f8f3 (diff)
downloadFreeBSD-src-07d25baf9d301d4d3b992e1580348ad73ce0894d.zip
FreeBSD-src-07d25baf9d301d4d3b992e1580348ad73ce0894d.tar.gz
Correct use of .Nm. Add rcsid. Remove unused #includes. Use err(3).
Diffstat (limited to 'sbin/fsck_ifs')
-rw-r--r--sbin/fsck_ifs/dir.c5
-rw-r--r--sbin/fsck_ifs/fsck_ifs.832
-rw-r--r--sbin/fsck_ifs/inode.c6
-rw-r--r--sbin/fsck_ifs/main.c4
-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.c6
-rw-r--r--sbin/fsck_ifs/pass4.c6
-rw-r--r--sbin/fsck_ifs/pass5.c5
-rw-r--r--sbin/fsck_ifs/preen.c46
-rw-r--r--sbin/fsck_ifs/setup.c6
-rw-r--r--sbin/fsck_ifs/utilities.c7
13 files changed, 79 insertions, 60 deletions
diff --git a/sbin/fsck_ifs/dir.c b/sbin/fsck_ifs/dir.c
index 6ab67d3..ac34c6f 100644
--- a/sbin/fsck_ifs/dir.c
+++ b/sbin/fsck_ifs/dir.c
@@ -32,11 +32,14 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95";
+#endif
+static const char rcsid[] =
+ "$Id$";
#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/fsck_ifs.8 b/sbin/fsck_ifs/fsck_ifs.8
index 9221ea8..51d1679 100644
--- a/sbin/fsck_ifs/fsck_ifs.8
+++ b/sbin/fsck_ifs/fsck_ifs.8
@@ -10,7 +10,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
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)fsck.8 8.4 (Berkeley) 5/9/95
-.\" $Id: fsck.8,v 1.9 1997/03/11 12:19:36 peter Exp $
+.\" $Id: fsck.8,v 1.10 1997/03/12 16:35:26 bde Exp $
.\"
.Dd May 9, 1995
.Dt FSCK 8
@@ -54,13 +54,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.
@@ -78,7 +78,7 @@ The clean flag of each filesystem's superblock is examined and only those filesy
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
@@ -102,7 +102,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
@@ -110,7 +110,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.
@@ -118,7 +118,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
@@ -128,7 +128,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.
@@ -144,7 +144,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.
@@ -158,7 +158,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
@@ -180,12 +180,12 @@ by all users on the system should use a more restrictive
set of permissions such as 700.
.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.
.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;
@@ -210,7 +210,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,
@@ -226,7 +226,7 @@ first line of output from
.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 .
@@ -296,7 +296,7 @@ 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"
diff --git a/sbin/fsck_ifs/inode.c b/sbin/fsck_ifs/inode.c
index 74561c8..8d642c7 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$";
#endif /* not lint */
#include <sys/param.h>
@@ -339,7 +343,7 @@ resetinodebuf()
}
if (inodebuf == NULL &&
(inodebuf = (struct dinode *)malloc((unsigned)inobufsize)) == NULL)
- errx(EEXIT, "Cannot allocate space for inode buffer");
+ errx(EEXIT, "cannot allocate space for inode buffer");
while (nextino < ROOTINO)
(void)getnextinode(nextino);
}
diff --git a/sbin/fsck_ifs/main.c b/sbin/fsck_ifs/main.c
index b4bc2c9..9ff947c 100644
--- a/sbin/fsck_ifs/main.c
+++ b/sbin/fsck_ifs/main.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95";
#endif
static const char rcsid[] =
- "$Id: main.c,v 1.12 1997/12/20 22:24:32 bde Exp $";
+ "$Id: main.c,v 1.13 1998/03/08 09:55:26 julian Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -53,10 +53,8 @@ static const char rcsid[] =
#include <ufs/ufs/ufsmount.h>
#include <ufs/ffs/fs.h>
-#include <ctype.h>
#include <err.h>
#include <fstab.h>
-#include <string.h>
#include "fsck.h"
diff --git a/sbin/fsck_ifs/pass1.c b/sbin/fsck_ifs/pass1.c
index 181f858..3ad7e61 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$";
#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 e5036c7..32a3be7 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$";
#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 ebc33b8..4c24b23 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$";
#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 89aff79..6524a11 100644
--- a/sbin/fsck_ifs/pass3.c
+++ b/sbin/fsck_ifs/pass3.c
@@ -32,14 +32,16 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)pass3.c 8.2 (Berkeley) 4/27/95";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include <sys/param.h>
-#include <sys/time.h>
#include <ufs/ufs/dinode.h>
-#include <ufs/ffs/fs.h>
#include "fsck.h"
diff --git a/sbin/fsck_ifs/pass4.c b/sbin/fsck_ifs/pass4.c
index e20f6fa..b2f1fe9 100644
--- a/sbin/fsck_ifs/pass4.c
+++ b/sbin/fsck_ifs/pass4.c
@@ -32,14 +32,16 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include <sys/param.h>
-#include <sys/time.h>
#include <ufs/ufs/dinode.h>
-#include <ufs/ffs/fs.h>
#include <err.h>
#include <string.h>
diff --git a/sbin/fsck_ifs/pass5.c b/sbin/fsck_ifs/pass5.c
index aa37694..7d913a4 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$";
#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 de9bb55..9705aee 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$";
#endif /* not lint */
#include <sys/param.h>
@@ -42,6 +46,7 @@ static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95";
#include <ufs/ufs/dinode.h>
#include <ctype.h>
+#include <err.h>
#include <fstab.h>
#include <string.h>
@@ -88,8 +93,7 @@ checkfstab(preen, maxrun, docheck, chkit)
sumstatus = 0;
for (passno = 1; passno <= 2; passno++) {
if (setfsent() == 0) {
- fprintf(stderr, "Can't open checklist file: %s\n",
- _PATH_FSTAB);
+ warnx("can't open checklist file: %s", _PATH_FSTAB);
return (8);
}
while ((fsp = getfsent()) != 0) {
@@ -218,15 +222,11 @@ finddisk(name)
dk->name[len] == 0)
return (dk);
}
- if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL) {
- fprintf(stderr, "out of memory");
- exit (8);
- }
+ if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL)
+ errx(8, "out of memory");
dk = *dkp;
- if ((dk->name = malloc(len + 1)) == NULL) {
- fprintf(stderr, "out of memory");
- exit (8);
- }
+ if ((dk->name = malloc(len + 1)) == NULL)
+ errx(8, "out of memory");
(void)strncpy(dk->name, name, len);
dk->name[len] = '\0';
dk->part = NULL;
@@ -249,20 +249,14 @@ addpart(name, fsname, auxdata)
printf("%s in fstab more than once!\n", name);
return;
}
- if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL) {
- fprintf(stderr, "out of memory");
- exit (8);
- }
+ if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL)
+ errx(8, "out of memory");
pt = *ppt;
- if ((pt->name = malloc(strlen(name) + 1)) == NULL) {
- fprintf(stderr, "out of memory");
- exit (8);
- }
+ if ((pt->name = malloc(strlen(name) + 1)) == NULL)
+ errx(8, "out of memory");
(void)strcpy(pt->name, name);
- if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL) {
- fprintf(stderr, "out of memory");
- exit (8);
- }
+ if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL)
+ errx(8, "out of memory");
(void)strcpy(pt->fsname, fsname);
pt->next = NULL;
pt->auxdata = auxdata;
@@ -277,7 +271,7 @@ startdisk(dk, checkit)
dk->pid = fork();
if (dk->pid < 0) {
- perror("fork");
+ warn("fork");
return (8);
}
if (dk->pid == 0)
@@ -297,14 +291,14 @@ blockcheck(origname)
hotroot = 0;
if (stat("/", &stslash) < 0) {
- perror("/");
+ warn("/");
printf("Can't stat root\n");
return (origname);
}
newname = origname;
retry:
if (stat(newname, &stblock) < 0) {
- perror(newname);
+ warn("%s", newname);
printf("Can't stat %s\n", newname);
return (origname);
}
@@ -313,7 +307,7 @@ retry:
hotroot++;
raw = rawname(newname);
if (stat(raw, &stchar) < 0) {
- perror(raw);
+ warn("%s", raw);
printf("Can't stat %s\n", raw);
return (origname);
}
diff --git a/sbin/fsck_ifs/setup.c b/sbin/fsck_ifs/setup.c
index f464b63..308dfd0 100644
--- a/sbin/fsck_ifs/setup.c
+++ b/sbin/fsck_ifs/setup.c
@@ -32,14 +32,16 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#define DKTYPENAMES
#include <sys/param.h>
-#include <sys/time.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 465fb3b..0d82d6e 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$";
#endif /* not lint */
#include <sys/param.h>
-#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ufs/dir.h>
@@ -267,7 +270,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 (markclean && sblock.fs_clean == 0) {
sblock.fs_clean = 1;
OpenPOWER on IntegriCloud