]> git.wh0rd.org - dump.git/commitdiff
Create new BSD inodes (and get 32 bit UID/GID)
authorStelian Pop <stelian@popies.net>
Wed, 17 Jul 2002 10:18:52 +0000 (10:18 +0000)
committerStelian Pop <stelian@popies.net>
Wed, 17 Jul 2002 10:18:52 +0000 (10:18 +0000)
CHANGES
compat/include/bsdcompat.h
dump/main.c
dump/traverse.c

diff --git a/CHANGES b/CHANGES
index 9881651a6b1f73ac5428ed095a44cb39ad38fcbd..0b2d3e1158578379120cda201a5a8dc754815f05 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,4 @@
-$Id: CHANGES,v 1.184 2002/07/01 11:57:11 stelian Exp $
+$Id: CHANGES,v 1.185 2002/07/17 10:18:52 stelian Exp $
 
 Changes between versions 0.4b29 and 0.4b30 (released ????????????????)
 ======================================================================
 
 Changes between versions 0.4b29 and 0.4b30 (released ????????????????)
 ======================================================================
@@ -21,6 +21,14 @@ Changes between versions 0.4b29 and 0.4b30 (released ????????????????)
        media, and localized in english and german. Thanks to
        Georg Lippold <g_lippold@sourceforge.net> for the new scripts.
 
        media, and localized in english and german. Thanks to
        Georg Lippold <g_lippold@sourceforge.net> for the new scripts.
 
+5.     Made dump save 32 bit UID/GID. Internally, this was achieved
+       by switching from the old BSD inode format to the new BSD 
+       inode format, which means that the tape format was changed.
+       However, since all restore versions out there should 
+       transparently support both inode formats, the change should
+       have no side effects. Thanks to John Yu <jky@cs.bu.edu> for
+       reporting the bug.
+       
 Changes between versions 0.4b28 and 0.4b29 (released June 8, 2002)
 ==================================================================
 
 Changes between versions 0.4b28 and 0.4b29 (released June 8, 2002)
 ==================================================================
 
index 16de840c73d8531be3ee97aa5d1707911b21a1bd..8b8737877ef8605b02d7a40093f8d6353e62a75e 100644 (file)
@@ -5,7 +5,7 @@
  *     Stelian Pop <stelian@popies.net>, 1999-2000
  *     Stelian Pop <stelian@popies.net> - Alcôve <www.alcove.com>, 2000-2002
  *
  *     Stelian Pop <stelian@popies.net>, 1999-2000
  *     Stelian Pop <stelian@popies.net> - Alcôve <www.alcove.com>, 2000-2002
  *
- *     $Id: bsdcompat.h,v 1.17 2002/06/10 14:05:00 stelian Exp $
+ *     $Id: bsdcompat.h,v 1.18 2002/07/17 10:18:52 stelian Exp $
  */
 
 #include <config.h>
  */
 
 #include <config.h>
@@ -96,7 +96,9 @@ struct dinode {
        __u8    di_frag;
        __u8    di_fsize;
        __u16   di_pad1;
        __u8    di_frag;
        __u8    di_fsize;
        __u16   di_pad1;
-       __u32   di_spare[2];
+       __u16   di_uidhigh;
+       __u16   di_gidhigh;
+       __u32   di_spare;
 };
 
 #define di_rdev                di_db[0]
 };
 
 #define di_rdev                di_db[0]
