Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/fsck_ffs - implement -F; treat provided filesystems as ...



details:   https://anonhg.NetBSD.org/src/rev/2ee79d3d2d04
branches:  trunk
changeset: 513850:2ee79d3d2d04
user:      lukem <lukem%NetBSD.org@localhost>
date:      Wed Aug 15 03:54:53 2001 +0000

description:
- implement -F; treat provided filesystems as images in regular files
- replace "filesystem" with "file system" as appropriate
- grammar fixes

diffstat:

 sbin/fsck_ffs/fsck.h      |   3 +-
 sbin/fsck_ffs/fsck_ffs.8  |  60 +++++++++++++++++++++++++---------------------
 sbin/fsck_ffs/main.c      |  15 +++++++---
 sbin/fsck_ffs/setup.c     |  12 +++++++--
 sbin/fsck_ffs/utilities.c |   6 ++--
 5 files changed, 57 insertions(+), 39 deletions(-)

diffs (truncated from 302 to 300 lines):

diff -r 09993333c00a -r 2ee79d3d2d04 sbin/fsck_ffs/fsck.h
--- a/sbin/fsck_ffs/fsck.h      Wed Aug 15 03:40:50 2001 +0000
+++ b/sbin/fsck_ffs/fsck.h      Wed Aug 15 03:54:53 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fsck.h,v 1.25 2001/08/15 03:40:50 lukem Exp $  */
+/*     $NetBSD: fsck.h,v 1.26 2001/08/15 03:54:53 lukem Exp $  */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -187,6 +187,7 @@
 int    newinofmt;              /* filesystem has new inode format */
 char   usedsoftdep;            /* just fix soft dependency inconsistencies */
 int    preen;                  /* just fix normal inconsistencies */
+int    forceimage;             /* file system is an image file */
 int    doswap;                 /* convert byte order */
 int    needswap;               /* need to convert byte order in memory */
 int    do_blkswap;             /* need to do block addr byteswap */
diff -r 09993333c00a -r 2ee79d3d2d04 sbin/fsck_ffs/fsck_ffs.8
--- a/sbin/fsck_ffs/fsck_ffs.8  Wed Aug 15 03:40:50 2001 +0000
+++ b/sbin/fsck_ffs/fsck_ffs.8  Wed Aug 15 03:54:53 2001 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: fsck_ffs.8,v 1.24 2001/06/05 11:22:45 wiz Exp $
+.\"    $NetBSD: fsck_ffs.8,v 1.25 2001/08/15 03:54:53 lukem Exp $
 .\"
 .\" Copyright (c) 1980, 1989, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -33,7 +33,7 @@
 .\"
 .\"    @(#)fsck.8      8.3 (Berkeley) 11/29/94
 .\"
-.Dd November 29, 1994
+.Dd August 15, 2001
 .Dt FSCK_FFS 8
 .Os
 .Sh NAME
@@ -45,6 +45,7 @@
 .Op Fl b Ar block#
 .Op Fl c Ar level
 .Op Fl d
+.Op Fl F
 .Op Fl f
 .Op Fl m Ar mode
 .Op Fl p
@@ -53,11 +54,11 @@
 .Ar filesystem ...
 .Sh DESCRIPTION
 .Nm
-performs interactive filesystem consistency checks and repair for each of
-the filesystems specified on the command line. It is normally invoked from
+performs interactive file system consistency checks and repair for each of
+the file systems specified on the command line. It is normally invoked from
 .Xr fsck 8 .
 .Pp
-The kernel takes care that only a restricted class of innocuous filesystem
+The kernel takes care that only a restricted class of innocuous file system
 inconsistencies can happen unless hardware or software failures intervene.
 These are limited to the following:
 .Pp
@@ -82,10 +83,11 @@
 option) will correct; if it encounters other inconsistencies, it exits
 with an abnormal return status.
 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,
+identifying the file system on which the correction will take place,
+and the nature of the correction.  After successfully correcting a file
+system,
 .Nm
-will print the number of files on that filesystem,
+will print the number of files on that file system,
 the number of used and free blocks,
 and the percentage of fragmentation.
 .Pp
