]> git.wh0rd.org - dump.git/commitdiff
-B option knows about compression length now.
authorStelian Pop <stelian@popies.net>
Wed, 18 Jul 2001 09:50:48 +0000 (09:50 +0000)
committerStelian Pop <stelian@popies.net>
Wed, 18 Jul 2001 09:50:48 +0000 (09:50 +0000)
CHANGES
THANKS
dump/dump.8.in
dump/dump.h
dump/main.c
dump/tape.c

diff --git a/CHANGES b/CHANGES
index 94821f4bdf3bfb67f95d78852645f981bcd6e383..a46e316cc210a8954e48c7ee789dcb2ffdd10f98 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,4 @@
-$Id: CHANGES,v 1.119 2001/07/18 08:50:58 stelian Exp $
+$Id: CHANGES,v 1.120 2001/07/18 09:50:48 stelian Exp $
 
 Changes between versions 0.4b22 and 0.4b23 (released ????????????)
 ==================================================================
 
 Changes between versions 0.4b22 and 0.4b23 (released ????????????)
 ==================================================================
@@ -21,6 +21,11 @@ Changes between versions 0.4b22 and 0.4b23 (released ????????????)
 5.     Fixed the looping problem in dump introduced in the 
        previous version.
 
 5.     Fixed the looping problem in dump introduced in the 
        previous version.
 
+6.     Changed the -B option of dump to limit the size of 
+       _compressed_ output per volume if compression is on.
+       Patch contributed by Helmut Jarausch 
+       <jarausch@igpm.rwth-aachen.de>.
+
 Changes between versions 0.4b21 and 0.4b22 (released May 12, 2001)
 ==================================================================
 
 Changes between versions 0.4b21 and 0.4b22 (released May 12, 2001)
 ==================================================================
 
diff --git a/THANKS b/THANKS
index f5fc5bc49511d9343e509dc0250860697faa8e55..80e2063044a4a56b9bd140c84b8633f242954a98 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -1,4 +1,4 @@
-$Id: THANKS,v 1.45 2001/05/26 11:11:16 stelian Exp $
+$Id: THANKS,v 1.46 2001/07/18 09:50:48 stelian Exp $
 
 Dump and restore were written by the people of the CSRG at the University
 of California, Berkeley.
 
 Dump and restore were written by the people of the CSRG at the University
 of California, Berkeley.
@@ -41,6 +41,7 @@ Ian Gordon            iangordon@users.sourceforge.net
 Andreas Hasenack       andreas@conectiva.com.br
 Christian Haul         haul@informatik.tu-darmstadt.de
 Jean-Paul van der Jagt jeanpaul@dutepp0.et.tudelft.nl
 Andreas Hasenack       andreas@conectiva.com.br
 Christian Haul         haul@informatik.tu-darmstadt.de
 Jean-Paul van der Jagt jeanpaul@dutepp0.et.tudelft.nl
+Helmut Jarausch                jarausch@igpm.rwth-aachen.de
 Eric Jergensen         eric@dvns.com
 Jeff Johnson           jbj@redhat.com
 Charles Karney         karney@users.sourceforge.net
 Eric Jergensen         eric@dvns.com
 Jeff Johnson           jbj@redhat.com
 Charles Karney         karney@users.sourceforge.net
index 5d16fc77d53182fc3d6152c1b85cea63ecf0ecce..21761d56575cf1a64a62a6e124ca2b53637ff84a 100644 (file)
@@ -30,7 +30,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"    $Id: dump.8.in,v 1.26 2001/04/10 13:42:22 stelian Exp $
+.\"    $Id: dump.8.in,v 1.27 2001/07/18 09:50:48 stelian Exp $
 .\"
 .Dd __DATE__
 .Dt DUMP 8
 .\"
 .Dd __DATE__
 .Dt DUMP 8
@@ -117,7 +117,8 @@ The default level is 9.
 .It Fl B Ar records
 The number of 1 kB blocks per volume.
 This option overrides the end-of-media detection, and calculation 
 .It Fl B Ar records
 The number of 1 kB blocks per volume.
 This option overrides the end-of-media detection, and calculation 
-of tape size based on length and density.
+of tape size based on length and density. If compression is on this
+limits the size of the compressed output per volume.
 .It Fl a
 .Dq auto-size .
 Bypass all tape length calculations, and write
 .It Fl a
 .Dq auto-size .
 Bypass all tape length calculations, and write
