]> git.wh0rd.org - dump.git/commitdiff
Handle EINTR in atomical reads/writes in dump.
authorStelian Pop <stelian@popies.net>
Fri, 7 Jan 2000 19:23:53 +0000 (19:23 +0000)
committerStelian Pop <stelian@popies.net>
Fri, 7 Jan 2000 19:23:53 +0000 (19:23 +0000)
Handle more than 16 characters for the device names in dumpdates.
Fixed a bug in dump which prevented the creation of the dumpdates file when doing a 0-level dump.
Changed the way dump 'S' flag reports the size estimate from number of blocks into bytes.

CHANGES
THANKS
TODO
compat/include/protocols/dumprestore.h
dump/dump.8.in
dump/itime.c
dump/main.c
dump/tape.c

diff --git a/CHANGES b/CHANGES
index e077b2601109bbfe49511ccfa6610e4bd4abe55f..2e3f13dad34fdab0a6fff5a3a90e9da735e5222e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,4 @@
-$Id: CHANGES,v 1.27 1999/12/17 10:21:30 tiniou Exp $
+$Id: CHANGES,v 1.28 2000/01/07 19:23:53 tiniou Exp $
 
 Changes between versions 0.4b11 and 0.4b12 (released ????????????????)
 ======================================================================
 
 Changes between versions 0.4b11 and 0.4b12 (released ????????????????)
 ======================================================================
@@ -10,6 +10,25 @@ Changes between versions 0.4b11 and 0.4b12 (released ????????????????)
        dump. Thanks to Matti Taskinen <mkt@rni.helsinki.fi> for
        submitting the patch.
 
        dump. Thanks to Matti Taskinen <mkt@rni.helsinki.fi> for
        submitting the patch.
 
+3.     Handle EINTR in atomical reads/writes in dump, which was causing
+       dump to fail on some systems. Thanks to Eric Jergensen
+       <eric@dvns.com> for reporting the bug and submitting the patch.
+
+4.     Handle more than 16 characters for the device names in dumpdates.
+       (up to 255 now). Thanks to Rainer Clasen <bj@ncc.cicely.de> for
+       tracking down the problem and proposing the solution.
+
+5.     Fixed a bug in dump which prevented the creation of the
+       dumpdates file when doing a 0-level dump without already
+       having a dumpdates file. Thanks to Patrik Schindler 
+       <poc@pocnet.net> for reporting the bug.
+
+6.     Changed the way dump 'S' flag reports the size estimate
+       from number of blocks into bytes (making it compatible
+       with the Solaris version, and simplifying things for
+       amanda users). Thanks to Jason L Tibbitts III 
+       <tibbs@math.uh.edu> for reporting the bug.
+
 Changes between versions 0.4b10 and 0.4b11 (released December 5, 1999)
 ======================================================================
 
 Changes between versions 0.4b10 and 0.4b11 (released December 5, 1999)
 ======================================================================
 
diff --git a/THANKS b/THANKS
index ff5f9624c218f5f19282df76b99303ab69207223..ca81cb35a254448a86dc9e4ec3516baac260dfd1 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -1,4 +1,4 @@
-$Id: THANKS,v 1.14 1999/12/17 10:14:27 tiniou Exp $
+$Id: THANKS,v 1.15 2000/01/07 19:23:53 tiniou 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.
@@ -24,10 +24,12 @@ 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
 
 Stephen Carr           sgcarr@civeng.adelaide.edu.au
 Rob Cermak             cermak@ahab.rutgers.edu
+Rainer Clasen          bj@ncc.cicely.de
 Abhijit Dasgupta       abhijit@ans.net
 Jason Fearon           jasonf@netrider.org.au
 Jeremy Fitzhardinge    jeremy@goop.org
 Eirik Fuller           eirik@netcom.com
 Abhijit Dasgupta       abhijit@ans.net
 Jason Fearon           jasonf@netrider.org.au
 Jeremy Fitzhardinge    jeremy@goop.org
 Eirik Fuller           eirik@netcom.com
+Eric Jergensen         eric@dvns.com
 Henry Katz             hkatz@hkatz.dialup.access.net
 Klaus Kudielka         kkudielk@cacofonix.nt.tuwien.ac.at
 Thorsten Kukuk         kukuk@suse.de
 Henry Katz             hkatz@hkatz.dialup.access.net
 Klaus Kudielka         kkudielk@cacofonix.nt.tuwien.ac.at
 Thorsten Kukuk         kukuk@suse.de
@@ -41,9 +43,11 @@ Lukas Nellen         L.Nellen@ThPhys.Uni-Heidelberg.DE
 Nuno Oliveira          nuno@eq.uc.pt
 Brent Olson            night@halcyon.com
 Bernhard Sadlowski     sadlowsk@Mathematik.Uni-Bielefeld.DE
 Nuno Oliveira          nuno@eq.uc.pt
 Brent Olson            night@halcyon.com
 Bernhard Sadlowski     sadlowsk@Mathematik.Uni-Bielefeld.DE