@@ -93,14 +95,14 @@
 .Dv QUIT
 signal,
 .Nm
-will finish the filesystem checks, then exit with an abnormal return status.
+will finish the file system checks, then exit with an abnormal return status.
 .Pp
 Without the
 .Fl p
 option,
 .Nm
-audits and interactively repairs inconsistent conditions for filesystems. 
-If the filesystem is inconsistent the operator is prompted for concurrence
+audits and interactively repairs inconsistent conditions for file systems. 
+If the file system is inconsistent the operator is prompted for concurrence
 before each correction is attempted.
 It should be noted that some of the corrective actions which are not
 correctable under the
@@ -113,7 +115,7 @@
 .Li yes
 or
 .Li no .
-If the operator does not have write permission on the filesystem
+If the operator does not have write permission on the file system
 .Nm
 will default to a 
 .Fl n
@@ -131,29 +133,29 @@
 .Nm "" .
 .Bl -tag -width indent
 .It Fl B
-Convert the filesystem metadatas to the specified byte order if needed.
+Convert the file system metadata to the specified byte order if needed.
 Valid byte order are `be' and `le'. If
 .Nm ""
-is interrupted while swapping the metadatas byte order, the filesystem cannot
+is interrupted while swapping the metadata byte order, the file system cannot
 be recovered. 
 .Nm "" 
-will print a message in interactive mode if the filesystem is not in host
+will print a message in interactive mode if the file system is not in host
 byte order.
 .It Fl b
 Use the block specified immediately after the flag as
-the super block for the filesystem.  Block 32 is usually
+the super block for the file system.  Block 32 is usually
 an alternative super block.
 .It Fl c
-Convert the filesystem to the specified level.
-Note that the level of a filesystem can only be raised.
+Convert the file system to the specified level.
+Note that the level of a file system can only be raised.
 .Bl -tag -width indent
 There are currently four levels defined:
 .It 0
-The filesystem is in the old (static table) format.
+The file system is in the old (static table) format.
 .It 1
-The filesystem is in the new (dynamic table) format.
+The file system is in the new (dynamic table) format.
 .It 2
-The filesystem supports 32-bit uid's and gid's,
+The file system supports 32-bit uid's and gid's,
 short symbolic links are stored in the inode, 
 and directories have an added field showing the file type.
 .It 3
@@ -167,17 +169,21 @@
 will list the conversion to be made
 and ask whether the conversion should be done.
 If a negative answer is given,
-no further operations are done on the filesystem.
+no further operations are done on the file system.
 In preen mode,
 the conversion is listed and done if
 possible without user interaction.
-Conversion in preen mode is best used when all the filesystems
+Conversion in preen mode is best used when all the file systems
 are being converted at once.
-The format of a filesystem can be determined from the
+The format of a file system can be determined from the
 second line of output from 
 .Xr dumpfs 8 .
 .It Fl d
 Print debugging output.
+.It Fl F
+Indicates that
+.Ar filesystem
+is a file system image in a regular file.
 .It Fl f
 Force checking of file systems.  Normally, if a file system is cleanly
 unmounted, the kernel will set a
@@ -201,7 +207,7 @@
 except for
 .Ql CONTINUE? ,
 which is assumed to be affirmative;
-do not open the filesystem for writing.
+do not open the file system for writing.
 .It Fl p
 Specify ``preen'' mode, described above.
 .It Fl y
@@ -216,7 +222,7 @@
 .It
 Blocks claimed by more than one inode or the free map.
 .It
-Blocks claimed by an inode outside the range of the filesystem.
+Blocks claimed by an inode outside the range of the file system.
 .It
 Incorrect link counts.
 .It
@@ -246,7 +252,7 @@
 Super Block checks:
 .Bl -item -indent indent -compact
 .It 
-More blocks for inodes than there are in the filesystem.
+More blocks for inodes than there are in the file system.
 .It
 Bad free block map format.
 .It
