]> git.wh0rd.org - dump.git/commitdiff
'S' size estimation option to dump.
authorStelian Pop <stelian@popies.net>
Mon, 22 Nov 1999 19:08:47 +0000 (19:08 +0000)
committerStelian Pop <stelian@popies.net>
Mon, 22 Nov 1999 19:08:47 +0000 (19:08 +0000)
CHANGES
THANKS
dump/dump.8.in
dump/main.c

diff --git a/CHANGES b/CHANGES
index 1b98399bbc7067fb96c4d8a5671a722b0f15f36c..453a17741e729238027c49e5c792c10ed399f106 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,10 +1,15 @@
-$Id: CHANGES,v 1.20 1999/11/21 15:39:45 tiniou Exp $
+$Id: CHANGES,v 1.21 1999/11/22 19:08:47 tiniou Exp $
 
 Changes between versions 0.4b10 and 0.4b11 (released ????????????????)
 ======================================================================
 
 1.     Added a '--enable-kerberos' to configure.
 
+2.     Added a 'S' option to dump which determines the amount of space
+       that is needed to perform the dump without actually doint it, similar
+       to the Sun's ufsdump 'S' option. Patch contributed by Rob Cermak
+       <cermak@ahab.rutgers.edu>.
+
 Changes between versions 0.4b9 and 0.4b10 (released November 21, 1999)
 ======================================================================
 
diff --git a/THANKS b/THANKS
index b43b7b88e0c316dba9add2a685f8e71638a0fc2b..87d85e2918d2d67ce89243cf3ab9d72345959720 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -1,4 +1,4 @@
-$Id: THANKS,v 1.10 1999/11/21 02:24:45 tiniou Exp $
+$Id: THANKS,v 1.11 1999/11/22 19:08:47 tiniou Exp $
 
 Dump and restore were written by the people of the CSRG at the University
 of California, Berkeley.
@@ -23,6 +23,7 @@ suggested various improvements.
 Here is a partial list of them (if I have forgotten someone, please complain):
 
 Stephen Carr           sgcarr@civeng.adelaide.edu.au
+Rob Cermak             cermak@ahab.rutgers.edu
 Abhijit Dasgupta       abhijit@ans.net
 Jeremy Fitzhardinge    jeremy@goop.org
 Eirik Fuller           eirik@netcom.com
index 3fa63c102cb54988ab1ffd0d24762d518e1714c7..bb7503331c73581deeb636401223ed23c1352321 100644 (file)
@@ -30,7 +30,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"    $Id: dump.8.in,v 1.4 1999/10/30 22:55:51 tiniou Exp $
+.\"    $Id: dump.8.in,v 1.5 1999/11/22 19:08:50 tiniou Exp $
 .\"
 .Dd __DATE__
 .Dt DUMP 8
@@ -40,7 +40,7 @@
 .Nd ext2 filesystem backup
 .Sh SYNOPSIS
 .Nm dump
-.Op Fl 0123456789acknu
+.Op Fl 0123456789acknSu
 .Op Fl B Ar records
 .Op Fl b Ar blocksize
 .Op Fl d Ar density
@@ -51,7 +51,7 @@
 .Op Fl T Ar date
 .Ar filesystem
 .Nm dump
-.Op Fl 0123456789acknu
+.Op Fl 0123456789acknSu
 .Op Fl B Ar records
 .Op Fl b Ar blocksize
 .Op Fl d Ar density
@@ -218,6 +218,13 @@ prompts for a new tape.
 It is recommended to be a bit conservative on this option.
 The default tape length is 2300 feet.
 .ne 1i
+.It Fl S
+Size estimate. Determine the amount of space
+that is needed to perform the dump without
+actually doing it, and display the estimated
+number of blocks it will take. This is useful
+with incremental dumps to determine how many
+volumes of media will be needed.
 .It Fl T Ar date
 Use the specified date as the starting time for the dump
 instead of the time determined from looking in
index 5e8f79f2a45bb7fe19b889456191453cb09acd55..263945a2543d05c692ed274d4d1a321c592cf88c 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: main.c,v 1.8 1999/11/21 16:01:47 tiniou Exp $";
+       "$Id: main.c,v 1.9 1999/11/22 19:08:50 tiniou Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -94,6 +94,7 @@ int   dokerberos = 0; /* Use Kerberos authentication */
 long   dev_bsize = 1;  /* recalculated below */
 long   blocksperfile;  /* output blocks per file */
 char   *host = NULL;   /* remote host (if any) */
+int    sizest = 0;     /* return size estimate only */
 
 #ifdef __linux__
 char   *__progname;
