diff options
author | Peter Wemm <peter@FreeBSD.org> | 1997-03-11 12:55:19 +0000 |
---|---|---|
committer | Peter Wemm <peter@FreeBSD.org> | 1997-03-11 12:55:19 +0000 |
commit | d87d79aefeaab4000f535ef004e0372d97a89724 (patch) | |
tree | f090988086c1b9d1cd8b2e0c0fc7ae3c23e8760a /sbin/restore/restore.c | |
parent | 08966bd5fd3099449eb5e58de9f49e7b3887e48f (diff) | |
download | src-d87d79aefeaab4000f535ef004e0372d97a89724.tar.gz src-d87d79aefeaab4000f535ef004e0372d97a89724.zip |
Notes
Diffstat (limited to 'sbin/restore/restore.c')
-rw-r--r-- | sbin/restore/restore.c | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/sbin/restore/restore.c b/sbin/restore/restore.c index 97bd6ccc3650..936d857d8b52 100644 --- a/sbin/restore/restore.c +++ b/sbin/restore/restore.c @@ -32,7 +32,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)restore.c 8.1 (Berkeley) 6/5/93"; +static char sccsid[] = "@(#)restore.c 8.3 (Berkeley) 9/13/94"; #endif /* not lint */ #include <sys/types.h> @@ -85,6 +85,8 @@ addfile(name, ino, type) dprintf(stdout, "%s: not on the tape\n", name); return (descend); } + if (ino == WINO && command == 'i' && !vflag) + return (descend); if (!mflag) { (void) sprintf(buf, "./%u", ino); name = buf; @@ -124,9 +126,13 @@ deletefile(name, ino, type) if (TSTINO(ino, dumpmap) == 0) return (descend); - ep = lookupino(ino); - if (ep != NULL) + ep = lookupname(name); + if (ep != NULL) { ep->e_flags &= ~NEW; + ep->e_flags |= REMOVED; + if (ep->e_type != NODE) + freeentry(ep); + } return (descend); } @@ -146,21 +152,38 @@ deletefile(name, ino, type) static struct entry *removelist; /* + * Remove invalid whiteouts from the old tree. * Remove unneeded leaves from the old tree. * Remove directories from the lookup chains. */ void removeoldleaves() { - register struct entry *ep; - register ino_t i; + register struct entry *ep, *nextep; + register ino_t i, mydirino; vprintf(stdout, "Mark entries to be removed.\n"); + if (ep = lookupino(WINO)) { + vprintf(stdout, "Delete whiteouts\n"); + for ( ; ep != NULL; ep = nextep) { + nextep = ep->e_links; + mydirino = ep->e_parent->e_ino; + /* + * We remove all whiteouts that are in directories + * that have been removed or that have been dumped. + */ + if (TSTINO(mydirino, usedinomap) && + !TSTINO(mydirino, dumpmap)) + continue; + delwhiteout(ep); + freeentry(ep); + } + } for (i = ROOTINO + 1; i < maxino; i++) { ep = lookupino(i); if (ep == NULL) continue; - if (TSTINO(i, clrimap)) + if (TSTINO(i, usedinomap)) continue; for ( ; ep != NULL; ep = ep->e_links) { dprintf(stdout, "%s: REMOVE\n", myname(ep)); @@ -745,6 +768,15 @@ createlinks() register ino_t i; char name[BUFSIZ]; + if (ep = lookupino(WINO)) { + vprintf(stdout, "Add whiteouts\n"); + for ( ; ep != NULL; ep = ep->e_links) { + if ((ep->e_flags & NEW) == 0) + continue; + (void) addwhiteout(myname(ep)); + ep->e_flags &= ~NEW; + } + } vprintf(stdout, "Add links\n"); for (i = ROOTINO; i < maxino; i++) { ep = lookupino(i); @@ -776,7 +808,7 @@ checkrestore() register ino_t i; vprintf(stdout, "Check the symbol table.\n"); - for (i = ROOTINO; i < maxino; i++) { + for (i = WINO; i < maxino; i++) { for (ep = lookupino(i); ep != NULL; ep = ep->e_links) { ep->e_flags &= ~KEEP; if (ep->e_type == NODE) |