Correct use of .Nm. Add rcsid. Remove unused #includes. Use err(3).
This commit is contained in:
parent
8f034b11f2
commit
2d34272b7b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=37000
@ -32,11 +32,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ufs/dir.h>
|
#include <ufs/ufs/dir.h>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
.\" notice, this list of conditions and the following disclaimer in the
|
.\" notice, this list of conditions and the following disclaimer in the
|
||||||
.\" documentation and/or other materials provided with the distribution.
|
.\" documentation and/or other materials provided with the distribution.
|
||||||
.\" 3. All advertising materials mentioning features or use of this software
|
.\" 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
|
.\" This product includes software developed by the University of
|
||||||
.\" California, Berkeley and its contributors.
|
.\" California, Berkeley and its contributors.
|
||||||
.\" 4. Neither the name of the University nor the names of its contributors
|
.\" 4. Neither the name of the University nor the names of its contributors
|
||||||
@ -30,7 +30,7 @@
|
|||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" @(#)fsck.8 8.4 (Berkeley) 5/9/95
|
.\" @(#)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
|
.Dd May 9, 1995
|
||||||
.Dt FSCK 8
|
.Dt FSCK 8
|
||||||
@ -54,13 +54,13 @@
|
|||||||
.Ar ...
|
.Ar ...
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The first form of
|
The first form of
|
||||||
.Nm fsck
|
.Nm
|
||||||
preens a standard set of filesystems or the specified filesystems.
|
preens a standard set of filesystems or the specified filesystems.
|
||||||
It is normally used in the script
|
It is normally used in the script
|
||||||
.Pa /etc/rc
|
.Pa /etc/rc
|
||||||
during automatic reboot.
|
during automatic reboot.
|
||||||
Here
|
Here
|
||||||
.Nm fsck
|
.Nm
|
||||||
reads the table
|
reads the table
|
||||||
.Pa /etc/fstab
|
.Pa /etc/fstab
|
||||||
to determine which filesystems to check.
|
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.
|
are not marked clean are checked.
|
||||||
Filesystems are marked clean when they are unmounted,
|
Filesystems are marked clean when they are unmounted,
|
||||||
when they have been mounted read-only, or when
|
when they have been mounted read-only, or when
|
||||||
.Nm fsck
|
.Nm
|
||||||
runs on them successfully.
|
runs on them successfully.
|
||||||
If the
|
If the
|
||||||
.Fl f
|
.Fl f
|
||||||
@ -102,7 +102,7 @@ Counts in the super-block wrong
|
|||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
These are the only inconsistencies that
|
These are the only inconsistencies that
|
||||||
.Nm fsck
|
.Nm
|
||||||
with the
|
with the
|
||||||
.Fl p
|
.Fl p
|
||||||
option will correct; if it encounters other inconsistencies, it exits
|
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
|
For each corrected inconsistency one or more lines will be printed
|
||||||
identifying the filesystem on which the correction will take place,
|
identifying the filesystem on which the correction will take place,
|
||||||
and the nature of the correction. After successfully correcting a filesystem,
|
and the nature of the correction. After successfully correcting a filesystem,
|
||||||
.Nm fsck
|
.Nm
|
||||||
will print the number of files on that filesystem,
|
will print the number of files on that filesystem,
|
||||||
the number of used and free blocks,
|
the number of used and free blocks,
|
||||||
and the percentage of fragmentation.
|
and the percentage of fragmentation.
|
||||||
@ -118,7 +118,7 @@ and the percentage of fragmentation.
|
|||||||
If sent a
|
If sent a
|
||||||
.Dv QUIT
|
.Dv QUIT
|
||||||
signal,
|
signal,
|
||||||
.Nm fsck
|
.Nm
|
||||||
will finish the filesystem checks, then exit with an abnormal
|
will finish the filesystem checks, then exit with an abnormal
|
||||||
return status that causes an automatic reboot to fail.
|
return status that causes an automatic reboot to fail.
|
||||||
This is useful when you want to finish the filesystem checks during an
|
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
|
Without the
|
||||||
.Fl p
|
.Fl p
|
||||||
option,
|
option,
|
||||||
.Nm fsck
|
.Nm
|
||||||
audits and interactively repairs inconsistent conditions for filesystems.
|
audits and interactively repairs inconsistent conditions for filesystems.
|
||||||
If the filesystem is inconsistent the operator is prompted for concurrence
|
If the filesystem is inconsistent the operator is prompted for concurrence
|
||||||
before each correction is attempted.
|
before each correction is attempted.
|
||||||
@ -144,7 +144,7 @@ is to wait for the operator to respond
|
|||||||
or
|
or
|
||||||
.Li no .
|
.Li no .
|
||||||
If the operator does not have write permission on the filesystem
|
If the operator does not have write permission on the filesystem
|
||||||
.Nm fsck
|
.Nm
|
||||||
will default to a
|
will default to a
|
||||||
.Fl n
|
.Fl n
|
||||||
action.
|
action.
|
||||||
@ -158,7 +158,7 @@ and
|
|||||||
combined.
|
combined.
|
||||||
.Pp
|
.Pp
|
||||||
The following flags are interpreted by
|
The following flags are interpreted by
|
||||||
.Nm fsck .
|
.Nm Ns .
|
||||||
.Bl -tag -width indent
|
.Bl -tag -width indent
|
||||||
.It Fl b
|
.It Fl b
|
||||||
Use the block specified immediately after the flag as
|
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.
|
set of permissions such as 700.
|
||||||
.It Fl y
|
.It Fl y
|
||||||
Assume a yes response to all questions asked by
|
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
|
this should be used with great caution as this is a free license
|
||||||
to continue after essentially unlimited trouble has been encountered.
|
to continue after essentially unlimited trouble has been encountered.
|
||||||
.It Fl n
|
.It Fl n
|
||||||
Assume a no response to all questions asked by
|
Assume a no response to all questions asked by
|
||||||
.Nm fsck
|
.Nm
|
||||||
except for
|
except for
|
||||||
.Ql CONTINUE? ,
|
.Ql CONTINUE? ,
|
||||||
which is assumed to be affirmative;
|
which is assumed to be affirmative;
|
||||||
@ -210,7 +210,7 @@ If maxcontig is equal to one, delete any existing segment maps.
|
|||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
In interactive mode,
|
In interactive mode,
|
||||||
.Nm fsck
|
.Nm
|
||||||
will list the conversion to be made
|
will list the conversion to be made
|
||||||
and ask whether the conversion should be done.
|
and ask whether the conversion should be done.
|
||||||
If a negative answer is given,
|
If a negative answer is given,
|
||||||
@ -226,7 +226,7 @@ first line of output from
|
|||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
If no filesystems are given to
|
If no filesystems are given to
|
||||||
.Nm fsck
|
.Nm
|
||||||
then a default list of filesystems is read from
|
then a default list of filesystems is read from
|
||||||
the file
|
the file
|
||||||
.Pa /etc/fstab .
|
.Pa /etc/fstab .
|
||||||
@ -296,7 +296,7 @@ contains default list of filesystems to check.
|
|||||||
.El
|
.El
|
||||||
.Sh DIAGNOSTICS
|
.Sh DIAGNOSTICS
|
||||||
The diagnostics produced by
|
The diagnostics produced by
|
||||||
.Nm fsck
|
.Nm
|
||||||
are fully enumerated and explained in Appendix A of
|
are fully enumerated and explained in Appendix A of
|
||||||
.Rs
|
.Rs
|
||||||
.%T "Fsck \- The UNIX File System Check Program"
|
.%T "Fsck \- The UNIX File System Check Program"
|
||||||
|
@ -32,7 +32,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -339,7 +343,7 @@ resetinodebuf()
|
|||||||
}
|
}
|
||||||
if (inodebuf == NULL &&
|
if (inodebuf == NULL &&
|
||||||
(inodebuf = (struct dinode *)malloc((unsigned)inobufsize)) == 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)
|
while (nextino < ROOTINO)
|
||||||
(void)getnextinode(nextino);
|
(void)getnextinode(nextino);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ static const char copyright[] =
|
|||||||
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95";
|
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95";
|
||||||
#endif
|
#endif
|
||||||
static const char rcsid[] =
|
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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -53,10 +53,8 @@ static const char rcsid[] =
|
|||||||
#include <ufs/ufs/ufsmount.h>
|
#include <ufs/ufs/ufsmount.h>
|
||||||
#include <ufs/ffs/fs.h>
|
#include <ufs/ffs/fs.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <fstab.h>
|
#include <fstab.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "fsck.h"
|
#include "fsck.h"
|
||||||
|
|
||||||
|
@ -32,11 +32,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ufs/dir.h>
|
#include <ufs/ufs/dir.h>
|
||||||
|
@ -32,11 +32,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass1b.c 8.4 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)pass1b.c 8.4 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ffs/fs.h>
|
#include <ufs/ffs/fs.h>
|
||||||
|
@ -32,15 +32,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass2.c 8.9 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)pass2.c 8.9 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ufs/dir.h>
|
#include <ufs/ufs/dir.h>
|
||||||
#include <ufs/ffs/fs.h>
|
|
||||||
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -32,14 +32,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass3.c 8.2 (Berkeley) 4/27/95";
|
static const char sccsid[] = "@(#)pass3.c 8.2 (Berkeley) 4/27/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ffs/fs.h>
|
|
||||||
|
|
||||||
#include "fsck.h"
|
#include "fsck.h"
|
||||||
|
|
||||||
|
@ -32,14 +32,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ffs/fs.h>
|
|
||||||
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -32,11 +32,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass5.c 8.9 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)pass5.c 8.9 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ffs/fs.h>
|
#include <ufs/ffs/fs.h>
|
||||||
|
@ -32,7 +32,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#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 <ufs/ufs/dinode.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <err.h>
|
||||||
#include <fstab.h>
|
#include <fstab.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -88,8 +93,7 @@ checkfstab(preen, maxrun, docheck, chkit)
|
|||||||
sumstatus = 0;
|
sumstatus = 0;
|
||||||
for (passno = 1; passno <= 2; passno++) {
|
for (passno = 1; passno <= 2; passno++) {
|
||||||
if (setfsent() == 0) {
|
if (setfsent() == 0) {
|
||||||
fprintf(stderr, "Can't open checklist file: %s\n",
|
warnx("can't open checklist file: %s", _PATH_FSTAB);
|
||||||
_PATH_FSTAB);
|
|
||||||
return (8);
|
return (8);
|
||||||
}
|
}
|
||||||
while ((fsp = getfsent()) != 0) {
|
while ((fsp = getfsent()) != 0) {
|
||||||
@ -218,15 +222,11 @@ finddisk(name)
|
|||||||
dk->name[len] == 0)
|
dk->name[len] == 0)
|
||||||
return (dk);
|
return (dk);
|
||||||
}
|
}
|
||||||
if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL) {
|
if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
dk = *dkp;
|
dk = *dkp;
|
||||||
if ((dk->name = malloc(len + 1)) == NULL) {
|
if ((dk->name = malloc(len + 1)) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
(void)strncpy(dk->name, name, len);
|
(void)strncpy(dk->name, name, len);
|
||||||
dk->name[len] = '\0';
|
dk->name[len] = '\0';
|
||||||
dk->part = NULL;
|
dk->part = NULL;
|
||||||
@ -249,20 +249,14 @@ addpart(name, fsname, auxdata)
|
|||||||
printf("%s in fstab more than once!\n", name);
|
printf("%s in fstab more than once!\n", name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL) {
|
if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
pt = *ppt;
|
pt = *ppt;
|
||||||
if ((pt->name = malloc(strlen(name) + 1)) == NULL) {
|
if ((pt->name = malloc(strlen(name) + 1)) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
(void)strcpy(pt->name, name);
|
(void)strcpy(pt->name, name);
|
||||||
if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL) {
|
if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
(void)strcpy(pt->fsname, fsname);
|
(void)strcpy(pt->fsname, fsname);
|
||||||
pt->next = NULL;
|
pt->next = NULL;
|
||||||
pt->auxdata = auxdata;
|
pt->auxdata = auxdata;
|
||||||
@ -277,7 +271,7 @@ startdisk(dk, checkit)
|
|||||||
|
|
||||||
dk->pid = fork();
|
dk->pid = fork();
|
||||||
if (dk->pid < 0) {
|
if (dk->pid < 0) {
|
||||||
perror("fork");
|
warn("fork");
|
||||||
return (8);
|
return (8);
|
||||||
}
|
}
|
||||||
if (dk->pid == 0)
|
if (dk->pid == 0)
|
||||||
@ -297,14 +291,14 @@ blockcheck(origname)
|
|||||||
|
|
||||||
hotroot = 0;
|
hotroot = 0;
|
||||||
if (stat("/", &stslash) < 0) {
|
if (stat("/", &stslash) < 0) {
|
||||||
perror("/");
|
warn("/");
|
||||||
printf("Can't stat root\n");
|
printf("Can't stat root\n");
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
newname = origname;
|
newname = origname;
|
||||||
retry:
|
retry:
|
||||||
if (stat(newname, &stblock) < 0) {
|
if (stat(newname, &stblock) < 0) {
|
||||||
perror(newname);
|
warn("%s", newname);
|
||||||
printf("Can't stat %s\n", newname);
|
printf("Can't stat %s\n", newname);
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
@ -313,7 +307,7 @@ blockcheck(origname)
|
|||||||
hotroot++;
|
hotroot++;
|
||||||
raw = rawname(newname);
|
raw = rawname(newname);
|
||||||
if (stat(raw, &stchar) < 0) {
|
if (stat(raw, &stchar) < 0) {
|
||||||
perror(raw);
|
warn("%s", raw);
|
||||||
printf("Can't stat %s\n", raw);
|
printf("Can't stat %s\n", raw);
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
|
@ -32,14 +32,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95";
|
static const char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#define DKTYPENAMES
|
#define DKTYPENAMES
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <sys/disklabel.h>
|
#include <sys/disklabel.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
|
|
||||||
|
@ -32,11 +32,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95";
|
static const char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ufs/dir.h>
|
#include <ufs/ufs/dir.h>
|
||||||
@ -267,7 +270,7 @@ ckfini(markclean)
|
|||||||
free((char *)bp);
|
free((char *)bp);
|
||||||
}
|
}
|
||||||
if (bufhead.b_size != cnt)
|
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;
|
pbp = pdirbp = (struct bufarea *)0;
|
||||||
if (markclean && sblock.fs_clean == 0) {
|
if (markclean && sblock.fs_clean == 0) {
|
||||||
sblock.fs_clean = 1;
|
sblock.fs_clean = 1;
|
||||||
|
@ -32,11 +32,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ufs/dir.h>
|
#include <ufs/ufs/dir.h>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
.\" notice, this list of conditions and the following disclaimer in the
|
.\" notice, this list of conditions and the following disclaimer in the
|
||||||
.\" documentation and/or other materials provided with the distribution.
|
.\" documentation and/or other materials provided with the distribution.
|
||||||
.\" 3. All advertising materials mentioning features or use of this software
|
.\" 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
|
.\" This product includes software developed by the University of
|
||||||
.\" California, Berkeley and its contributors.
|
.\" California, Berkeley and its contributors.
|
||||||
.\" 4. Neither the name of the University nor the names of its contributors
|
.\" 4. Neither the name of the University nor the names of its contributors
|
||||||
@ -30,7 +30,7 @@
|
|||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" @(#)fsck.8 8.4 (Berkeley) 5/9/95
|
.\" @(#)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
|
.Dd May 9, 1995
|
||||||
.Dt FSCK 8
|
.Dt FSCK 8
|
||||||
@ -54,13 +54,13 @@
|
|||||||
.Ar ...
|
.Ar ...
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The first form of
|
The first form of
|
||||||
.Nm fsck
|
.Nm
|
||||||
preens a standard set of filesystems or the specified filesystems.
|
preens a standard set of filesystems or the specified filesystems.
|
||||||
It is normally used in the script
|
It is normally used in the script
|
||||||
.Pa /etc/rc
|
.Pa /etc/rc
|
||||||
during automatic reboot.
|
during automatic reboot.
|
||||||
Here
|
Here
|
||||||
.Nm fsck
|
.Nm
|
||||||
reads the table
|
reads the table
|
||||||
.Pa /etc/fstab
|
.Pa /etc/fstab
|
||||||
to determine which filesystems to check.
|
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.
|
are not marked clean are checked.
|
||||||
Filesystems are marked clean when they are unmounted,
|
Filesystems are marked clean when they are unmounted,
|
||||||
when they have been mounted read-only, or when
|
when they have been mounted read-only, or when
|
||||||
.Nm fsck
|
.Nm
|
||||||
runs on them successfully.
|
runs on them successfully.
|
||||||
If the
|
If the
|
||||||
.Fl f
|
.Fl f
|
||||||
@ -102,7 +102,7 @@ Counts in the super-block wrong
|
|||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
These are the only inconsistencies that
|
These are the only inconsistencies that
|
||||||
.Nm fsck
|
.Nm
|
||||||
with the
|
with the
|
||||||
.Fl p
|
.Fl p
|
||||||
option will correct; if it encounters other inconsistencies, it exits
|
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
|
For each corrected inconsistency one or more lines will be printed
|
||||||
identifying the filesystem on which the correction will take place,
|
identifying the filesystem on which the correction will take place,
|
||||||
and the nature of the correction. After successfully correcting a filesystem,
|
and the nature of the correction. After successfully correcting a filesystem,
|
||||||
.Nm fsck
|
.Nm
|
||||||
will print the number of files on that filesystem,
|
will print the number of files on that filesystem,
|
||||||
the number of used and free blocks,
|
the number of used and free blocks,
|
||||||
and the percentage of fragmentation.
|
and the percentage of fragmentation.
|
||||||
@ -118,7 +118,7 @@ and the percentage of fragmentation.
|
|||||||
If sent a
|
If sent a
|
||||||
.Dv QUIT
|
.Dv QUIT
|
||||||
signal,
|
signal,
|
||||||
.Nm fsck
|
.Nm
|
||||||
will finish the filesystem checks, then exit with an abnormal
|
will finish the filesystem checks, then exit with an abnormal
|
||||||
return status that causes an automatic reboot to fail.
|
return status that causes an automatic reboot to fail.
|
||||||
This is useful when you want to finish the filesystem checks during an
|
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
|
Without the
|
||||||
.Fl p
|
.Fl p
|
||||||
option,
|
option,
|
||||||
.Nm fsck
|
.Nm
|
||||||
audits and interactively repairs inconsistent conditions for filesystems.
|
audits and interactively repairs inconsistent conditions for filesystems.
|
||||||
If the filesystem is inconsistent the operator is prompted for concurrence
|
If the filesystem is inconsistent the operator is prompted for concurrence
|
||||||
before each correction is attempted.
|
before each correction is attempted.
|
||||||
@ -144,7 +144,7 @@ is to wait for the operator to respond
|
|||||||
or
|
or
|
||||||
.Li no .
|
.Li no .
|
||||||
If the operator does not have write permission on the filesystem
|
If the operator does not have write permission on the filesystem
|
||||||
.Nm fsck
|
.Nm
|
||||||
will default to a
|
will default to a
|
||||||
.Fl n
|
.Fl n
|
||||||
action.
|
action.
|
||||||
@ -158,7 +158,7 @@ and
|
|||||||
combined.
|
combined.
|
||||||
.Pp
|
.Pp
|
||||||
The following flags are interpreted by
|
The following flags are interpreted by
|
||||||
.Nm fsck .
|
.Nm Ns .
|
||||||
.Bl -tag -width indent
|
.Bl -tag -width indent
|
||||||
.It Fl b
|
.It Fl b
|
||||||
Use the block specified immediately after the flag as
|
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.
|
set of permissions such as 700.
|
||||||
.It Fl y
|
.It Fl y
|
||||||
Assume a yes response to all questions asked by
|
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
|
this should be used with great caution as this is a free license
|
||||||
to continue after essentially unlimited trouble has been encountered.
|
to continue after essentially unlimited trouble has been encountered.
|
||||||
.It Fl n
|
.It Fl n
|
||||||
Assume a no response to all questions asked by
|
Assume a no response to all questions asked by
|
||||||
.Nm fsck
|
.Nm
|
||||||
except for
|
except for
|
||||||
.Ql CONTINUE? ,
|
.Ql CONTINUE? ,
|
||||||
which is assumed to be affirmative;
|
which is assumed to be affirmative;
|
||||||
@ -210,7 +210,7 @@ If maxcontig is equal to one, delete any existing segment maps.
|
|||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
In interactive mode,
|
In interactive mode,
|
||||||
.Nm fsck
|
.Nm
|
||||||
will list the conversion to be made
|
will list the conversion to be made
|
||||||
and ask whether the conversion should be done.
|
and ask whether the conversion should be done.
|
||||||
If a negative answer is given,
|
If a negative answer is given,
|
||||||
@ -226,7 +226,7 @@ first line of output from
|
|||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
If no filesystems are given to
|
If no filesystems are given to
|
||||||
.Nm fsck
|
.Nm
|
||||||
then a default list of filesystems is read from
|
then a default list of filesystems is read from
|
||||||
the file
|
the file
|
||||||
.Pa /etc/fstab .
|
.Pa /etc/fstab .
|
||||||
@ -296,7 +296,7 @@ contains default list of filesystems to check.
|
|||||||
.El
|
.El
|
||||||
.Sh DIAGNOSTICS
|
.Sh DIAGNOSTICS
|
||||||
The diagnostics produced by
|
The diagnostics produced by
|
||||||
.Nm fsck
|
.Nm
|
||||||
are fully enumerated and explained in Appendix A of
|
are fully enumerated and explained in Appendix A of
|
||||||
.Rs
|
.Rs
|
||||||
.%T "Fsck \- The UNIX File System Check Program"
|
.%T "Fsck \- The UNIX File System Check Program"
|
||||||
|
@ -32,7 +32,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -339,7 +343,7 @@ resetinodebuf()
|
|||||||
}
|
}
|
||||||
if (inodebuf == NULL &&
|
if (inodebuf == NULL &&
|
||||||
(inodebuf = (struct dinode *)malloc((unsigned)inobufsize)) == 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)
|
while (nextino < ROOTINO)
|
||||||
(void)getnextinode(nextino);
|
(void)getnextinode(nextino);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ static const char copyright[] =
|
|||||||
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95";
|
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95";
|
||||||
#endif
|
#endif
|
||||||
static const char rcsid[] =
|
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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -53,10 +53,8 @@ static const char rcsid[] =
|
|||||||
#include <ufs/ufs/ufsmount.h>
|
#include <ufs/ufs/ufsmount.h>
|
||||||
#include <ufs/ffs/fs.h>
|
#include <ufs/ffs/fs.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <fstab.h>
|
#include <fstab.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "fsck.h"
|
#include "fsck.h"
|
||||||
|
|
||||||
|
@ -32,11 +32,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ufs/dir.h>
|
#include <ufs/ufs/dir.h>
|
||||||
|
@ -32,11 +32,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass1b.c 8.4 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)pass1b.c 8.4 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ffs/fs.h>
|
#include <ufs/ffs/fs.h>
|
||||||
|
@ -32,15 +32,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass2.c 8.9 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)pass2.c 8.9 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ufs/dir.h>
|
#include <ufs/ufs/dir.h>
|
||||||
#include <ufs/ffs/fs.h>
|
|
||||||
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -32,14 +32,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass3.c 8.2 (Berkeley) 4/27/95";
|
static const char sccsid[] = "@(#)pass3.c 8.2 (Berkeley) 4/27/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ffs/fs.h>
|
|
||||||
|
|
||||||
#include "fsck.h"
|
#include "fsck.h"
|
||||||
|
|
||||||
|
@ -32,14 +32,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ffs/fs.h>
|
|
||||||
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -32,11 +32,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass5.c 8.9 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)pass5.c 8.9 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ffs/fs.h>
|
#include <ufs/ffs/fs.h>
|
||||||
|
@ -32,7 +32,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#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 <ufs/ufs/dinode.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <err.h>
|
||||||
#include <fstab.h>
|
#include <fstab.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -88,8 +93,7 @@ checkfstab(preen, maxrun, docheck, chkit)
|
|||||||
sumstatus = 0;
|
sumstatus = 0;
|
||||||
for (passno = 1; passno <= 2; passno++) {
|
for (passno = 1; passno <= 2; passno++) {
|
||||||
if (setfsent() == 0) {
|
if (setfsent() == 0) {
|
||||||
fprintf(stderr, "Can't open checklist file: %s\n",
|
warnx("can't open checklist file: %s", _PATH_FSTAB);
|
||||||
_PATH_FSTAB);
|
|
||||||
return (8);
|
return (8);
|
||||||
}
|
}
|
||||||
while ((fsp = getfsent()) != 0) {
|
while ((fsp = getfsent()) != 0) {
|
||||||
@ -218,15 +222,11 @@ finddisk(name)
|
|||||||
dk->name[len] == 0)
|
dk->name[len] == 0)
|
||||||
return (dk);
|
return (dk);
|
||||||
}
|
}
|
||||||
if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL) {
|
if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
dk = *dkp;
|
dk = *dkp;
|
||||||
if ((dk->name = malloc(len + 1)) == NULL) {
|
if ((dk->name = malloc(len + 1)) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
(void)strncpy(dk->name, name, len);
|
(void)strncpy(dk->name, name, len);
|
||||||
dk->name[len] = '\0';
|
dk->name[len] = '\0';
|
||||||
dk->part = NULL;
|
dk->part = NULL;
|
||||||
@ -249,20 +249,14 @@ addpart(name, fsname, auxdata)
|
|||||||
printf("%s in fstab more than once!\n", name);
|
printf("%s in fstab more than once!\n", name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL) {
|
if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
pt = *ppt;
|
pt = *ppt;
|
||||||
if ((pt->name = malloc(strlen(name) + 1)) == NULL) {
|
if ((pt->name = malloc(strlen(name) + 1)) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
(void)strcpy(pt->name, name);
|
(void)strcpy(pt->name, name);
|
||||||
if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL) {
|
if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
(void)strcpy(pt->fsname, fsname);
|
(void)strcpy(pt->fsname, fsname);
|
||||||
pt->next = NULL;
|
pt->next = NULL;
|
||||||
pt->auxdata = auxdata;
|
pt->auxdata = auxdata;
|
||||||
@ -277,7 +271,7 @@ startdisk(dk, checkit)
|
|||||||
|
|
||||||
dk->pid = fork();
|
dk->pid = fork();
|
||||||
if (dk->pid < 0) {
|
if (dk->pid < 0) {
|
||||||
perror("fork");
|
warn("fork");
|
||||||
return (8);
|
return (8);
|
||||||
}
|
}
|
||||||
if (dk->pid == 0)
|
if (dk->pid == 0)
|
||||||
@ -297,14 +291,14 @@ blockcheck(origname)
|
|||||||
|
|
||||||
hotroot = 0;
|
hotroot = 0;
|
||||||
if (stat("/", &stslash) < 0) {
|
if (stat("/", &stslash) < 0) {
|
||||||
perror("/");
|
warn("/");
|
||||||
printf("Can't stat root\n");
|
printf("Can't stat root\n");
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
newname = origname;
|
newname = origname;
|
||||||
retry:
|
retry:
|
||||||
if (stat(newname, &stblock) < 0) {
|
if (stat(newname, &stblock) < 0) {
|
||||||
perror(newname);
|
warn("%s", newname);
|
||||||
printf("Can't stat %s\n", newname);
|
printf("Can't stat %s\n", newname);
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
@ -313,7 +307,7 @@ blockcheck(origname)
|
|||||||
hotroot++;
|
hotroot++;
|
||||||
raw = rawname(newname);
|
raw = rawname(newname);
|
||||||
if (stat(raw, &stchar) < 0) {
|
if (stat(raw, &stchar) < 0) {
|
||||||
perror(raw);
|
warn("%s", raw);
|
||||||
printf("Can't stat %s\n", raw);
|
printf("Can't stat %s\n", raw);
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
|
@ -32,14 +32,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95";
|
static const char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#define DKTYPENAMES
|
#define DKTYPENAMES
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <sys/disklabel.h>
|
#include <sys/disklabel.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
|
|
||||||
|
@ -32,11 +32,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95";
|
static const char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ufs/dir.h>
|
#include <ufs/ufs/dir.h>
|
||||||
@ -267,7 +270,7 @@ ckfini(markclean)
|
|||||||
free((char *)bp);
|
free((char *)bp);
|
||||||
}
|
}
|
||||||
if (bufhead.b_size != cnt)
|
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;
|
pbp = pdirbp = (struct bufarea *)0;
|
||||||
if (markclean && sblock.fs_clean == 0) {
|
if (markclean && sblock.fs_clean == 0) {
|
||||||
sblock.fs_clean = 1;
|
sblock.fs_clean = 1;
|
||||||
|
@ -32,11 +32,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ufs/dir.h>
|
#include <ufs/ufs/dir.h>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
.\" notice, this list of conditions and the following disclaimer in the
|
.\" notice, this list of conditions and the following disclaimer in the
|
||||||
.\" documentation and/or other materials provided with the distribution.
|
.\" documentation and/or other materials provided with the distribution.
|
||||||
.\" 3. All advertising materials mentioning features or use of this software
|
.\" 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
|
.\" This product includes software developed by the University of
|
||||||
.\" California, Berkeley and its contributors.
|
.\" California, Berkeley and its contributors.
|
||||||
.\" 4. Neither the name of the University nor the names of its contributors
|
.\" 4. Neither the name of the University nor the names of its contributors
|
||||||
@ -30,7 +30,7 @@
|
|||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" @(#)fsck.8 8.4 (Berkeley) 5/9/95
|
.\" @(#)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
|
.Dd May 9, 1995
|
||||||
.Dt FSCK 8
|
.Dt FSCK 8
|
||||||
@ -54,13 +54,13 @@
|
|||||||
.Ar ...
|
.Ar ...
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The first form of
|
The first form of
|
||||||
.Nm fsck
|
.Nm
|
||||||
preens a standard set of filesystems or the specified filesystems.
|
preens a standard set of filesystems or the specified filesystems.
|
||||||
It is normally used in the script
|
It is normally used in the script
|
||||||
.Pa /etc/rc
|
.Pa /etc/rc
|
||||||
during automatic reboot.
|
during automatic reboot.
|
||||||
Here
|
Here
|
||||||
.Nm fsck
|
.Nm
|
||||||
reads the table
|
reads the table
|
||||||
.Pa /etc/fstab
|
.Pa /etc/fstab
|
||||||
to determine which filesystems to check.
|
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.
|
are not marked clean are checked.
|
||||||
Filesystems are marked clean when they are unmounted,
|
Filesystems are marked clean when they are unmounted,
|
||||||
when they have been mounted read-only, or when
|
when they have been mounted read-only, or when
|
||||||
.Nm fsck
|
.Nm
|
||||||
runs on them successfully.
|
runs on them successfully.
|
||||||
If the
|
If the
|
||||||
.Fl f
|
.Fl f
|
||||||
@ -102,7 +102,7 @@ Counts in the super-block wrong
|
|||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
These are the only inconsistencies that
|
These are the only inconsistencies that
|
||||||
.Nm fsck
|
.Nm
|
||||||
with the
|
with the
|
||||||
.Fl p
|
.Fl p
|
||||||
option will correct; if it encounters other inconsistencies, it exits
|
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
|
For each corrected inconsistency one or more lines will be printed
|
||||||
identifying the filesystem on which the correction will take place,
|
identifying the filesystem on which the correction will take place,
|
||||||
and the nature of the correction. After successfully correcting a filesystem,
|
and the nature of the correction. After successfully correcting a filesystem,
|
||||||
.Nm fsck
|
.Nm
|
||||||
will print the number of files on that filesystem,
|
will print the number of files on that filesystem,
|
||||||
the number of used and free blocks,
|
the number of used and free blocks,
|
||||||
and the percentage of fragmentation.
|
and the percentage of fragmentation.
|
||||||
@ -118,7 +118,7 @@ and the percentage of fragmentation.
|
|||||||
If sent a
|
If sent a
|
||||||
.Dv QUIT
|
.Dv QUIT
|
||||||
signal,
|
signal,
|
||||||
.Nm fsck
|
.Nm
|
||||||
will finish the filesystem checks, then exit with an abnormal
|
will finish the filesystem checks, then exit with an abnormal
|
||||||
return status that causes an automatic reboot to fail.
|
return status that causes an automatic reboot to fail.
|
||||||
This is useful when you want to finish the filesystem checks during an
|
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
|
Without the
|
||||||
.Fl p
|
.Fl p
|
||||||
option,
|
option,
|
||||||
.Nm fsck
|
.Nm
|
||||||
audits and interactively repairs inconsistent conditions for filesystems.
|
audits and interactively repairs inconsistent conditions for filesystems.
|
||||||
If the filesystem is inconsistent the operator is prompted for concurrence
|
If the filesystem is inconsistent the operator is prompted for concurrence
|
||||||
before each correction is attempted.
|
before each correction is attempted.
|
||||||
@ -144,7 +144,7 @@ is to wait for the operator to respond
|
|||||||
or
|
or
|
||||||
.Li no .
|
.Li no .
|
||||||
If the operator does not have write permission on the filesystem
|
If the operator does not have write permission on the filesystem
|
||||||
.Nm fsck
|
.Nm
|
||||||
will default to a
|
will default to a
|
||||||
.Fl n
|
.Fl n
|
||||||
action.
|
action.
|
||||||
@ -158,7 +158,7 @@ and
|
|||||||
combined.
|
combined.
|
||||||
.Pp
|
.Pp
|
||||||
The following flags are interpreted by
|
The following flags are interpreted by
|
||||||
.Nm fsck .
|
.Nm Ns .
|
||||||
.Bl -tag -width indent
|
.Bl -tag -width indent
|
||||||
.It Fl b
|
.It Fl b
|
||||||
Use the block specified immediately after the flag as
|
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.
|
set of permissions such as 700.
|
||||||
.It Fl y
|
.It Fl y
|
||||||
Assume a yes response to all questions asked by
|
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
|
this should be used with great caution as this is a free license
|
||||||
to continue after essentially unlimited trouble has been encountered.
|
to continue after essentially unlimited trouble has been encountered.
|
||||||
.It Fl n
|
.It Fl n
|
||||||
Assume a no response to all questions asked by
|
Assume a no response to all questions asked by
|
||||||
.Nm fsck
|
.Nm
|
||||||
except for
|
except for
|
||||||
.Ql CONTINUE? ,
|
.Ql CONTINUE? ,
|
||||||
which is assumed to be affirmative;
|
which is assumed to be affirmative;
|
||||||
@ -210,7 +210,7 @@ If maxcontig is equal to one, delete any existing segment maps.
|
|||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
In interactive mode,
|
In interactive mode,
|
||||||
.Nm fsck
|
.Nm
|
||||||
will list the conversion to be made
|
will list the conversion to be made
|
||||||
and ask whether the conversion should be done.
|
and ask whether the conversion should be done.
|
||||||
If a negative answer is given,
|
If a negative answer is given,
|
||||||
@ -226,7 +226,7 @@ first line of output from
|
|||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
If no filesystems are given to
|
If no filesystems are given to
|
||||||
.Nm fsck
|
.Nm
|
||||||
then a default list of filesystems is read from
|
then a default list of filesystems is read from
|
||||||
the file
|
the file
|
||||||
.Pa /etc/fstab .
|
.Pa /etc/fstab .
|
||||||
@ -296,7 +296,7 @@ contains default list of filesystems to check.
|
|||||||
.El
|
.El
|
||||||
.Sh DIAGNOSTICS
|
.Sh DIAGNOSTICS
|
||||||
The diagnostics produced by
|
The diagnostics produced by
|
||||||
.Nm fsck
|
.Nm
|
||||||
are fully enumerated and explained in Appendix A of
|
are fully enumerated and explained in Appendix A of
|
||||||
.Rs
|
.Rs
|
||||||
.%T "Fsck \- The UNIX File System Check Program"
|
.%T "Fsck \- The UNIX File System Check Program"
|
||||||
|
@ -32,7 +32,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -339,7 +343,7 @@ resetinodebuf()
|
|||||||
}
|
}
|
||||||
if (inodebuf == NULL &&
|
if (inodebuf == NULL &&
|
||||||
(inodebuf = (struct dinode *)malloc((unsigned)inobufsize)) == 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)
|
while (nextino < ROOTINO)
|
||||||
(void)getnextinode(nextino);
|
(void)getnextinode(nextino);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ static const char copyright[] =
|
|||||||
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95";
|
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95";
|
||||||
#endif
|
#endif
|
||||||
static const char rcsid[] =
|
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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -53,10 +53,8 @@ static const char rcsid[] =
|
|||||||
#include <ufs/ufs/ufsmount.h>
|
#include <ufs/ufs/ufsmount.h>
|
||||||
#include <ufs/ffs/fs.h>
|
#include <ufs/ffs/fs.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <fstab.h>
|
#include <fstab.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "fsck.h"
|
#include "fsck.h"
|
||||||
|
|
||||||
|
@ -32,11 +32,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ufs/dir.h>
|
#include <ufs/ufs/dir.h>
|
||||||
|
@ -32,11 +32,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass1b.c 8.4 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)pass1b.c 8.4 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ffs/fs.h>
|
#include <ufs/ffs/fs.h>
|
||||||
|
@ -32,15 +32,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass2.c 8.9 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)pass2.c 8.9 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ufs/dir.h>
|
#include <ufs/ufs/dir.h>
|
||||||
#include <ufs/ffs/fs.h>
|
|
||||||
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -32,14 +32,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass3.c 8.2 (Berkeley) 4/27/95";
|
static const char sccsid[] = "@(#)pass3.c 8.2 (Berkeley) 4/27/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ffs/fs.h>
|
|
||||||
|
|
||||||
#include "fsck.h"
|
#include "fsck.h"
|
||||||
|
|
||||||
|
@ -32,14 +32,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ffs/fs.h>
|
|
||||||
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -32,11 +32,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)pass5.c 8.9 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)pass5.c 8.9 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ffs/fs.h>
|
#include <ufs/ffs/fs.h>
|
||||||
|
@ -32,7 +32,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#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 <ufs/ufs/dinode.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <err.h>
|
||||||
#include <fstab.h>
|
#include <fstab.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -88,8 +93,7 @@ checkfstab(preen, maxrun, docheck, chkit)
|
|||||||
sumstatus = 0;
|
sumstatus = 0;
|
||||||
for (passno = 1; passno <= 2; passno++) {
|
for (passno = 1; passno <= 2; passno++) {
|
||||||
if (setfsent() == 0) {
|
if (setfsent() == 0) {
|
||||||
fprintf(stderr, "Can't open checklist file: %s\n",
|
warnx("can't open checklist file: %s", _PATH_FSTAB);
|
||||||
_PATH_FSTAB);
|
|
||||||
return (8);
|
return (8);
|
||||||
}
|
}
|
||||||
while ((fsp = getfsent()) != 0) {
|
while ((fsp = getfsent()) != 0) {
|
||||||
@ -218,15 +222,11 @@ finddisk(name)
|
|||||||
dk->name[len] == 0)
|
dk->name[len] == 0)
|
||||||
return (dk);
|
return (dk);
|
||||||
}
|
}
|
||||||
if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL) {
|
if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
dk = *dkp;
|
dk = *dkp;
|
||||||
if ((dk->name = malloc(len + 1)) == NULL) {
|
if ((dk->name = malloc(len + 1)) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
(void)strncpy(dk->name, name, len);
|
(void)strncpy(dk->name, name, len);
|
||||||
dk->name[len] = '\0';
|
dk->name[len] = '\0';
|
||||||
dk->part = NULL;
|
dk->part = NULL;
|
||||||
@ -249,20 +249,14 @@ addpart(name, fsname, auxdata)
|
|||||||
printf("%s in fstab more than once!\n", name);
|
printf("%s in fstab more than once!\n", name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL) {
|
if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
pt = *ppt;
|
pt = *ppt;
|
||||||
if ((pt->name = malloc(strlen(name) + 1)) == NULL) {
|
if ((pt->name = malloc(strlen(name) + 1)) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
(void)strcpy(pt->name, name);
|
(void)strcpy(pt->name, name);
|
||||||
if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL) {
|
if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
(void)strcpy(pt->fsname, fsname);
|
(void)strcpy(pt->fsname, fsname);
|
||||||
pt->next = NULL;
|
pt->next = NULL;
|
||||||
pt->auxdata = auxdata;
|
pt->auxdata = auxdata;
|
||||||
@ -277,7 +271,7 @@ startdisk(dk, checkit)
|
|||||||
|
|
||||||
dk->pid = fork();
|
dk->pid = fork();
|
||||||
if (dk->pid < 0) {
|
if (dk->pid < 0) {
|
||||||
perror("fork");
|
warn("fork");
|
||||||
return (8);
|
return (8);
|
||||||
}
|
}
|
||||||
if (dk->pid == 0)
|
if (dk->pid == 0)
|
||||||
@ -297,14 +291,14 @@ blockcheck(origname)
|
|||||||
|
|
||||||
hotroot = 0;
|
hotroot = 0;
|
||||||
if (stat("/", &stslash) < 0) {
|
if (stat("/", &stslash) < 0) {
|
||||||
perror("/");
|
warn("/");
|
||||||
printf("Can't stat root\n");
|
printf("Can't stat root\n");
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
newname = origname;
|
newname = origname;
|
||||||
retry:
|
retry:
|
||||||
if (stat(newname, &stblock) < 0) {
|
if (stat(newname, &stblock) < 0) {
|
||||||
perror(newname);
|
warn("%s", newname);
|
||||||
printf("Can't stat %s\n", newname);
|
printf("Can't stat %s\n", newname);
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
@ -313,7 +307,7 @@ blockcheck(origname)
|
|||||||
hotroot++;
|
hotroot++;
|
||||||
raw = rawname(newname);
|
raw = rawname(newname);
|
||||||
if (stat(raw, &stchar) < 0) {
|
if (stat(raw, &stchar) < 0) {
|
||||||
perror(raw);
|
warn("%s", raw);
|
||||||
printf("Can't stat %s\n", raw);
|
printf("Can't stat %s\n", raw);
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
|
@ -32,14 +32,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95";
|
static const char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#define DKTYPENAMES
|
#define DKTYPENAMES
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <sys/disklabel.h>
|
#include <sys/disklabel.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
|
|
||||||
|
@ -32,11 +32,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95";
|
static const char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <ufs/ufs/dinode.h>
|
#include <ufs/ufs/dinode.h>
|
||||||
#include <ufs/ufs/dir.h>
|
#include <ufs/ufs/dir.h>
|
||||||
@ -267,7 +270,7 @@ ckfini(markclean)
|
|||||||
free((char *)bp);
|
free((char *)bp);
|
||||||
}
|
}
|
||||||
if (bufhead.b_size != cnt)
|
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;
|
pbp = pdirbp = (struct bufarea *)0;
|
||||||
if (markclean && sblock.fs_clean == 0) {
|
if (markclean && sblock.fs_clean == 0) {
|
||||||
sblock.fs_clean = 1;
|
sblock.fs_clean = 1;
|
||||||
|
@ -32,7 +32,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95";
|
static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#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 <ufs/ufs/dinode.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <err.h>
|
||||||
#include <fstab.h>
|
#include <fstab.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -88,8 +93,7 @@ checkfstab(preen, maxrun, docheck, chkit)
|
|||||||
sumstatus = 0;
|
sumstatus = 0;
|
||||||
for (passno = 1; passno <= 2; passno++) {
|
for (passno = 1; passno <= 2; passno++) {
|
||||||
if (setfsent() == 0) {
|
if (setfsent() == 0) {
|
||||||
fprintf(stderr, "Can't open checklist file: %s\n",
|
warnx("can't open checklist file: %s", _PATH_FSTAB);
|
||||||
_PATH_FSTAB);
|
|
||||||
return (8);
|
return (8);
|
||||||
}
|
}
|
||||||
while ((fsp = getfsent()) != 0) {
|
while ((fsp = getfsent()) != 0) {
|
||||||
@ -218,15 +222,11 @@ finddisk(name)
|
|||||||
dk->name[len] == 0)
|
dk->name[len] == 0)
|
||||||
return (dk);
|
return (dk);
|
||||||
}
|
}
|
||||||
if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL) {
|
if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
dk = *dkp;
|
dk = *dkp;
|
||||||
if ((dk->name = malloc(len + 1)) == NULL) {
|
if ((dk->name = malloc(len + 1)) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
(void)strncpy(dk->name, name, len);
|
(void)strncpy(dk->name, name, len);
|
||||||
dk->name[len] = '\0';
|
dk->name[len] = '\0';
|
||||||
dk->part = NULL;
|
dk->part = NULL;
|
||||||
@ -249,20 +249,14 @@ addpart(name, fsname, auxdata)
|
|||||||
printf("%s in fstab more than once!\n", name);
|
printf("%s in fstab more than once!\n", name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL) {
|
if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
pt = *ppt;
|
pt = *ppt;
|
||||||
if ((pt->name = malloc(strlen(name) + 1)) == NULL) {
|
if ((pt->name = malloc(strlen(name) + 1)) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
(void)strcpy(pt->name, name);
|
(void)strcpy(pt->name, name);
|
||||||
if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL) {
|
if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL)
|
||||||
fprintf(stderr, "out of memory");
|
errx(8, "out of memory");
|
||||||
exit (8);
|
|
||||||
}
|
|
||||||
(void)strcpy(pt->fsname, fsname);
|
(void)strcpy(pt->fsname, fsname);
|
||||||
pt->next = NULL;
|
pt->next = NULL;
|
||||||
pt->auxdata = auxdata;
|
pt->auxdata = auxdata;
|
||||||
@ -277,7 +271,7 @@ startdisk(dk, checkit)
|
|||||||
|
|
||||||
dk->pid = fork();
|
dk->pid = fork();
|
||||||
if (dk->pid < 0) {
|
if (dk->pid < 0) {
|
||||||
perror("fork");
|
warn("fork");
|
||||||
return (8);
|
return (8);
|
||||||
}
|
}
|
||||||
if (dk->pid == 0)
|
if (dk->pid == 0)
|
||||||
@ -297,14 +291,14 @@ blockcheck(origname)
|
|||||||
|
|
||||||
hotroot = 0;
|
hotroot = 0;
|
||||||
if (stat("/", &stslash) < 0) {
|
if (stat("/", &stslash) < 0) {
|
||||||
perror("/");
|
warn("/");
|
||||||
printf("Can't stat root\n");
|
printf("Can't stat root\n");
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
newname = origname;
|
newname = origname;
|
||||||
retry:
|
retry:
|
||||||
if (stat(newname, &stblock) < 0) {
|
if (stat(newname, &stblock) < 0) {
|
||||||
perror(newname);
|
warn("%s", newname);
|
||||||
printf("Can't stat %s\n", newname);
|
printf("Can't stat %s\n", newname);
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
@ -313,7 +307,7 @@ blockcheck(origname)
|
|||||||
hotroot++;
|
hotroot++;
|
||||||
raw = rawname(newname);
|
raw = rawname(newname);
|
||||||
if (stat(raw, &stchar) < 0) {
|
if (stat(raw, &stchar) < 0) {
|
||||||
perror(raw);
|
warn("%s", raw);
|
||||||
printf("Can't stat %s\n", raw);
|
printf("Can't stat %s\n", raw);
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user