@@ -151,9 +152,9 @@ main(int argc, char *argv[])
 
        obsolete(&argc, &argv);
 #ifdef KERBEROS
-#define optstring "0123456789aB:b:cd:f:h:kL:Mns:T:uWw"
+#define optstring "0123456789aB:b:cd:f:h:kL:Mns:ST:uWw"
 #else
-#define optstring "0123456789aB:b:cd:f:h:L:Mns:T:uWw"
+#define optstring "0123456789aB:b:cd:f:h:L:Mns:ST:uWw"
 #endif
        while ((ch = getopt(argc, argv, optstring)) != -1)
 #undef optstring
@@ -237,6 +238,10 @@ main(int argc, char *argv[])
                        tsize = numarg("tape size", 1L, 0L) * 12 * 10;
                        break;
 
+               case 'S':
+                       sizest = 1;     /* return size estimate only */
+                       break;
+
                case 'T':               /* time of last dump */
                        spcl.c_ddate = unctime(optarg);
                        if (spcl.c_ddate < 0) {
@@ -402,26 +407,30 @@ main(int argc, char *argv[])
                strncpy(tape, tapeprefix, NAME_MAX);
        tape[NAME_MAX - 1] = '\0';
 
-       msg("Date of this level %c dump: %s", level,
+       if (!sizest) {
+
+               msg("Date of this level %c dump: %s", level,
 #ifdef __linux__
-               spcl.c_date == 0 ? "the epoch\n" : ctime4(&spcl.c_date));
+                       spcl.c_date == 0 ? "the epoch\n" : ctime4(&spcl.c_date));
 #else
-               spcl.c_date == 0 ? "the epoch\n" : ctime(&spcl.c_date));
+                       spcl.c_date == 0 ? "the epoch\n" : ctime(&spcl.c_date));
 #endif
-       msg("Date of last level %c dump: %s", lastlevel,
+               msg("Date of last level %c dump: %s", lastlevel,
 #ifdef __linux__
-               spcl.c_ddate == 0 ? "the epoch\n" : ctime4(&spcl.c_ddate));
+                       spcl.c_ddate == 0 ? "the epoch\n" : ctime4(&spcl.c_ddate));
 #else
-               spcl.c_ddate == 0 ? "the epoch\n" : ctime(&spcl.c_ddate));
+                       spcl.c_ddate == 0 ? "the epoch\n" : ctime(&spcl.c_ddate));
 #endif
-       msg("Dumping %s ", disk);
-       if (dt != NULL)
-               msgtail("(%s) ", dt->fs_file);
-       if (host)
-               msgtail("to %s on host %s\n", tape, host);
-       else
-               msgtail("to %s\n", tape);
-       msg("Label: %s\n", labelstr);
+               msg("Dumping %s ", disk);
+               if (dt != NULL)
+                       msgtail("(%s) ", dt->fs_file);
+               if (host)
+                       msgtail("to %s on host %s\n", tape, host);
+               else
+                       msgtail("to %s\n", tape);
+               msg("Label: %s\n", labelstr);
+
+       } /* end of size estimate */
 
 #ifdef __linux__
        retval = dump_fs_open(disk, &fs);
@@ -487,7 +496,8 @@ main(int argc, char *argv[])
        (void)signal(SIGINFO, statussig);
 #endif
 
-       msg("mapping (Pass I) [regular files]\n");
+       if (!sizest)
+               msg("mapping (Pass I) [regular files]\n");
 #ifdef __linux__
        if (directory[0] == 0)
                anydirskipped = mapfiles(maxino, &tapesize);
@@ -497,11 +507,17 @@ main(int argc, char *argv[])
        anydirskipped = mapfiles(maxino, &tapesize);
 #endif
 
-       msg("mapping (Pass II) [directories]\n");
+       if (!sizest)
+               msg("mapping (Pass II) [directories]\n");
        while (anydirskipped) {
                anydirskipped = mapdirs(maxino, &tapesize);
        }
 
+       if (sizest) {
+               printf("%ld\n", tapesize + 10);
+               exit(X_STARTUP);
+       } /* stop here for size estimate */
+
        if (pipeout || unlimited) {
                tapesize += 10; /* 10 trailer blocks */
                msg("estimated %ld tape blocks.\n", tapesize);
@@ -666,7 +682,7 @@ usage(void)
 #ifdef KERBEROS
                "k"
 #endif
-               "Mnu] [-B records] [-b blocksize] [-d density]\n"
+               "MnSu] [-B records] [-b blocksize] [-d density]\n"
                "\t%s [-f file] [-h level] [-s feet] [-T date] filesystem\n"
                "\t%s [-W | -w]\n", __progname, white, __progname);
        exit(X_STARTUP);