diff -r 09993333c00a -r 2ee79d3d2d04 sbin/fsck_ffs/main.c
--- a/sbin/fsck_ffs/main.c      Wed Aug 15 03:40:50 2001 +0000
+++ b/sbin/fsck_ffs/main.c      Wed Aug 15 03:54:53 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.39 2001/02/23 07:51:41 christos Exp $       */
+/*     $NetBSD: main.c,v 1.40 2001/08/15 03:54:53 lukem Exp $  */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.6 (Berkeley) 5/14/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.39 2001/02/23 07:51:41 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.40 2001/08/15 03:54:53 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -95,8 +95,9 @@
        sync();
        skipclean = 1;
        markclean = 1;
+       forceimage = 0;
        endian = 0;
-       while ((ch = getopt(argc, argv, "B:b:c:dfm:npy")) != -1) {
+       while ((ch = getopt(argc, argv, "B:b:c:dFfm:npy")) != -1) {
                switch (ch) {
                case 'B':
                        if (strcmp(optarg, "be") == 0)
@@ -121,6 +122,10 @@
                        debug++;
                        break;
 
+               case 'F':
+                       forceimage = 1;
+                       break;
+
                case 'f':
                        skipclean = 0;
                        break;
@@ -380,8 +385,8 @@
 {
 
        (void) fprintf(stderr,
-           "Usage: %s [-dfnpy] [-B be|le] [-b block] [-c level] [-m mode]"
-                       "filesystem ...\n",
+           "Usage: %s [-dFfnpy] [-B be|le] [-b block] [-c level] [-m mode]"
+           " filesystem ...\n",
            getprogname());
        exit(1);
 }
diff -r 09993333c00a -r 2ee79d3d2d04 sbin/fsck_ffs/setup.c
--- a/sbin/fsck_ffs/setup.c     Wed Aug 15 03:40:50 2001 +0000
+++ b/sbin/fsck_ffs/setup.c     Wed Aug 15 03:54:53 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: setup.c,v 1.43 2001/07/04 22:43:35 hubertf Exp $       */
+/*     $NetBSD: setup.c,v 1.44 2001/08/15 03:54:53 lukem Exp $ */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)setup.c    8.10 (Berkeley) 5/9/95";
 #else
-__RCSID("$NetBSD: setup.c,v 1.43 2001/07/04 22:43:35 hubertf Exp $");
+__RCSID("$NetBSD: setup.c,v 1.44 2001/08/15 03:54:53 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -98,7 +98,13 @@
                printf("Can't stat %s: %s\n", dev, strerror(errno));
                return (0);
        }
-       if (!S_ISCHR(statb.st_mode)) {
+       if (forceimage) {
+               if (!S_ISREG(statb.st_mode)) {
+                       pfatal("%s is not a regular file", dev);
+                       if (reply("CONTINUE") == 0)
+                               return (0);
+               }
+       } else if (!S_ISCHR(statb.st_mode)) {
                pfatal("%s is not a character device", dev);
                if (reply("CONTINUE") == 0)
                        return (0);
diff -r 09993333c00a -r 2ee79d3d2d04 sbin/fsck_ffs/utilities.c
--- a/sbin/fsck_ffs/utilities.c Wed Aug 15 03:40:50 2001 +0000
+++ b/sbin/fsck_ffs/utilities.c Wed Aug 15 03:54:53 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: utilities.c,v 1.30 2001/02/04 21:25:54 christos Exp $  */
+/*     $NetBSD: utilities.c,v 1.31 2001/08/15 03:54:53 lukem Exp $     */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)utilities.c        8.6 (Berkeley) 5/19/95";
 #else
-__RCSID("$NetBSD: utilities.c,v 1.30 2001/02/04 21:25:54 christos Exp $");
+__RCSID("$NetBSD: utilities.c,v 1.31 2001/08/15 03:54:53 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -546,7 +546,7 @@
 catchquit(sig)
        int sig;
 {
-       printf("returning to single-user after filesystem check\n");
+       printf("returning to single-user after file system check\n");
        returntosingle = 1;



Home | Main Index | Thread Index | Old Index