@@ -483,6 +484,8 @@ Each reel requires a new process, so parent processes for
 reels already written just hang around until the entire tape
 is written.
 .Pp
 reels already written just hang around until the entire tape
 is written.
 .Pp
+The estimated number of tapes is not correct if compression is on.
+.Pp
 It would be nice if
 .Nm
 knew about the dump sequence,
 It would be nice if
 .Nm
 knew about the dump sequence,
index b43beb7191ad47f94125535e2b73023d46e11f9b..2a6020c89b0225ad3728d38296cb58855711a7a0 100644 (file)
@@ -5,7 +5,7 @@
  *     Stelian Pop <pop@noos.fr>, 1999-2000
  *     Stelian Pop <pop@noos.fr> - Alcôve <www.alcove.fr>, 2000
  *
  *     Stelian Pop <pop@noos.fr>, 1999-2000
  *     Stelian Pop <pop@noos.fr> - Alcôve <www.alcove.fr>, 2000
  *
- *     $Id: dump.h,v 1.24 2001/04/10 13:42:22 stelian Exp $
+ *     $Id: dump.h,v 1.25 2001/07/18 09:50:48 stelian Exp $
  */
 
 /*-
  */
 
 /*-
@@ -79,12 +79,14 @@ char        *eot_script;    /* end of volume script fiag */
 int    diskfd;         /* disk file descriptor */
 int    tapefd;         /* tape file descriptor */
 int    pipeout;        /* true => output to standard output */
 int    diskfd;         /* disk file descriptor */
 int    tapefd;         /* tape file descriptor */
 int    pipeout;        /* true => output to standard output */
+int    fifoout;        /* true => output to fifo */
 dump_ino_t curino;     /* current inumber; used globally */
 int    newtape;        /* new tape flag */
 int    density;        /* density in 0.1" units */
 long   tapesize;       /* estimated tape size, blocks */
 long   tsize;          /* tape size in 0.1" units */
 long   asize;          /* number of 0.1" units written on current tape */
 dump_ino_t curino;     /* current inumber; used globally */
 int    newtape;        /* new tape flag */
 int    density;        /* density in 0.1" units */
 long   tapesize;       /* estimated tape size, blocks */
 long   tsize;          /* tape size in 0.1" units */
 long   asize;          /* number of 0.1" units written on current tape */
+unsigned long csize;   /* number of compressed bytes written on current tape */
 int    etapes;         /* estimated number of tapes */
 int    nonodump;       /* if set, do not honor UF_NODUMP user flags */
 int    unlimited;      /* if set, write to end of medium */
 int    etapes;         /* estimated number of tapes */
 int    nonodump;       /* if set, do not honor UF_NODUMP user flags */
 int    unlimited;      /* if set, write to end of medium */
index 15d00f32cefd275f118552e47117a406a5cf7496..5953f3941f2a866f6eabff7100e4b17cf2845dcb 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: main.c,v 1.50 2001/07/18 09:12:05 stelian Exp $";
+       "$Id: main.c,v 1.51 2001/07/18 09:50:48 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
 #endif /* not lint */
 
 #include <config.h>
@@ -353,7 +353,7 @@ main(int argc, char *argv[])
                tapeprefix = "standard output";
        }
 
                tapeprefix = "standard output";
        }
 
