Source-Changes-HG archive

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

[src/trunk]: src/sbin/dump - implement -F, which indicates that files-to-dump...



details:   https://anonhg.NetBSD.org/src/rev/291add273e31
branches:  trunk
changeset: 513807:291add273e31
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Aug 14 06:51:36 2001 +0000

description:
- implement -F, which indicates that files-to-dump is a regular file
  containing a file system image (instead of being a single file as
  part of a subtree dump)
- use "file system" instead of "filesystem" or "file-system"

diffstat:

 sbin/dump/dump.8 |  49 ++++++++++++++++++++++++++++---------------------
 sbin/dump/main.c |  29 +++++++++++++++++++----------
 2 files changed, 47 insertions(+), 31 deletions(-)

diffs (248 lines):

diff -r 3746adef3e3a -r 291add273e31 sbin/dump/dump.8
--- a/sbin/dump/dump.8  Tue Aug 14 06:47:24 2001 +0000
+++ b/sbin/dump/dump.8  Tue Aug 14 06:51:36 2001 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: dump.8,v 1.37 2001/06/05 11:22:43 wiz Exp $
+.\"    $NetBSD: dump.8,v 1.38 2001/08/14 06:51:36 lukem Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"     Regents of the University of California.
@@ -34,16 +34,16 @@
 .\"
 .\"     @(#)dump.8     8.3 (Berkeley) 5/1/95
 .\"
-.Dd May 28, 2001
+.Dd August 14, 2001
 .Dt DUMP 8
 .Os
 .Sh NAME
 .Nm dump ,
 .Nm rdump
-.Nd file-system backup
+.Nd file system backup
 .Sh SYNOPSIS
 .Nm ""
-.Op Fl 0123456789cenSu
+.Op Fl 0123456789ceFnSu
 .Op Fl B Ar records
 .Op Fl b Ar blocksize
 .Op Fl d Ar density
@@ -65,7 +65,7 @@
 is not documented here).
 .Sh DESCRIPTION
 .Nm
-examines files on a file-system and determines which files need to
+examines files on a file system and determines which files need to
 be backed up. 
 These files are copied to the given disk, tape or other storage
 medium for safe keeping (see the
@@ -84,20 +84,23 @@
 after prompting the operator to change media.
 .Pp
 .Ar files-to-dump
-is either a single file-system,
-or a list of files and directories on a single file-system to be backed
-up as a subset of the file-system.
+is either a single file system,
+or a list of files and directories on a single file system to be backed
+up as a subset of the file system.
 In the former case,
 .Ar files-to-dump
-may be the device of a file-system,
-the path to a currently mounted file-system, or
-the path to an unmounted file-system listed in
-.Pa /etc/fstab .
+may be the device of a file system,
+the path to a currently mounted file system,
+the path to an unmounted file system listed in
+.Pa /etc/fstab ,
+or, if
+.Fl F
+is given, a file system image in a regular file.
 In the latter case, certain restrictions are placed on the backup:
 .Fl u
 is ignored, the only dump level that is supported is
 .Fl 0 ,
-and all of the files must reside on the same file-system.
+and all of the files must reside on the same file system.
 .Pp
 The following options are supported by
 .Nm "" :
@@ -131,6 +134,10 @@
 The default is 1600 Bits Per Inch (BPI).
 .It Fl e
 Eject tape automatically if a tape change is required.
+.It Fl F
+Indicates that
+.Ar files-to-dump
+is a file system image in a regular file.
 .It Fl f Ar file
 Write the backup to
 .Ar file ;
@@ -180,7 +187,7 @@
 but full backups retain them.
 .It Fl k Ar read blocksize
 The size in kilobyte of the read buffers, rounded up to a multiple of the
-file-system block size. Default is 32k.
+file system block size. Default is 32k.
 .It Fl L Ar label
 The user-supplied text string
 .Ar label
@@ -241,18 +248,18 @@
 .Pa /etc/dumpdates
 is readable by people, consisting of one
 free format record per line:
-file-system name,
+file system name,
 increment level
 and
 .Xr ctime 3
 format dump date.
-There may be only one entry per file-system at each level.
+There may be only one entry per file system at each level.
 The file
 .Pa /etc/dumpdates
 may be edited to change any of the fields,
 if necessary.
 If a list of files or subdirectories is being dumped
-(as opposed to and entire file-system), then
+(as opposed to and entire file system), then
 .Fl u
 is ignored.
 .It Fl W
@@ -276,7 +283,7 @@
 .Nm
 exits immediately.
 .It Fl w
-Is like W, but prints only those file-systems which need to be dumped.
+Is like W, but prints only those file systems which need to be dumped.
 .El
 .Pp
 If
@@ -446,7 +453,7 @@
 Startup errors are indicated with an exit code of 1;
 abnormal termination is indicated with an exit code of 3.
 .Sh BUGS
-Fewer than 32 read errors on the file-system are ignored.
+Fewer than 32 read errors on the file system are ignored.
 .Pp
 Each reel requires a new process, so parent processes for
 reels already written just hang around until the entire tape
@@ -457,7 +464,7 @@
 .Fl W
 or
 .Fl w
-options does not report file-systems that have never been recorded
+options does not report file systems that have never been recorded
 in
 .Pa /etc/dumpdates ,
 even if listed in
@@ -466,7 +473,7 @@
 When dumping a list of files or subdirectories, access privileges are
 required to scan the directory (as this is done via the
 .Xr fts 3
-routines rather than directly accessing the file-system).
+routines rather than directly accessing the file system).
 .Pp
 It would be nice if
 .Nm
