summaryrefslogtreecommitdiffstats
path: root/sbin/restore
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2002-02-18 00:54:18 +0000
committeriedowse <iedowse@FreeBSD.org>2002-02-18 00:54:18 +0000
commit6d0375aeee69aba1b268b1968214be351a62910c (patch)
tree956285ef45030a8f14d541ce0100102098dc64fd /sbin/restore
parent49c65a6b10085c64f7ff4dfb8ccc792f1e9dbc75 (diff)
downloadFreeBSD-src-6d0375aeee69aba1b268b1968214be351a62910c.zip
FreeBSD-src-6d0375aeee69aba1b268b1968214be351a62910c.tar.gz
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.
Diffstat (limited to 'sbin/restore')
-rw-r--r--sbin/restore/tape.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c
index 560c437..62c5fbf 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 @@ again:
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 @@ again:
}
}
if (newvol == volno) {
- tapesread |= 1 << volno;
+ tapesread |= 1 << (volno - 1);
return;
}
closemt();
@@ -411,7 +416,7 @@ gethdr:
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;
OpenPOWER on IntegriCloud