-       if (blocksperfile)
+       if (blocksperfile && !compressed)
                blocksperfile = blocksperfile / ntrec * ntrec; /* round down */
        else if (!unlimited) {
                /*
                blocksperfile = blocksperfile / ntrec * ntrec; /* round down */
        else if (!unlimited) {
                /*
@@ -519,6 +519,11 @@ main(int argc, char *argv[])
                strncpy(tape, tapeprefix, MAXPATHLEN);
        tape[MAXPATHLEN - 1] = '\0';
 
                strncpy(tape, tapeprefix, MAXPATHLEN);
        tape[MAXPATHLEN - 1] = '\0';
 
+       if (!pipeout) {
+               if (STAT(tape, &statbuf) != -1)
+                       fifoout= statbuf.st_mode & S_IFIFO;
+       }
+
        if (!sizest) {
 
                msg("Date of this level %c dump: %s", level,
        if (!sizest) {
 
                msg("Date of this level %c dump: %s", level,
@@ -820,7 +825,7 @@ main(int argc, char *argv[])
 
        tnow = trewind();
 
 
        tnow = trewind();
 
-       if (pipeout)
+       if (pipeout || fifoout)
                msg("%ld tape blocks (%.2fMB)\n", spcl.c_tapea,
                        ((double)spcl.c_tapea * TP_BSIZE / 1048576));
        else
                msg("%ld tape blocks (%.2fMB)\n", spcl.c_tapea,
                        ((double)spcl.c_tapea * TP_BSIZE / 1048576));
        else
@@ -923,7 +928,7 @@ sig(int signo)
        case SIGHUP:
        case SIGTERM:
        case SIGTRAP:
        case SIGHUP:
        case SIGTERM:
        case SIGTRAP:
-               if (pipeout)
+               if (pipeout || fifoout)
                        quit("Signal on pipe: cannot recover\n");
                msg("Rewriting attempted as response to unknown signal: %d.\n", signo);
                (void)fflush(stderr);
                        quit("Signal on pipe: cannot recover\n");
                msg("Rewriting attempted as response to unknown signal: %d.\n", signo);
                (void)fflush(stderr);
index 25d7c502c4cba16626a3759d05ccea1a87283166..984fe07fdde4e80965c1e8321571119cb6419a01 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.48 2001/07/18 09:12:05 stelian Exp $";
+       "$Id: tape.c,v 1.49 2001/07/18 09:50:48 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
 #endif /* not lint */
 
 #include <config.h>
@@ -443,12 +443,21 @@ flushtape(void)
        nextblock = slp->tblock;
        trecno = 0;
        asize += tenths + returned.clen / density;
        nextblock = slp->tblock;
        trecno = 0;
        asize += tenths + returned.clen / density;
+       csize += returned.clen;
        blockswritten += ntrec;
        blocksthisvol += ntrec;
        blockswritten += ntrec;
        blocksthisvol += ntrec;
-       if (!pipeout && !unlimited && (blocksperfile ?
-           (blocksthisvol >= blocksperfile) : (asize > tsize))) {
-               close_rewind();
-               startnewtape(0);
+       if (!pipeout && !unlimited) {
+               if (blocksperfile) {
+                       if ( compressed ? csize >= blocksperfile * 1024
+                                       : blocksthisvol >= blocksperfile ) {
+                               close_rewind();
+                               startnewtape(0);
+                       }
+               }
+               else if (asize > tsize) {
+                       close_rewind();
+                       startnewtape(0);
+               }
        }
        timeest();
 }
        }
        timeest();
 }
@@ -552,9 +561,11 @@ trewind(void)
 #endif
                {
                        (void) close(tapefd);
 #endif
                {
                        (void) close(tapefd);
-                       while ((f = OPEN(tape, 0)) < 0)
-                               sleep (10);
-                       (void) close(f);
+                       if (!fifoout) {
+                               while ((f = OPEN(tape, 0)) < 0)
+                                       sleep (10);
+                               (void) close(f);
+                       }
                }
                eot_code = 1;
                if (eot_script && spcl.c_type != TS_END) {
                }
                eot_code = 1;
                if (eot_script && spcl.c_type != TS_END) {
@@ -724,6 +735,7 @@ rollforward(void)
        slp->count = lastspclrec + blks + 1 - spcl.c_tapea;
        slp->inode = curino;
        asize += tenths + returned.clen / density;
        slp->count = lastspclrec + blks + 1 - spcl.c_tapea;
        slp->inode = curino;
        asize += tenths + returned.clen / density;
+       csize += returned.clen;
        blockswritten += ntrec;
        blocksthisvol += ntrec;
 #endif
        blockswritten += ntrec;
        blocksthisvol += ntrec;
 #endif
@@ -880,6 +892,7 @@ restore_check_point:
                enslave();  /* Share open tape file descriptor with slaves */
 
                asize = 0;
                enslave();  /* Share open tape file descriptor with slaves */
 
                asize = 0;
+               csize = 0;
                blocksthisvol = 0;
                if (top)
                        newtape++;              /* new tape signal */
                blocksthisvol = 0;
                if (top)
                        newtape++;              /* new tape signal */