]> git.wh0rd.org - dump.git/blobdiff - restore/main.c
Make the directory hashtable optional and controled via restore -H
[dump.git] / restore / main.c
index 77b9d7daf13fd787e8b72633fa94da618c73ad45..496391d759f612660c3568407edb78a5e3f3f723 100644 (file)
@@ -37,7 +37,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: main.c,v 1.45 2003/10/26 16:05:48 stelian Exp $";
+       "$Id: main.c,v 1.50 2005/07/07 09:16:08 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -92,6 +92,7 @@ int abortifconnerr = 1;               /* set to 1 if lib dumprmt.o should exit on connection
 int    aflag = 0, bflag = 0, cvtflag = 0, dflag = 0, vflag = 0, yflag = 0;
 int    hflag = 1, mflag = 1, Mflag = 0, Nflag = 0, Vflag = 0, zflag = 0;
 int    uflag = 0, lflag = 0, Lflag = 0, oflag = 0;
+int    ufs2flag = 0;
 char   *Afile = NULL;
 int    dokerberos = 0;
 char   command = '\0';
@@ -111,6 +112,8 @@ char        filesys[NAMELEN];
 static const char *stdin_opt = NULL;
 char   *bot_script = NULL;
 dump_ino_t volinfo[TP_NINOS];
+int    wdfd;
+int    dirhash_size = 1;
 
 #ifdef USE_QFA
 FILE   *gTapeposfp;
@@ -175,7 +178,7 @@ main(int argc, char *argv[])
                ;                                                               
        obsolete(&argc, &argv);
        while ((ch = getopt(argc, argv, 
-               "aA:b:CcdD:f:F:hi"
+               "aA:b:CcdD:f:F:hH:i"
 #ifdef KERBEROS
                "k"
 #endif
@@ -225,6 +228,13 @@ main(int argc, char *argv[])
                case 'h':
                        hflag = 0;
                        break;
+               case 'H':
+                       dirhash_size = strtol(optarg, &p, 10);
+                       if (*p)
+                               errx(1, "illegal hash size -- %s", optarg);
+                       if (dirhash_size < 1)
+                               errx(1, "hash size must be greater than 0");
+                       break;
 #ifdef KERBEROS
                case 'k':
                        dokerberos = 1;
@@ -355,6 +365,10 @@ main(int argc, char *argv[])
        else
                setinput(inputdev);
 
+       wdfd = open(".", O_RDONLY);
+       if (wdfd < 0)
+               err(1, "can't get current directory");
+
        if (argc == 0 && !filelist) {
                argc = 1;
                *--argv = ".";
@@ -418,6 +432,7 @@ main(int argc, char *argv[])
                Vprintf(stdout, "Begin compare restore\n");
                compare_ignore_not_found = 0;
                compare_errors = 0;
+               Nflag = 1;
                setup();
                printf("filesys = %s\n", filesys);
                if (STAT(filesys, &stbuf) < 0)
@@ -426,9 +441,10 @@ main(int argc, char *argv[])
                        err(1, "cannot cd to %s", filesys);
                compare_ignore_not_found = dumptime > 0;
                initsymtable((char *)0);
-               extractdirs(0);
+               extractdirs(1);
                treescan(".", ROOTINO, nodeupdates);
                compareleaves();
+               comparedirmodes();
                checkrestore();
                if (compare_errors) {
                        printf("Some files were modified!\n");
@@ -671,21 +687,21 @@ usage(void)
 
        fprintf(stderr,
                "usage:"
-               "\t%s -C [-cd" kerbflag "lMvVy] [-b blocksize] [-D filesystem] [-f file]\n"
+               "\t%s -C [-cdH" kerbflag "lMvVy] [-b blocksize] [-D filesystem] [-f file]\n"
                "\t%s    [-F script] [-L limit] [-s fileno]\n"
-               "\t%s -i [-acdh" kerbflag "lmMouvVy] [-A file] [-b blocksize] [-f file]\n"
+               "\t%s -i [-acdhH" kerbflag "lmMouvVy] [-A file] [-b blocksize] [-f file]\n"
                "\t%s    [-F script] " qfaflag "[-s fileno]\n"
 #ifdef USE_QFA
-               "\t%s -P file [-acdh" kerbflag "lmMuvVy] [-A file] [-b blocksize]\n"
+               "\t%s -P file [-acdhH" kerbflag "lmMuvVy] [-A file] [-b blocksize]\n"
                "\t%s    [-f file] [-F script] [-s fileno] [-X filelist] [file ...]\n"
 #endif
-               "\t%s -r [-cd" kerbflag "lMuvVy] [-b blocksize] [-f file] [-F script]\n"
+               "\t%s -r [-cdH" kerbflag "lMuvVy] [-b blocksize] [-f file] [-F script]\n"
                "\t%s    [-s fileno] [-T directory]\n"
-               "\t%s -R [-cd" kerbflag "lMuvVy] [-b blocksize] [-f file] [-F script]\n"
+               "\t%s -R [-cdH" kerbflag "lMuvVy] [-b blocksize] [-f file] [-F script]\n"
                "\t%s    [-s fileno] [-T directory]\n"
-               "\t%s -t [-cdh" kerbflag "lMuvVy] [-A file] [-b blocksize] [-f file]\n"
+               "\t%s -t [-cdhH" kerbflag "lMuvVy] [-A file] [-b blocksize] [-f file]\n"
                "\t%s    [-F script] " qfaflag "[-s fileno] [-X filelist] [file ...]\n"
-               "\t%s -x [-acdh" kerbflag "lmMouvVy] [-A file] [-b blocksize] [-f file]\n"
+               "\t%s -x [-acdhH" kerbflag "lmMouvVy] [-A file] [-b blocksize] [-f file]\n"
                "\t%s    [-F script] " qfaflag "[-s fileno] [-X filelist] [file ...]\n",
                __progname, white, 
                __progname, white, 
@@ -734,6 +750,7 @@ obsolete(int *argcp, char **argvp[])
                case 'D':
                case 'f':
                case 'F':
+               case 'H':
                case 'L':
                case 'Q':
                case 's':