]> git.wh0rd.org - dump.git/blobdiff - restore/symtab.c
Exclude directory entries to non-dumped inodes from the dump.
[dump.git] / restore / symtab.c
index d020f662f376c0cf89b51f1ee49b4e533f7b585c..3e6d3fc2b6674a31a076dcb2eb3204790e1159d3 100644 (file)
@@ -2,8 +2,8 @@
  *     Ported to Linux's Second Extended File System as part of the
  *     dump and restore backup suit
  *     Remy Card <card@Linux.EU.Org>, 1994-1997
- *     Stelian Pop <pop@noos.fr>, 1999-2000
- *     Stelian Pop <pop@noos.fr> - Alcôve <www.alcove.fr>, 2000
+ *     Stelian Pop <stelian@popies.net>, 1999-2000
+ *     Stelian Pop <stelian@popies.net> - Alcôve <www.alcove.com>, 2000-2002
  */
 
 /*
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -41,7 +37,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: symtab.c,v 1.16 2001/06/18 10:58:28 stelian Exp $";
+       "$Id: symtab.c,v 1.22 2003/10/26 16:05:48 stelian Exp $";
 #endif /* not lint */
 
 /*
@@ -67,7 +63,12 @@ static const char rcsid[] =
 #endif
 #include <bsdcompat.h>
 #else  /* __linux__ */
+#ifdef sunos
+#include <sys/fcntl.h>
+#include <bsdcompat.h>
+#else
 #include <ufs/ufs/dinode.h>
+#endif
 #endif /* __linux__ */
 
 #include <errno.h>
@@ -106,7 +107,7 @@ static void          removeentry __P((struct entry *));
 struct entry *
 lookupino(dump_ino_t inum)
 {
-       register struct entry *ep;
+       struct entry *ep;
 
        if (inum < WINO || inum >= maxino)
                return (NULL);
@@ -142,7 +143,7 @@ addino(dump_ino_t inum, struct entry *np)
 void
 deleteino(dump_ino_t inum)
 {
-       register struct entry *next;
+       struct entry *next;
        struct entry **prev;
 
        if (inum < WINO || inum >= maxino)
@@ -165,8 +166,8 @@ deleteino(dump_ino_t inum)
 struct entry *
 lookupname(char *name)
 {
-       register struct entry *ep;
-       register char *np, *cp;
+       struct entry *ep;
+       char *np, *cp;
        char buf[MAXPATHLEN];
 
        cp = name;
@@ -216,7 +217,7 @@ lookupparent(char *name)
 char *
 myname(struct entry *ep)
 {
-       register char *cp;
+       char *cp;
        static char namebuf[MAXPATHLEN];
 
        for (cp = &namebuf[MAXPATHLEN - 2]; cp > &namebuf[ep->e_namlen]; ) {
@@ -243,7 +244,7 @@ static struct entry *freelist = NULL;
 struct entry *
 addentry(char *name, dump_ino_t inum, int type)
 {
-       register struct entry *np, *ep;
+       struct entry *np, *ep;
 
        if (freelist != NULL) {
                np = freelist;
@@ -291,7 +292,7 @@ addentry(char *name, dump_ino_t inum, int type)
 void
 freeentry(struct entry *ep)
 {
-       register struct entry *np;
+       struct entry *np;
        dump_ino_t inum;
 
        if (ep->e_flags != REMOVED)
@@ -362,7 +363,7 @@ moveentry(struct entry *ep, char *newname)
 static void
 removeentry(struct entry *ep)
 {
-       register struct entry *np;
+       struct entry *np;
 
        np = ep->e_parent;
        if (np->e_entries == ep) {
@@ -462,8 +463,8 @@ struct symtableheader {
 void
 dumpsymtable(char *filename, long checkpt)
 {
-       register struct entry *ep, *tep;
-       register dump_ino_t i;
+       struct entry *ep, *tep;
+       dump_ino_t i;
        struct entry temp, *tentry;
        long mynum = 1, stroff = 0;
        FILE *fd;
@@ -518,7 +519,7 @@ dumpsymtable(char *filename, long checkpt)
        /*
         * Convert entry pointers to indexes, and output
         */
-       for (i = 0; i < entrytblsize; i++) {
+       for (i = 0; (long)i < entrytblsize; i++) {
                if (entry[i] == NULL)
                        tentry = NULL;
                else
@@ -550,11 +551,11 @@ initsymtable(char *filename)
 {
        char *base;
        long tblsize;
-       register struct entry *ep;
+       struct entry *ep;
        struct entry *baseep, *lep;
        struct symtableheader hdr;
        struct stat stbuf;
-       register long i;
+       long i;
        int fd;
 
        Vprintf(stdout, "Initialize symbol table.\n");
@@ -611,6 +612,7 @@ initsymtable(char *filename)
                panic("initsymtable called from command %c\n", command);
                break;
        }
+       resizemaps(maxino, hdr.maxino);
        maxino = hdr.maxino;
        entrytblsize = hdr.entrytblsize;
        entry = (struct entry **)