From 9771a638a8bd04e3f2f591121fe326152055d39d Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 14 Jun 2005 19:46:06 +0000 Subject: Kill whiteout support. OK deraadt@ and beck@ --- sbin/restore/extern.h | 4 +--- sbin/restore/interactive.c | 15 +++++---------- sbin/restore/restore.c | 34 +++------------------------------- sbin/restore/symtab.c | 14 +++++++------- sbin/restore/tape.c | 11 ++--------- sbin/restore/utilities.c | 39 ++------------------------------------- 6 files changed, 20 insertions(+), 97 deletions(-) diff --git a/sbin/restore/extern.h b/sbin/restore/extern.h index fd25d4dd5f6..0346cec907f 100644 --- a/sbin/restore/extern.h +++ b/sbin/restore/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.9 2004/12/30 01:51:32 millert Exp $ */ +/* $OpenBSD: extern.h,v 1.10 2005/06/14 19:46:05 millert Exp $ */ /* $NetBSD: extern.h,v 1.4 1995/03/18 14:59:43 cgd Exp $ */ /*- @@ -34,7 +34,6 @@ struct entry *addentry(char *, ino_t, int); long addfile(char *, ino_t, int); -int addwhiteout(char *); void badentry(struct entry *, char *); void canon(char *, char *, size_t); void checkrestore(void); @@ -45,7 +44,6 @@ void createleaves(char *); void createlinks(void); long deletefile(char *, ino_t, int); void deleteino(ino_t); -void delwhiteout(struct entry *); ino_t dirlookup(const char *); void dumpsymtable(char *, long); void extractdirs(int); diff --git a/sbin/restore/interactive.c b/sbin/restore/interactive.c index eff96a97f4e..5968a406bf8 100644 --- a/sbin/restore/interactive.c +++ b/sbin/restore/interactive.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interactive.c,v 1.21 2005/04/28 16:15:46 millert Exp $ */ +/* $OpenBSD: interactive.c,v 1.22 2005/06/14 19:46:05 millert Exp $ */ /* $NetBSD: interactive.c,v 1.10 1997/03/19 08:42:52 lukem Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)interactive.c 8.3 (Berkeley) 9/13/94"; #else -static const char rcsid[] = "$OpenBSD: interactive.c,v 1.21 2005/04/28 16:15:46 millert Exp $"; +static const char rcsid[] = "$OpenBSD: interactive.c,v 1.22 2005/06/14 19:46:05 millert Exp $"; #endif #endif /* not lint */ @@ -518,8 +518,7 @@ printlist(char *name, char *basename) char locname[MAXPATHLEN]; dp = pathsearch(name); - if (dp == NULL || (!dflag && TSTINO(dp->d_ino, dumpmap) == 0) || - (!vflag && dp->d_ino == WINO)) + if (dp == NULL || (!dflag && TSTINO(dp->d_ino, dumpmap) == 0)) return; if ((dirp = rst_opendir(name)) == NULL) { entries = 1; @@ -556,8 +555,7 @@ printlist(char *name, char *basename) break; if (!dflag && TSTINO(dp->d_ino, dumpmap) == 0) continue; - if (!vflag && (dp->d_ino == WINO || - strcmp(dp->d_name, ".") == 0 || + if (!vflag && (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)) continue; locname[namelen] = '\0'; @@ -729,8 +727,6 @@ glob_readdir(RST_DIR *dirp) static struct dirent adirent; while ((dp = rst_readdir(dirp)) != NULL) { - if (!vflag && dp->d_ino == WINO) - continue; if (dflag || TSTINO(dp->d_ino, dumpmap)) break; } @@ -751,8 +747,7 @@ glob_stat(const char *name, struct stat *stp) struct direct *dp; dp = pathsearch(name); - if (dp == NULL || (!dflag && TSTINO(dp->d_ino, dumpmap) == 0) || - (!vflag && dp->d_ino == WINO)) + if (dp == NULL || (!dflag && TSTINO(dp->d_ino, dumpmap) == 0)) return (-1); if (inodetype(dp->d_ino) == NODE) stp->st_mode = S_IFDIR; diff --git a/sbin/restore/restore.c b/sbin/restore/restore.c index 60b460d2895..35c4dca9edd 100644 --- a/sbin/restore/restore.c +++ b/sbin/restore/restore.c @@ -1,4 +1,4 @@ -/* $OpenBSD: restore.c,v 1.13 2004/07/17 02:14:33 deraadt Exp $ */ +/* $OpenBSD: restore.c,v 1.14 2005/06/14 19:46:05 millert Exp $ */ /* $NetBSD: restore.c,v 1.9 1997/06/18 07:10:16 lukem Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)restore.c 8.3 (Berkeley) 9/13/94"; #else -static const char rcsid[] = "$OpenBSD: restore.c,v 1.13 2004/07/17 02:14:33 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: restore.c,v 1.14 2005/06/14 19:46:05 millert Exp $"; #endif #endif /* not lint */ @@ -82,8 +82,6 @@ addfile(char *name, ino_t ino, int type) Dprintf(stdout, "%s: not on the tape\n", name); return (descend); } - if (ino == WINO && command == 'i' && !vflag) - return (descend); if (!mflag) { (void)snprintf(buf, sizeof(buf), "./%u", ino); name = buf; @@ -146,7 +144,6 @@ deletefile(char *name, ino_t ino, int 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. */ @@ -157,22 +154,6 @@ removeoldleaves(void) 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) @@ -762,15 +743,6 @@ createlinks(void) 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); @@ -802,7 +774,7 @@ checkrestore(void) ino_t i; Vprintf(stdout, "Check the symbol table.\n"); - for (i = WINO; i < maxino; i++) { + for (i = ROOTINO; i < maxino; i++) { for (ep = lookupino(i); ep != NULL; ep = ep->e_links) { ep->e_flags &= ~KEEP; if (ep->e_type == NODE) diff --git a/sbin/restore/symtab.c b/sbin/restore/symtab.c index 314c11b29e8..80d5459ee62 100644 --- a/sbin/restore/symtab.c +++ b/sbin/restore/symtab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: symtab.c,v 1.14 2004/07/17 02:14:33 deraadt Exp $ */ +/* $OpenBSD: symtab.c,v 1.15 2005/06/14 19:46:05 millert Exp $ */ /* $NetBSD: symtab.c,v 1.10 1997/03/19 08:42:54 lukem Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)symtab.c 8.2 (Berkeley) 9/13/94"; #else -static const char rcsid[] = "$OpenBSD: symtab.c,v 1.14 2004/07/17 02:14:33 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: symtab.c,v 1.15 2005/06/14 19:46:05 millert Exp $"; #endif #endif /* not lint */ @@ -85,7 +85,7 @@ lookupino(ino_t inum) { struct entry *ep; - if (inum < WINO || inum >= maxino) + if (inum < ROOTINO || inum >= maxino) return (NULL); for (ep = entry[inum % entrytblsize]; ep != NULL; ep = ep->e_next) if (ep->e_ino == inum) @@ -101,7 +101,7 @@ addino(ino_t inum, struct entry *np) { struct entry **epp; - if (inum < WINO || inum >= maxino) + if (inum < ROOTINO || inum >= maxino) panic("addino: out of range %d\n", inum); epp = &entry[inum % entrytblsize]; np->e_ino = inum; @@ -122,7 +122,7 @@ deleteino(ino_t inum) struct entry *next; struct entry **prev; - if (inum < WINO || inum >= maxino) + if (inum < ROOTINO || inum >= maxino) panic("deleteino: out of range %d\n", inum); prev = &entry[inum % entrytblsize]; for (next = *prev; next != NULL; next = next->e_next) { @@ -458,7 +458,7 @@ dumpsymtable(char *filename, long checkpt) * Assign indicies to each entry * Write out the string entries */ - for (i = WINO; i <= maxino; i++) { + for (i = ROOTINO; i <= maxino; i++) { for (ep = lookupino(i); ep != NULL; ep = ep->e_links) { ep->e_index = mynum++; (void)fwrite(ep->e_name, sizeof(char), @@ -470,7 +470,7 @@ dumpsymtable(char *filename, long checkpt) */ tep = &temp; stroff = 0; - for (i = WINO; i <= maxino; i++) { + for (i = ROOTINO; i <= maxino; i++) { for (ep = lookupino(i); ep != NULL; ep = ep->e_links) { memcpy(tep, ep, (long)sizeof(struct entry)); tep->e_name = (char *)stroff; diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c index a15966bc74b..fa6e7b36dee 100644 --- a/sbin/restore/tape.c +++ b/sbin/restore/tape.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tape.c,v 1.30 2004/12/30 01:51:32 millert Exp $ */ +/* $OpenBSD: tape.c,v 1.31 2005/06/14 19:46:05 millert Exp $ */ /* $NetBSD: tape.c,v 1.26 1997/04/15 07:12:25 lukem Exp $ */ /* @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)tape.c 8.6 (Berkeley) 9/13/94"; #else -static const char rcsid[] = "$OpenBSD: tape.c,v 1.30 2004/12/30 01:51:32 millert Exp $"; +static const char rcsid[] = "$OpenBSD: tape.c,v 1.31 2005/06/14 19:46:05 millert Exp $"; #endif #endif /* not lint */ @@ -245,13 +245,6 @@ setup(void) dumpmap = map; curfile.action = USING; getfile(xtrmap, xtrmapskip); - /* - * If there may be whiteout entries on the tape, pretend that the - * whiteout inode exists, so that the whiteout entries can be - * extracted. - */ - if (oldinofmt == 0) - SETINO(WINO, dumpmap); } /* diff --git a/sbin/restore/utilities.c b/sbin/restore/utilities.c index 633f54884e9..5e0261ccadd 100644 --- a/sbin/restore/utilities.c +++ b/sbin/restore/utilities.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utilities.c,v 1.14 2004/07/17 02:14:33 deraadt Exp $ */ +/* $OpenBSD: utilities.c,v 1.15 2005/06/14 19:46:05 millert Exp $ */ /* $NetBSD: utilities.c,v 1.11 1997/03/19 08:42:56 lukem Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)utilities.c 8.4 (Berkeley) 10/18/94"; #else -static const char rcsid[] = "$OpenBSD: utilities.c,v 1.14 2004/07/17 02:14:33 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: utilities.c,v 1.15 2005/06/14 19:46:05 millert Exp $"; #endif #endif /* not lint */ @@ -221,41 +221,6 @@ linkit(char *existing, char *new, int type) return (GOOD); } -/* - * Create a whiteout. - */ -int -addwhiteout(char *name) -{ - - if (!Nflag && mknod(name, S_IFWHT, 0) < 0) { - warn("cannot create whiteout %s", name); - return (FAIL); - } - Vprintf(stdout, "Create whiteout %s\n", name); - return (GOOD); -} - -/* - * Delete a whiteout. - */ -void -delwhiteout(struct entry *ep) -{ - char *name; - - if (ep->e_type != LEAF) - badentry(ep, "delwhiteout: not a leaf"); - ep->e_flags |= REMOVED; - ep->e_flags &= ~TMPNAME; - name = myname(ep); - if (!Nflag && undelete(name) < 0) { - warn("cannot delete whiteout %s", name); - return; - } - Vprintf(stdout, "Delete whiteout %s\n", name); -} - /* * find lowest number file (above "start") that needs to be extracted */ -- cgit v1.2.3