From dea08b68182e61a80798dcae33af444dcaabdde8 Mon Sep 17 00:00:00 2001 From: Ian Dowse Date: Mon, 18 Feb 2002 00:54:18 +0000 Subject: [PATCH] When we reach the end of the dump in findinode(), ask for another volume if we missed some earlier tapes (the user can still enter 'none' later if the tapes are unavailable). Previously with 'x' restores, we might not ask for all tapes if the tapes are supplied in reverse order. Clarify the message that describes what volume should be mounted first; reverse order is only efficient when extracting a few files. --- sbin/restore/tape.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c index 560c4379dddb..62c5fbf629c7 100644 --- a/sbin/restore/tape.c +++ b/sbin/restore/tape.c @@ -284,6 +284,9 @@ setup() */ if (oldinofmt == 0) SETINO(WINO, dumpmap); + /* 'r' restores don't call getvol() for tape 1, so mark it as read. */ + if (command == 'r') + tapesread = 1; } /* @@ -329,18 +332,20 @@ getvol(nextvol) newvol = 0; while (newvol <= 0) { if (tapesread == 0) { - fprintf(stderr, "%s%s%s%s%s", + fprintf(stderr, "%s%s%s%s%s%s%s", "You have not read any tapes yet.\n", - "Unless you know which volume your", - " file(s) are on you should start\n", - "with the last volume and work", - " towards the first.\n"); + "If you are extracting just a few files,", + " start with the last volume\n", + "and work towards the first; restore", + " can quickly skip tapes that\n", + "have no further files to extract.", + " Otherwise, begin with volume 1.\n"); } else { fprintf(stderr, "You have read volumes"); strcpy(buf, ": "); - for (i = 1; i < 32; i++) + for (i = 0; i < 32; i++) if (tapesread & (1 << i)) { - fprintf(stderr, "%s%ld", buf, i); + fprintf(stderr, "%s%ld", buf, i + 1); strcpy(buf, ", "); } fprintf(stderr, "\n"); @@ -358,7 +363,7 @@ getvol(nextvol) } } if (newvol == volno) { - tapesread |= 1 << volno; + tapesread |= 1 << (volno - 1); return; } closemt(); @@ -411,7 +416,7 @@ getvol(nextvol) volno = 0; goto again; } - tapesread |= 1 << volno; + tapesread |= 1 << (volno - 1); blksread = savecnt; /* * If continuing from the previous volume, skip over any @@ -1255,6 +1260,11 @@ findinode(header) break; case TS_END: + /* If we missed some tapes, get another volume. */ + if (tapesread & (tapesread + 1)) { + getvol(0); + continue; + } curfile.ino = maxino; break;