+Patrik Schindler       poc@pocnet.net
 Chris Siebenmann       cks@utcc.utoronto.ca
 Bob Snyder             rsnyder@janet.advsys.com
 Matti Taskinen         mkt@rni.helsinki.fi
 Chris Siebenmann       cks@utcc.utoronto.ca
 Bob Snyder             rsnyder@janet.advsys.com
 Matti Taskinen         mkt@rni.helsinki.fi
+Jason L Tibbitts III   tibbs@math.uh.edu
 Theodore Y. Ts'o       tytso@mit.edu
 Stephen Tweedie                sct@dcs.ed.ac.uk
 Daniel Veillard                Daniel.Veillard@imag.fr
 Theodore Y. Ts'o       tytso@mit.edu
 Stephen Tweedie                sct@dcs.ed.ac.uk
 Daniel Veillard                Daniel.Veillard@imag.fr
diff --git a/TODO b/TODO
index bdb4783621a4c7a07f5b64b62c8f39ac5c539ed8..ae08d2ca31a31a42ae47af3f5e6587fa666d68ff 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,4 @@
-$Id: TODO,v 1.8 1999/11/21 02:24:45 tiniou Exp $
+$Id: TODO,v 1.9 2000/01/07 19:23:53 tiniou Exp $
 
 Need to verify:
 ---------------
 
 Need to verify:
 ---------------
