]> git.wh0rd.org - dump.git/commitdiff
Compatibility between dumps made on little endian machines vs. big endian machines...
authorStelian Pop <stelian@popies.net>
Thu, 10 Feb 2000 09:42:32 +0000 (09:42 +0000)
committerStelian Pop <stelian@popies.net>
Thu, 10 Feb 2000 09:42:32 +0000 (09:42 +0000)
Fixed the way dump reports the remaining percent/time, if the number of blocks actually dumped exceeds the estimated number of blocks.

CHANGES
THANKS
compat/include/bsdcompat.h
dump/optr.c
dump/tape.c
dump/traverse.c
restore/dirs.c

diff --git a/CHANGES b/CHANGES
index 5f45d06617e570b429353356e1a6e5a80a1bbfc5..07cd7dbbc69d60f85a7134c87519eeaaba36f95b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,4 @@
-$Id: CHANGES,v 1.41 2000/02/08 12:22:42 stelian Exp $
+$Id: CHANGES,v 1.42 2000/02/10 09:42:32 stelian Exp $
 
 Changes between versions 0.4b13 and 0.4b14 (released ????????????????)
 ======================================================================
 
 Changes between versions 0.4b13 and 0.4b14 (released ????????????????)
 ======================================================================
@@ -28,6 +28,22 @@ Changes between versions 0.4b13 and 0.4b14 (released ????????????????)
        having the immutable or append-only attribute set. Thanks to
        Ambrose Li <acli@mingpaoxpress.com> for submitting the patch.
 
        having the immutable or append-only attribute set. Thanks to
        Ambrose Li <acli@mingpaoxpress.com> for submitting the patch.
 
+7.     Fixed a compatibility problem between dumps made on little
+       endian machines (the format was correct) and big endian 
+       machines (the format was incorrect). This fix break the
+       compatibility with the older dumps made on big endian 
+       machines (sparc, m86k, ppc etc). For the first time in
+       linux dump's history (I believe), the dumps made by *BSD, 
+       Linux/alpha, Linux/sparc and Linux/x86 are compatible, 
+       so interchangeable. Thanks to Rob Cermak
+       <cermak@ahab.rutgers.edu> for submitting the bug and
+       helping me test the fix.
+
+8.     Fixed the way dump reports the remaining percent/time, if
+       the number of blocks actually dumped exceeds the estimated
+       number of blocks. Thanks to Jean-Paul van der Jagt 
+       <jeanpaul@dutepp0.et.tudelft.nl> for reporting the bug.
+
 Changes between versions 0.4b12 and 0.4b13 (released January 21, 2000)
 ======================================================================
 
 Changes between versions 0.4b12 and 0.4b13 (released January 21, 2000)
 ======================================================================
 
diff --git a/THANKS b/THANKS
index 42b5f85ae240a98f37bfdb4e40e7fc919f9056ca..7c464d5aff9d909f4f929df065196b4172b9ed64 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -1,4 +1,4 @@
-$Id: THANKS,v 1.20 2000/02/08 12:35:07 stelian Exp $
+$Id: THANKS,v 1.21 2000/02/10 09:42:32 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.
@@ -30,6 +30,7 @@ Abhijit Dasgupta      abhijit@ans.net
 Jason Fearon           jasonf@netrider.org.au
 Jeremy Fitzhardinge    jeremy@goop.org
 Eirik Fuller           eirik@netcom.com
 Jason Fearon           jasonf@netrider.org.au
 Jeremy Fitzhardinge    jeremy@goop.org
 Eirik Fuller           eirik@netcom.com
+Jean-Paul van der Jagt jeanpaul@dutepp0.et.tudelft.nl
 Eric Jergensen         eric@dvns.com
 Henry Katz             hkatz@hkatz.dialup.access.net
 Klaus Kudielka         kkudielk@cacofonix.nt.tuwien.ac.at
 Eric Jergensen         eric@dvns.com
 Henry Katz             hkatz@hkatz.dialup.access.net
 Klaus Kudielka         kkudielk@cacofonix.nt.tuwien.ac.at
