X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=restore%2Frestore.c;h=7c897eceeb4301a1380b8a2c1f9359fdc2f42aec;hb=876861d20fbf12cfef3768496a90b395cd15ea9a;hp=1b04fea6b9b8b43e81275461eaab2c90e680c222;hpb=5d2a3d246d400d45dfd4c49ddb588c69fb60873d;p=dump.git diff --git a/restore/restore.c b/restore/restore.c index 1b04fea..7c897ec 100644 --- a/restore/restore.c +++ b/restore/restore.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: restore.c,v 1.26 2002/01/25 15:08:59 stelian Exp $"; + "$Id: restore.c,v 1.30 2002/07/19 14:57:40 stelian Exp $"; #endif /* not lint */ #include @@ -60,9 +60,12 @@ static const char rcsid[] = #else /* __linux__ */ #include #endif /* __linux__ */ +#include +#include #include #include +#include #ifdef __linux__ #include @@ -140,7 +143,11 @@ addfile(char *name, dump_ino_t ino, int type) } } ep = addentry(name, ino, type); +#ifdef USE_QFA + if ((type == NODE) && (!createtapeposflag)) +#else if (type == NODE) +#endif newnode(ep); ep->e_flags |= NEW; return (descend); @@ -152,7 +159,7 @@ addfile(char *name, dump_ino_t ino, int type) */ /* ARGSUSED */ long -deletefile(char *name, dump_ino_t ino, int type) +deletefile(char *name, dump_ino_t ino, UNUSED(int type)) { long descend = hflag ? GOOD : FAIL; struct entry *ep; @@ -739,6 +746,7 @@ createleaves(char *symtabfile) struct entry *ep; dump_ino_t first; long curvol; + int doremove; if (command == 'R') { Vprintf(stdout, "Continue extraction of new leaves\n"); @@ -789,11 +797,11 @@ createleaves(char *symtabfile) * be removed since its type may change from one leaf type * to another (e.g. "file" to "character special"). */ - if ((ep->e_flags & EXTRACT) != 0) { - removeleaf(ep); - ep->e_flags &= ~REMOVED; - } - (void) extractfile(myname(ep)); + if ((ep->e_flags & EXTRACT) != 0) + doremove = 1; + else + doremove = 0; + (void) extractfile(ep, doremove); ep->e_flags &= ~(NEW|EXTRACT); /* * We checkpoint the restore after every tape reel, so @@ -915,22 +923,26 @@ createfiles(void) if (GetTapePos(&curtpos) == 0) { /* curtpos +1000 ???, some drives * might be too slow */ - if (tpos > curtpos) { + if (tpos != curtpos) { #ifdef DEBUG_QFA 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 if (GetTapePos(&curtpos) == 0) - msg("before resnyc at tape position %ld\n", curtpos); + msg("before resync at tape position %lld (%ld, %ld, %s)\n", curtpos, next, curfile.ino, curfile.name); #endif - (void)ReReadFromTape(); + ReReadInodeFromTape(next); #ifdef DEBUG_QFA if (GetTapePos(&curtpos) == 0) - msg("after resync at tape position %ld\n", curtpos); + msg("after resync at tape position %lld (%ld, %ld, %s)\n", curtpos, next, curfile.ino, curfile.name); #endif } } +#ifdef DEBUG_QFA + else + msg("already at tape %ld position %ld for inode %10lu ...\n", volno, tpos, (unsigned long)next); +#endif } } } @@ -939,7 +951,7 @@ createfiles(void) if (volinfo[1] == ROOTINO) { int i, goodvol = 1; - for (i = 1; i < TP_NINOS && volinfo[i] != 0; ++i) + for (i = 1; i < (int)TP_NINOS && volinfo[i] != 0; ++i) if (volinfo[i] < next) goodvol = i; @@ -989,8 +1001,11 @@ createfiles(void) ep = lookupino(next); if (ep == NULL) panic("corrupted symbol table\n"); - fprintf(stderr, "%s: (inode %lu) not found on tape\n", - myname(ep), (unsigned long)next); +#ifdef USE_QFA + if (!createtapeposflag) + fprintf(stderr, "%s: (inode %lu) not found on tape\n", + myname(ep), (unsigned long)next); +#endif ep->e_flags &= ~NEW; next = lowerbnd(next); } @@ -1002,7 +1017,23 @@ createfiles(void) ep = lookupino(next); if (ep == NULL) panic("corrupted symbol table\n"); - (void) extractfile(myname(ep)); +#ifdef USE_QFA + if (createtapeposflag) { +#ifdef DEBUG_QFA + msg("inode %ld at tapepos %ld\n", curfile.ino, curtapepos); +#endif + sprintf(gTps, "%ld\t%ld\t%lld\n", (unsigned long)curfile.ino, volno, curtapepos); + if (write(gTapeposfd, gTps, strlen(gTps)) != (ssize_t)strlen(gTps)) + warn("error writing tapepos file.\n"); + skipfile(); + } + else { + msg("restoring %s\n", myname(ep)); +#endif /* USE_QFA */ + (void) extractfile(ep, 0); +#ifdef USE_QFA + } +#endif /* USE_QFA */ ep->e_flags &= ~NEW; if (volno != curvol) skipmaps();