@@ -134,21 +136,7 @@ struct dinode {
 #endif
 
 /*
 #endif
 
 /*
- * 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;
-       __u16   d_namlen;
-       char    d_name[MAXNAMLEN + 1];
-};
-
-/*
- * The direct structure used by restore.
+ * The direct structure used by dump/restore.
  */
 struct direct {
        __u32   d_ino;
  */
 struct direct {
        __u32   d_ino;
index 173ec03a38026b54edb60f51a0594169080f2492..3ef7bc1930aef7658892ad93cb92d6bdfdb46eec 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: main.c,v 1.72 2002/06/05 13:29:15 stelian Exp $";
+       "$Id: main.c,v 1.73 2002/07/17 10:18:52 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
 #endif /* not lint */
 
 #include <config.h>
@@ -711,9 +711,7 @@ main(int argc, char *argv[])
        if (TP_BSIZE != (1 << tp_bshift))
                quit("TP_BSIZE (%d) is not a power of 2", TP_BSIZE);
        maxino = fs->super->s_inodes_count + 1;
        if (TP_BSIZE != (1 << tp_bshift))
                quit("TP_BSIZE (%d) is not a power of 2", TP_BSIZE);
        maxino = fs->super->s_inodes_count + 1;
-#if    0
        spcl.c_flags |= DR_NEWINODEFMT;
        spcl.c_flags |= DR_NEWINODEFMT;
-#endif
 #else  /* __linux __*/
        if ((diskfd = open(disk, O_RDONLY)) < 0) {
                msg("Cannot open %s\n", disk);
 #else  /* __linux __*/
        if ((diskfd = open(disk, O_RDONLY)) < 0) {
                msg("Cannot open %s\n", disk);
index cfa16b339871f01eea497ddbe626f052c2b126e4..bd16f9b7a696de34a607213a7e898b92b8973c67 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: traverse.c,v 1.47 2002/06/10 14:05:00 stelian Exp $";
+       "$Id: traverse.c,v 1.48 2002/07/17 10:18:52 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
 #endif /* not lint */
 
 #include <config.h>
@@ -786,7 +786,7 @@ dumpino(struct dinode *dp, dump_ino_t ino, int metaonly)
        unsigned long cnt;
        fsizeT size, remaining;
        char buf[TP_BSIZE];
        unsigned long cnt;
        fsizeT size, remaining;
        char buf[TP_BSIZE];
-       struct old_bsd_inode obi;
+       struct new_bsd_inode nbi;
        int i;
 #ifdef __linux__
        struct block_context bc;
        int i;
 #ifdef __linux__
        struct block_context bc;
@@ -806,22 +806,24 @@ dumpino(struct dinode *dp, dump_ino_t ino, int metaonly)
        }
        CLRINO(ino, dumpinomap);
 #ifdef __linux__
        }
        CLRINO(ino, dumpinomap);
 #ifdef __linux__
-       memset(&obi, 0, sizeof(obi));
-       obi.di_mode = dp->di_mode;
-       obi.di_uid = dp->di_uid;
-       obi.di_gid = dp->di_gid;
-       obi.di_qsize.v = i_size;
-       obi.di_atime = dp->di_atime;
-       obi.di_mtime = dp->di_mtime;
-       obi.di_ctime = dp->di_ctime;
-       obi.di_nlink = dp->di_nlink;
-       obi.di_blocks = dp->di_blocks;
-       obi.di_flags = dp->di_flags;
-       obi.di_gen = dp->di_gen;
-       memmove(&obi.di_db, &dp->di_db, (NDADDR + NIADDR) * sizeof(daddr_t));
+       memset(&nbi, 0, sizeof(nbi));
+       nbi.di_mode = dp->di_mode;
+       nbi.di_nlink = dp->di_nlink;
+       nbi.di_ouid = dp->di_uid;
+       nbi.di_ogid = dp->di_gid;
+       nbi.di_size = i_size;
+       nbi.di_atime.tv_sec = dp->di_atime;
+       nbi.di_mtime.tv_sec = dp->di_mtime;
+       nbi.di_ctime.tv_sec = dp->di_ctime;
+       memmove(&nbi.di_db, &dp->di_db, (NDADDR + NIADDR) * sizeof(daddr_t));
+       nbi.di_flags = dp->di_flags;
+       nbi.di_blocks = dp->di_blocks;
+       nbi.di_gen = dp->di_gen;
+       nbi.di_uid = (((int32_t)dp->di_uidhigh) << 16) | dp->di_uid;
+       nbi.di_gid = (((int32_t)dp->di_gidhigh) << 16) | dp->di_gid;
        if (dp->di_file_acl)
                warn("ACLs in inode #%ld won't be dumped", (long)ino);
        if (dp->di_file_acl)
                warn("ACLs in inode #%ld won't be dumped", (long)ino);
-       memmove(&spcl.c_dinode, &obi, sizeof(obi));
+       memmove(&spcl.c_dinode, &nbi, sizeof(nbi));
 #else  /* __linux__ */
        spcl.c_dinode = *dp;
 #endif /* __linux__ */
 #else  /* __linux__ */
        spcl.c_dinode = *dp;
 #endif /* __linux__ */
@@ -961,19 +963,19 @@ 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 olddirect *dp;
+       struct direct *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 olddirect *)(p->buf + p->prev_offset);
+               dp = (struct direct *)(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 olddirect *)(p->buf + p->offset);
+       dp = (struct direct *)(p->buf + p->offset);
        dp->d_ino = dirent->inode;
        dp->d_reclen = reclen;
        dp->d_namlen = dirent->name_len & 0xFF;
        dp->d_ino = dirent->inode;
        dp->d_reclen = reclen;
        dp->d_namlen = dirent->name_len & 0xFF;
@@ -995,7 +997,7 @@ dumpdirino(struct dinode *dp, dump_ino_t ino)
 {
        fsizeT size;
        char buf[TP_BSIZE];
 {
        fsizeT size;
        char buf[TP_BSIZE];
-       struct old_bsd_inode obi;
+       struct new_bsd_inode nbi;
        struct convert_dir_context cdc;
        errcode_t retval;
        struct ext2_dir_entry *de;
        struct convert_dir_context cdc;
        errcode_t retval;
        struct ext2_dir_entry *de;
@@ -1035,22 +1037,24 @@ dumpdirino(struct dinode *dp, dump_ino_t ino)
        dir_size = cdc.offset;
 
 #ifdef __linux__
        dir_size = cdc.offset;
 
 #ifdef __linux__
-       memset(&obi, 0, sizeof(obi));
-       obi.di_mode = dp->di_mode;
-       obi.di_uid = dp->di_uid;
-       obi.di_gid = dp->di_gid;
-       obi.di_qsize.v = dir_size; /* (u_quad_t)dp->di_size; */
-       obi.di_atime = dp->di_atime;
-       obi.di_mtime = dp->di_mtime;
-       obi.di_ctime = dp->di_ctime;
-       obi.di_nlink = dp->di_nlink;
-       obi.di_blocks = dp->di_blocks;
-       obi.di_flags = dp->di_flags;
-       obi.di_gen = dp->di_gen;
-       memmove(&obi.di_db, &dp->di_db, (NDADDR + NIADDR) * sizeof(daddr_t));
+       memset(&nbi, 0, sizeof(nbi));
+       nbi.di_mode = dp->di_mode;
+       nbi.di_nlink = dp->di_nlink;
+       nbi.di_ouid = dp->di_uid;
+       nbi.di_ogid = dp->di_gid;
+       nbi.di_size = dir_size; /* (u_quad_t)dp->di_size; */
+       nbi.di_atime.tv_sec = dp->di_atime;
+       nbi.di_mtime.tv_sec = dp->di_mtime;
+       nbi.di_ctime.tv_sec = dp->di_ctime;
+       memmove(&nbi.di_db, &dp->di_db, (NDADDR + NIADDR) * sizeof(daddr_t));
+       nbi.di_flags = dp->di_flags;
+       nbi.di_blocks = dp->di_blocks;
+       nbi.di_gen = dp->di_gen;
+       nbi.di_uid = (((int32_t)dp->di_uidhigh) << 16) | dp->di_uid;
+       nbi.di_gid = (((int32_t)dp->di_gidhigh) << 16) | dp->di_gid;
        if (dp->di_file_acl)
                warn("ACLs in inode #%ld won't be dumped", (long)ino);
        if (dp->di_file_acl)
                warn("ACLs in inode #%ld won't be dumped", (long)ino);
-       memmove(&spcl.c_dinode, &obi, sizeof(obi));
+       memmove(&spcl.c_dinode, &nbi, sizeof(nbi));
 #else  /* __linux__ */
        spcl.c_dinode = *dp;
 #endif /* __linux__ */
 #else  /* __linux__ */
        spcl.c_dinode = *dp;
 #endif /* __linux__ */