@@ -34,9 +34,11 @@ All others:
 6.     Add a compression mode using zlib on each file (see
        http://www.cdrom.com/pub/infozip/zlib).
 
 6.     Add a compression mode using zlib on each file (see
        http://www.cdrom.com/pub/infozip/zlib).
 
-7.     Add some support in dump and restore for numbering in sequence
-       the output files (when dumping to a file). Something like -N <prefix>
-       which creates (or reads) <prefix>-1, <prefix>-2 etc...
-
-8.     Make a bootable dump tape? I don't know if it is possible...
+7.     Make a bootable dump tape? I don't know if it is possible...
 
 
+8.     From Kjetil Torgrim Homme <kjetilho@ifi.uio.no>:
+         a archive_file
+            Archive file. Archive a dump table-of-contents  in
+            the   specified   archive_file   to   be  used  by
+            ufsrestore(1M) to determine whether a file  is  in
+            the dump file that is being restored.
index 4985f8056f0de7cb0fa506006f47f2fef6d1f6aa..0d6e0c8ed99af5cd8b37b17d2be33654c568384f 100644 (file)
@@ -43,7 +43,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: dumprestore.h,v 1.3 1999/10/11 13:31:09 stelian Exp $
+ * $Id: dumprestore.h,v 1.4 2000/01/07 19:24:04 tiniou Exp $
  */
 
 #ifndef _PROTOCOLS_DUMPRESTORE_H_
  */
 
 #ifndef _PROTOCOLS_DUMPRESTORE_H_
@@ -117,8 +117,4 @@ union u_spcl {
 #define DR_NEWHEADER   0x0001  /* new format tape header */
 #define DR_NEWINODEFMT 0x0002  /* new format inodes on tape */
 
 #define DR_NEWHEADER   0x0001  /* new format tape header */
 #define DR_NEWINODEFMT 0x0002  /* new format inodes on tape */
 
-#define        DUMPOUTFMT      "%-16s %c %s"           /* for printf */
-                                               /* name, level, ctime(date) */
-#define        DUMPINFMT       "%16s %c %[^\n]\n"      /* inverse for scanf */
-
 #endif /* !_DUMPRESTORE_H_ */
 #endif /* !_DUMPRESTORE_H_ */
index a6f0e520356448d80a087c18dcc596744e34e206..064d9803d38f0440bf40d277656fa62e1abfe79b 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.7 1999/12/06 21:37:50 tiniou Exp $
+.\"    $Id: dump.8.in,v 1.8 2000/01/07 19:24:04 tiniou Exp $
 .\"
 .Dd __DATE__
 .Dt DUMP 8
 .\"
 .Dd __DATE__
 .Dt DUMP 8
@@ -230,7 +230,7 @@ The default tape length is 2300 feet.
 Size estimate. Determine the amount of space
 that is needed to perform the dump without
 actually doing it, and display the estimated
 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
+number of bytes it will take. This is useful
 with incremental dumps to determine how many
 volumes of media will be needed.
 .It Fl T Ar date
 with incremental dumps to determine how many
 volumes of media will be needed.
 .It Fl T Ar date
index 62792253d13b33e0ccc8ce8a0936a3b809a47c68..e9a9802a0f7e78327204e509a07935966b8e7b47 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: itime.c,v 1.7 1999/10/31 19:48:28 tiniou Exp $";
+       "$Id: itime.c,v 1.8 2000/01/07 19:24:04 tiniou Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -168,10 +168,11 @@ getdumptime(int createdumpdates)
        spcl.c_ddate = 0;
        lastlevel = '0';
 
        spcl.c_ddate = 0;
        lastlevel = '0';
 
-       /* If this is a level 0 dump, there's no point in trying to read
+       /* If this is a level 0 dump, and we're not updating 
+          dumpdates, there's no point in trying to read
           dumpdates.  It may not exist yet, or may not be mounted.  For
           incrementals, we *must* read dumpdates (fail if it's not there!) */
           dumpdates.  It may not exist yet, or may not be mounted.  For
           incrementals, we *must* read dumpdates (fail if it's not there!) */
-       if (level == lastlevel)
+       if ( (level == lastlevel) && !createdumpdates)
                return;
        initdumptimes(createdumpdates);
        if (ddatev == NULL)
                return;
        initdumptimes(createdumpdates);
        if (ddatev == NULL)
@@ -261,7 +262,7 @@ static void
 dumprecout(FILE *file, struct dumpdates *what)
 {
 
 dumprecout(FILE *file, struct dumpdates *what)
 {
 
-       if (fprintf(file, DUMPOUTFMT,
+       if (fprintf(file, "%s %c %s",
                    what->dd_name,
                    what->dd_level,
                    ctime(&what->dd_ddate)) < 0)
                    what->dd_name,
                    what->dd_level,
                    ctime(&what->dd_ddate)) < 0)
@@ -293,10 +294,27 @@ getrecord(FILE *df, struct dumpdates *ddatep)
 static int
 makedumpdate(struct dumpdates *ddp, char *tbuf)
 {
 static int
 makedumpdate(struct dumpdates *ddp, char *tbuf)
 {
-       char un_buf[BUFSIZ];
+       char *tok;
+       
+       /* device name */
+       if ( NULL == (tok = strsep( &tbuf, " ")) )
+               return(-1);
+       if ( strlen(tok) >  NAME_MAX )
+               return(-1);
+       strcpy(ddp->dd_name, tok);
+
+       /* eat whitespace */
+       for( ; *tbuf == ' ' ; tbuf++);
+
+       /* dump level */
+       ddp->dd_level = *tbuf;
+       ++tbuf;
+
+       /* eat whitespace */
+       for( ; *tbuf == ' ' ; tbuf++);
 
 
-       (void) sscanf(tbuf, DUMPINFMT, ddp->dd_name, &ddp->dd_level, un_buf);
-       ddp->dd_ddate = unctime(un_buf);
+       /* dump date */
+       ddp->dd_ddate = unctime(tbuf);
        if (ddp->dd_ddate < 0)
                return(-1);
        return(0);
        if (ddp->dd_ddate < 0)
                return(-1);
        return(0);
index 3c56b84cfb43a82330b7539c445d873b393cef8c..3a371b13ad245e290d04592f6fce524c56116781 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: main.c,v 1.10 1999/12/17 10:14:59 tiniou Exp $";
+       "$Id: main.c,v 1.11 2000/01/07 19:24:04 tiniou Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -514,7 +514,7 @@ main(int argc, char *argv[])
        }
 
        if (sizest) {
        }
 
        if (sizest) {
-               printf("%ld\n", tapesize + 10);
+               printf("%.0f\n", ((double)tapesize + 10) * TP_BSIZE);
                exit(X_FINOK);
        } /* stop here for size estimate */
 
                exit(X_FINOK);
        } /* stop here for size estimate */
 
index 7790cc4e4bd6a30b8a8d6791699383265493195c..c08019865bc2a96f5e4443115e5da081c0d1215a 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.9 1999/11/21 16:01:47 tiniou Exp $";
+       "$Id: tape.c,v 1.10 2000/01/07 19:24:04 tiniou Exp $";
 #endif /* not lint */
 
 #ifdef __linux__
 #endif /* not lint */
 
 #ifdef __linux__
@@ -1029,8 +1029,10 @@ atomic_read(int fd, void *buf, size_t count)
 {
        int got, need = count;
 
 {
        int got, need = count;
 
-       while ((got = read(fd, buf, need)) > 0 && (need -= got) > 0)
-               (char *)buf += got;
+       do {
+               while ((got = read(fd, buf, need)) > 0 && (need -= got) > 0)
+                       (char *)buf += got;
+       } while (got == -1 && errno == EINTR);
        return (got < 0 ? got : count - need);
 }
 
        return (got < 0 ? got : count - need);
 }
 
@@ -1044,7 +1046,9 @@ atomic_write(int fd, const void *buf, size_t count)
 {
        int got, need = count;
 
 {
        int got, need = count;
 
-       while ((got = write(fd, buf, need)) > 0 && (need -= got) > 0)
-               (char *)buf += got;
+       do {
+               while ((got = write(fd, buf, need)) > 0 && (need -= got) > 0)
+                       (char *)buf += got;
+       } while (got == -1 && errno == EINTR);
        return (got < 0 ? got : count - need);
 }
        return (got < 0 ? got : count - need);
 }