diff -r 3746adef3e3a -r 291add273e31 sbin/dump/main.c
--- a/sbin/dump/main.c  Tue Aug 14 06:47:24 2001 +0000
+++ b/sbin/dump/main.c  Tue Aug 14 06:51:36 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.37 2001/08/08 16:49:54 david Exp $  */
+/*     $NetBSD: main.c,v 1.38 2001/08/14 06:51:37 lukem Exp $  */
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.6 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.37 2001/08/08 16:49:54 david Exp $");
+__RCSID("$NetBSD: main.c,v 1.38 2001/08/14 06:51:37 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -108,7 +108,7 @@
        struct statfs *mntinfo, fsbuf;
        char *map;
        int ch;
-       int i, anydirskipped, bflag = 0, Tflag = 0, honorlevel = 1;
+       int i, anydirskipped, bflag = 0, Tflag = 0, Fflag = 0, honorlevel = 1;
        ino_t maxino;
        time_t tnow, date;
        int dirc;
@@ -138,7 +138,7 @@
 
        obsolete(&argc, &argv);
        while ((ch = getopt(argc, argv,
-           "0123456789B:b:cd:ef:h:k:L:nr:s:ST:uWw")) != -1)
+           "0123456789B:b:cd:eFf:h:k:L:nr:s:ST:uWw")) != -1)
                switch (ch) {
                /* dump level */
                case '0': case '1': case '2': case '3': case '4':
@@ -165,10 +165,14 @@
                                ntrec = HIGHDENSITYTREC;
                        break;
 
-               case 'e':       /* eject full tapes */
+               case 'e':               /* eject full tapes */
                        eflag = 1;
                        break;
 
+               case 'F':               /* files-to-dump is an fs image */
+                       Fflag = 1;
+                       break;
+
                case 'f':               /* output file */
                        tape = optarg;
                        break;
@@ -240,7 +244,8 @@
        argv += optind;
 
        if (argc < 1) {
-               (void)fprintf(stderr, "Must specify disk or filesystem\n");
+               (void)fprintf(stderr,
+                   "Must specify disk or image, or file list\n");
                exit(X_ABORT);
        }
 
@@ -257,12 +262,14 @@
 
                if (lstat(argv[i], &sb) == -1)
                        quit("Cannot stat %s: %s\n", argv[i], strerror(errno));
-               if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) {
+               if (Fflag || S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) {
                        disk = argv[i];
+                       if (Fflag && !S_ISREG(sb.st_mode))
+                               quit("%s is not a regular file", disk);
  multicheck:
                        if (dirc != 0)
                                quit(
-                                   "Can't dump a mountpoint and a filelist\n");
+       "Can't dump a disk or image at the same time as a file list\n");
                        break;
                }
                if ((dt = fstabsearch(argv[i])) != NULL) {
@@ -386,6 +393,8 @@
                            "a subset of %s", mountpoint);
                else
                        (void)strncpy(spcl.c_filesys, mountpoint, NAMELEN);
+       } else if (Fflag) {
+               (void)strncpy(spcl.c_filesys, "a file system image", NAMELEN);
        } else {
                (void)strncpy(spcl.c_filesys, "an unlisted file system",
                    NAMELEN);
@@ -586,9 +595,9 @@
 {
 
        (void)fprintf(stderr, "%s\n%s\n%s\n%s\n",
-"usage: dump [-0123456789cenu] [-B records] [-b blocksize] [-d density]",
+"usage: dump [-0123456789ceFnu] [-B records] [-b blocksize] [-d density]",
 "            [-f file] [-h level] [-k read block size] [-L label]",
-"            [-r read cache size] [-s feet] [-T date] filesystem",
+"            [-r read cache size] [-s feet] [-T date] file system",
 "       dump [-W | -w]");
        exit(1);
 }



Home | Main Index | Thread Index | Old Index