]> git.wh0rd.org - dump.git/blobdiff - restore/restore.c
-A archive file implementation
[dump.git] / restore / restore.c
index e0506000db46e925f3cb50d119e0d6dceb58e8e3..a44f50dddf5dc022a41d2636f2e221b1481b7524 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
  */
 
 /*
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: restore.c,v 1.21 2002/01/11 08:54:14 stelian Exp $";
+       "$Id: restore.c,v 1.25 2002/01/25 14:59:53 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -83,7 +83,7 @@ listfile(char *name, dump_ino_t ino, int type)
        long descend = hflag ? GOOD : FAIL;
 #ifdef USE_QFA
        long tnum;
-       long tpos;
+       long long tpos;
 #endif
 
        if (TSTINO(ino, dumpmap) == 0)
@@ -92,7 +92,7 @@ listfile(char *name, dump_ino_t ino, int type)
 #ifdef USE_QFA
        if (tapeposflag) {      /* add QFA positions to output */
                (void)Inode2Tapepos(ino, &tnum, &tpos, 1);
-               fprintf(stdout, "%10lu\t%ld\t%ld\t%s\n", (unsigned long)ino, 
+               fprintf(stdout, "%10lu\t%ld\t%lld\t%s\n", (unsigned long)ino, 
                        tnum, tpos, name);
        }
        else
@@ -839,13 +839,22 @@ createfiles(void)
        register struct entry *ep;
        long curvol;
 #ifdef USE_QFA
-       long tnum, tpos, curtpos, tmpcnt;
+       long tnum, tmpcnt;
+       long long tpos, curtpos;
        time_t tistart, tiend, titaken;
 #endif
 
        Vprintf(stdout, "Extract requested files\n");
        curfile.action = SKIP;
-       getvol((long)1);
+#ifdef USE_QFA
+       if (tapeposflag)
+               curfile.ino = 0;
+       else
+#endif
+               if (volinfo[1] == ROOTINO)
+                       curfile.ino = 0;
+               else
+                       getvol((long)1);
        skipmaps();
        skipdirs();
        first = lowerbnd(ROOTINO);
@@ -870,7 +879,7 @@ createfiles(void)
                        if (!pipein)
                                getvol((long)0);
                        if (curfile.ino == maxino) {
-                               next = lowerbnd(next);
+                               next = lowerbnd(first);
                                while (next < curfile.ino) {
                                        ep = lookupino(next);
                                        if (ep == NULL)
@@ -908,7 +917,7 @@ createfiles(void)
                                         *  might be too slow */
                                        if (tpos > curtpos) {
 #ifdef DEBUG_QFA
-                                               msg("positioning tape %ld from %ld to %ld for inode %10lu ...\n", volno, curtpos, tpos, (unsigned long)next);
+                                               msg("positioning tape %ld from %lld to %lld for inode %10lu ...\n", volno, curtpos, tpos, (unsigned long)next);
 #endif
                                                if (GotoTapePos(tpos) == 0) {
 #ifdef DEBUG_QFA
@@ -925,7 +934,18 @@ createfiles(void)
                                }
                        }
                }
+               else
 #endif /* USA_QFA */
+                       if (volinfo[1] == ROOTINO) {
+                               int i, goodvol = 1;
+
+                               for (i = 1; i < TP_NINOS && volinfo[i] != 0; ++i)
+                                       if (volinfo[i] < next)
+                                               goodvol = i;
+
+                               if (goodvol != volno)
+                                       RequestVol(goodvol);
+                       }
 
                do      {
                        curvol = volno;