index 8aad39790066845569e9338e6ec39c65d9a26e0e..bb39fe8a292bfd49c20d08880492b079d043bad6 100644 (file)
@@ -4,7 +4,7 @@
  *     Remy Card <card@Linux.EU.Org>, 1994-1997
  *     Stelian Pop <pop@cybercable.fr>, 1999-2000
  *
  *     Remy Card <card@Linux.EU.Org>, 1994-1997
  *     Stelian Pop <pop@cybercable.fr>, 1999-2000
  *
- *     $Id: bsdcompat.h,v 1.9 2000/01/21 10:17:41 stelian Exp $
+ *     $Id: bsdcompat.h,v 1.10 2000/02/10 09:42:32 stelian Exp $
  */
 
 #include <config.h>
  */
 
 #include <config.h>
@@ -131,18 +131,30 @@ struct dinode {
 #define d_fileno d_ino
 #endif
 
 #define d_fileno d_ino
 #endif
 
-struct direct {
+/*
+ * This is the direct structure used by dump. In needs to be
+ * different from direct because linux dump generates only
+ * 'old inode format' dumps. And BSD supposes that the old
+ * inode dumps have the d_namelen field written in machine byte
+ * order...
+ */
+struct olddirect {
        __u32   d_ino;
        __u16   d_reclen;
        __u32   d_ino;
        __u16   d_reclen;
-#if 1
-       __u8    d_namlen;
-       __u8    d_type;
-#else
        __u16   d_namlen;
        __u16   d_namlen;
-#endif
-       char            d_name[MAXNAMLEN + 1];
+       char    d_name[MAXNAMLEN + 1];
 };
 
 };
 
+/*
+ * The direct structure used by restore.
+ */
+struct direct {
+       __u32   d_ino;
+       __u16   d_reclen;
+       __u8    d_type;
+       __u8    d_namlen;
+       char    d_name[MAXNAMLEN + 1];
+};
 /*
  * Convert between stat structure types and directory types.
  */
 /*
  * Convert between stat structure types and directory types.
  */
index fdda1c4e594ef67297377982731e2ec7eeff4cec..de1d6f6fde171a16b6d19494c8f5ee1b3b4d6955 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: optr.c,v 1.9 2000/01/26 11:38:08 stelian Exp $";
+       "$Id: optr.c,v 1.10 2000/02/10 09:42:32 stelian Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -328,6 +328,8 @@ timeest(void)
                tschedule = tnow + 300;
                if (blockswritten < 500)
                        return;
                tschedule = tnow + 300;
                if (blockswritten < 500)
                        return;
+               if (blockswritten > tapesize)
+                       tapesize = blockswritten;
                deltat = tstart_writing - tnow +
                        (1.0 * (tnow - tstart_writing))
                        / blockswritten * tapesize;
                deltat = tstart_writing - tnow +
                        (1.0 * (tnow - tstart_writing))
                        / blockswritten * tapesize;
index 40dd42763ea11b60373cdd927f2e91e0e350c47a..b3964a8336512054dc957f16524c27003d928ff1 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.11 2000/01/21 10:17:41 stelian Exp $";
+       "$Id: tape.c,v 1.12 2000/02/10 09:42:32 stelian Exp $";
 #endif /* not lint */
 
 #ifdef __linux__
 #endif /* not lint */
 
 #ifdef __linux__
@@ -311,6 +311,8 @@ statussig(int notused)
 #else
        (void) time((time_t *) &tnow);
 #endif
 #else
        (void) time((time_t *) &tnow);
 #endif
+       if (blockswritten > tapesize)
+               tapesize = blockswritten;
        deltat = tstart_writing - tnow + (1.0 * (tnow - tstart_writing))
                / blockswritten * tapesize;
        (void)snprintf(msgbuf, sizeof(msgbuf),
        deltat = tstart_writing - tnow + (1.0 * (tnow - tstart_writing))
                / blockswritten * tapesize;
        (void)snprintf(msgbuf, sizeof(msgbuf),
index ed52904ffe6dd150c35ac0e20a438fc4c367272d..204f518de8e5b6cf712eb9913361673745eedac8 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: traverse.c,v 1.15 2000/02/04 20:22:21 stelian Exp $";
+       "$Id: traverse.c,v 1.16 2000/02/10 09:42:32 stelian Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -803,22 +803,21 @@ static int
 convert_dir(struct ext2_dir_entry *dirent, int offset, int blocksize, char *buf, void *private)
 {
        struct convert_dir_context *p;
 convert_dir(struct ext2_dir_entry *dirent, int offset, int blocksize, char *buf, void *private)
 {
        struct convert_dir_context *p;
-       struct direct *dp;
+       struct olddirect *dp;
        int reclen;
 
        p = (struct convert_dir_context *)private;
 
        reclen = EXT2_DIR_REC_LEN((dirent->name_len & 0xFF) + 1);
        if (((p->offset + reclen - 1) / p->bs) != (p->offset / p->bs)) {
        int reclen;
 
        p = (struct convert_dir_context *)private;
 
        reclen = EXT2_DIR_REC_LEN((dirent->name_len & 0xFF) + 1);
        if (((p->offset + reclen - 1) / p->bs) != (p->offset / p->bs)) {
-               dp = (struct direct *)(p->buf + p->prev_offset);
+               dp = (struct olddirect *)(p->buf + p->prev_offset);
                dp->d_reclen += p->bs - (p->offset % p->bs);
                p->offset += p->bs - (p->offset % p->bs);
        }
 
                dp->d_reclen += p->bs - (p->offset % p->bs);
                p->offset += p->bs - (p->offset % p->bs);
        }
 
-       dp = (struct direct *)(p->buf + p->offset);
+       dp = (struct olddirect *)(p->buf + p->offset);
        dp->d_ino = dirent->inode;
        dp->d_reclen = reclen;
        dp->d_ino = dirent->inode;
        dp->d_reclen = reclen;
-       dp->d_type = 0;
        dp->d_namlen = dirent->name_len & 0xFF;
        strncpy(dp->d_name, dirent->name, dp->d_namlen);
        dp->d_name[dp->d_namlen] = '\0';
        dp->d_namlen = dirent->name_len & 0xFF;
        strncpy(dp->d_name, dirent->name, dp->d_namlen);
        dp->d_name[dp->d_namlen] = '\0';
index 777a6a6f8a45b830f5d38fbbf753d9726e217ed2..558b2b681a6718ab6e0a8fd8e3df853c4970ddd5 100644 (file)
@@ -45,7 +45,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: dirs.c,v 1.7 2000/01/21 10:17:41 stelian Exp $";
+       "$Id: dirs.c,v 1.8 2000/02/10 09:42:32 stelian Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -379,10 +379,6 @@ putdir(char *buf, size_t size)
                        if (Bcvt)
                                swabst((u_char *)"is", (u_char *) dp);
                        if (oldinofmt && dp->d_ino != 0) {
                        if (Bcvt)
                                swabst((u_char *)"is", (u_char *) dp);
                        if (oldinofmt && dp->d_ino != 0) {
-#ifdef __linux__
-                               if (Bcvt)
-                                       swabst((u_char *)"s", (u_char *)&dp->d_namlen);
-#else
 #                              if BYTE_ORDER == BIG_ENDIAN
                                        if (Bcvt)
                                                dp->d_namlen = dp->d_type;
 #                              if BYTE_ORDER == BIG_ENDIAN
                                        if (Bcvt)
                                                dp->d_namlen = dp->d_type;
@@ -390,16 +386,8 @@ putdir(char *buf, size_t size)
                                        if (!Bcvt)
                                                dp->d_namlen = dp->d_type;
 #                              endif
                                        if (!Bcvt)
                                                dp->d_namlen = dp->d_type;
 #                              endif
-#endif /* __linux__ */
                                dp->d_type = DT_UNKNOWN;
                        }
                                dp->d_type = DT_UNKNOWN;
                        }
-#ifdef __linux__
-                       /*
-                        * Horrible hack to read FreeBSD 2.0 dumps
-                        */
-                       if (!oldinofmt)
-                               swabst((u_char *)"6bs", (u_char *) dp);
-#endif /* __linux__ */
 #ifdef DIRDEBUG
                        printf ("reclen = %d, namlen = %d, type = %d\n",
                                dp->d_reclen, dp->d_namlen, dp->d_type);
 #ifdef DIRDEBUG
                        printf ("reclen = %d, namlen = %d, type = %d\n",
                                dp->d_reclen, dp->d_namlen, dp->d_type);