2 * Ported to Linux's Second Extended File System as part of the
3 * dump and restore backup suit
4 * Remy Card <card@Linux.EU.Org>, 1994-1997
5 * Stelian Pop <stelian@popies.net>, 1999-2000
6 * Stelian Pop <stelian@popies.net> - AlcĂ´ve <www.alcove.com>, 2000-2002
10 * Copyright (c) 1983, 1993
11 * The Regents of the University of California. All rights reserved.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. All advertising materials mentioning features or use of this software
22 * must display the following acknowledgement:
23 * This product includes software developed by the University of
24 * California, Berkeley and its contributors.
25 * 4. Neither the name of the University nor the names of its contributors
26 * may be used to endorse or promote products derived from this software
27 * without specific prior written permission.
29 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
43 static const char rcsid[] =
44 "$Id: restore.c,v 1.26 2002/01/25 15:08:59 stelian Exp $";
48 #include <sys/types.h>
51 #include <sys/param.h>
54 #ifdef HAVE_EXT2FS_EXT2_FS_H
55 #include <ext2fs/ext2_fs.h>
57 #include <linux/ext2_fs.h>
59 #include <bsdcompat.h>
61 #include <ufs/ufs/dinode.h>
62 #endif /* __linux__ */
68 #include <ext2fs/ext2fs.h>
74 static char *keyval __P((int));
77 * This implements the 't' option.
78 * List entries on the tape.
81 listfile(char *name, dump_ino_t ino, int type)
83 long descend = hflag ? GOOD : FAIL;
89 if (TSTINO(ino, dumpmap) == 0)
91 Vprintf(stdout, "%s", type == LEAF ? "leaf" : "dir ");
93 if (tapeposflag) { /* add QFA positions to output */
94 (void)Inode2Tapepos(ino, &tnum, &tpos, 1);
95 fprintf(stdout, "%10lu\t%ld\t%lld\t%s\n", (unsigned long)ino,
100 fprintf(stdout, "%10lu\t%s\n", (unsigned long)ino, name);
105 * This implements the 'x' option.
106 * Request that new entries be extracted.
109 addfile(char *name, dump_ino_t ino, int type)
111 struct entry *ep, *np;
112 long descend = hflag ? GOOD : FAIL;
115 if (TSTINO(ino, dumpmap) == 0) {
116 Dprintf(stdout, "%s: not on the tape\n", name);
119 if (ino == WINO && command == 'i' && !vflag)
122 (void) snprintf(buf, sizeof(buf), "./%lu", (unsigned long)ino);
125 (void) genliteraldir(name, ino);
131 if (strcmp(name, myname(ep)) == 0) {
136 for (np = ep->e_links; np; np = np->e_links)
137 if (strcmp(name, myname(np)) == 0) {
142 ep = addentry(name, ino, type);
150 * This is used by the 'i' option to undo previous requests made by addfile.
151 * Delete entries from the request queue.
155 deletefile(char *name, dump_ino_t ino, int type)
157 long descend = hflag ? GOOD : FAIL;
160 if (TSTINO(ino, dumpmap) == 0)
162 ep = lookupname(name);
165 ep->e_flags |= REMOVED;
166 if (ep->e_type != NODE)
173 * The following four routines implement the incremental
174 * restore algorithm. The first removes old entries, the second
175 * does renames and calculates the extraction list, the third
176 * cleans up link names missed by the first two, and the final
177 * one deletes old directories.
179 * Directories cannot be immediately deleted, as they may have
180 * other files in them which need to be moved out first. As
181 * directories to be deleted are found, they are put on the
182 * following deletion list. After all deletions and renames
183 * are done, this list is actually deleted.
185 static struct entry *removelist;
188 * Remove invalid whiteouts from the old tree.
189 * Remove unneeded leaves from the old tree.
190 * Remove directories from the lookup chains.
193 removeoldleaves(void)
195 struct entry *ep, *nextep;
196 dump_ino_t i, mydirino;
198 Vprintf(stdout, "Mark entries to be removed.\n");
199 if ((ep = lookupino(WINO))) {
200 Vprintf(stdout, "Delete whiteouts\n");
201 for ( ; ep != NULL; ep = nextep) {
202 nextep = ep->e_links;
203 mydirino = ep->e_parent->e_ino;
205 * We remove all whiteouts that are in directories
206 * that have been removed or that have been dumped.
208 if (TSTINO(mydirino, usedinomap) &&
209 !TSTINO(mydirino, dumpmap))
212 (void)fprintf(stderr, "BUG! Should call delwhiteout\n");
219 for (i = ROOTINO + 1; i < maxino; i++) {
223 if (TSTINO(i, usedinomap))
225 for ( ; ep != NULL; ep = ep->e_links) {
226 Dprintf(stdout, "%s: REMOVE\n", myname(ep));
227 if (ep->e_type == LEAF) {
232 deleteino(ep->e_ino);
233 ep->e_next = removelist;
241 * For each directory entry on the incremental tape, determine which
242 * category it falls into as follows:
243 * KEEP - entries that are to be left alone.
244 * NEW - new entries to be added.
245 * EXTRACT - files that must be updated with new contents.
246 * LINK - new links to be added.
247 * Renames are done at the same time.
250 nodeupdates(char *name, dump_ino_t ino, int type)
252 struct entry *ep, *np, *ip;
257 # define ONTAPE 0x1 /* inode is on the tape */
258 # define INOFND 0x2 /* inode already exists */
259 # define NAMEFND 0x4 /* name already exists */
260 # define MODECHG 0x8 /* mode of inode changed */
263 * This routine is called once for each element in the
264 * directory hierarchy, with a full path name.
265 * The "type" value is incorrectly specified as LEAF for
266 * directories that are not on the dump tape.
268 * Check to see if the file is on the tape.
270 if (TSTINO(ino, dumpmap))
273 * Check to see if the name exists, and if the name is a link.
275 np = lookupname(name);
278 ip = lookupino(np->e_ino);
280 panic("corrupted symbol table\n");
285 * Check to see if the inode exists, and if one of its links
286 * corresponds to the name (if one was found).
291 for (ep = ip->e_links; ep != NULL; ep = ep->e_links) {
299 * If both a name and an inode are found, but they do not
300 * correspond to the same file, then both the inode that has
301 * been found and the inode corresponding to the name that
302 * has been found need to be renamed. The current pathname
303 * is the new name for the inode that has been found. Since
304 * all files to be deleted have already been removed, the
305 * named file is either a now unneeded link, or it must live
306 * under a new name in this dump level. If it is a link, it
307 * can be removed. If it is not a link, it is given a
308 * temporary name in anticipation that it will be renamed
309 * when it is later found by inode number.
311 if (((key & (INOFND|NAMEFND)) == (INOFND|NAMEFND)) && ip != np) {
312 if (lookuptype == LINK) {
316 Dprintf(stdout, "name/inode conflict, mktempname %s\n",
323 if ((key & ONTAPE) &&
324 (((key & INOFND) && ip->e_type != type) ||
325 ((key & NAMEFND) && np->e_type != type)))
329 * Decide on the disposition of the file based on its flags.
330 * Note that we have already handled the case in which
331 * a name and inode are found that correspond to different files.
332 * Thus if both NAMEFND and INOFND are set then ip == np.
337 * A previously existing file has been found.
338 * Mark it as KEEP so that other links to the inode can be
339 * detected, and so that it will not be reclaimed by the search
340 * for unreferenced names.
344 Dprintf(stdout, "[%s] %s: %s\n", keyval(key), name,
349 * A file on the tape has a name which is the same as a name
350 * corresponding to a different file in the previous dump.
351 * Since all files to be deleted have already been removed,
352 * this file is either a now unneeded link, or it must live
353 * under a new name in this dump level. If it is a link, it
354 * can simply be removed. If it is not a link, it is given a
355 * temporary name in anticipation that it will be renamed
356 * when it is later found by inode number (see INOFND case
357 * below). The entry is then treated as a new file.
360 case ONTAPE|NAMEFND|MODECHG:
361 if (lookuptype == LINK) {
370 * A previously non-existent file.
371 * Add it to the file system, and request its extraction.
372 * If it is a directory, create it immediately.
373 * (Since the name is unused there can be no conflict)
376 ep = addentry(name, ino, type);
379 ep->e_flags |= NEW|KEEP;
380 Dprintf(stdout, "[%s] %s: %s\n", keyval(key), name,
385 * A file with the same inode number, but a different
386 * name has been found. If the other name has not already
387 * been found (indicated by the KEEP flag, see above) then
388 * this must be a new name for the file, and it is renamed.
389 * If the other name has been found then this must be a
390 * link to the file. Hard links to directories are not
391 * permitted, and are either deleted or converted to
392 * symbolic links. Finally, if the file is on the tape,
393 * a request is made to extract it.
396 if (type == LEAF && (ip->e_flags & KEEP) == 0)
397 ip->e_flags |= EXTRACT;
400 if ((ip->e_flags & KEEP) == 0) {
401 renameit(myname(ip), name);
404 Dprintf(stdout, "[%s] %s: %s\n", keyval(key), name,
408 if (ip->e_type == NODE) {
411 "deleted hard link %s to directory %s\n",
415 ep = addentry(name, ino, type|LINK);
417 Dprintf(stdout, "[%s] %s: %s|LINK\n", keyval(key), name,
422 * A previously known file which is to be updated. If it is a link,
423 * then all names referring to the previous file must be removed
424 * so that the subset of them that remain can be recreated.
426 case ONTAPE|INOFND|NAMEFND:
427 if (lookuptype == LINK) {
430 ep = addentry(name, ino, type|LINK);
433 ep->e_flags |= NEW|KEEP;
434 Dprintf(stdout, "[%s] %s: %s|LINK\n", keyval(key), name,
438 if (type == LEAF && lookuptype != LINK)
439 np->e_flags |= EXTRACT;
441 Dprintf(stdout, "[%s] %s: %s\n", keyval(key), name,
446 * An inode is being reused in a completely different way.
447 * Normally an extract can simply do an "unlink" followed
448 * by a "creat". Here we must do effectively the same
449 * thing. The complications arise because we cannot really
450 * delete a directory since it may still contain files
451 * that we need to rename, so we delete it from the symbol
452 * table, and put it on the list to be deleted eventually.
453 * Conversely if a directory is to be created, it must be
454 * done immediately, rather than waiting until the
457 case ONTAPE|INOFND|MODECHG:
458 case ONTAPE|INOFND|NAMEFND|MODECHG:
459 if (ip->e_flags & KEEP) {
460 badentry(ip, "cannot KEEP and change modes");
463 if (ip->e_type == LEAF) {
464 /* changing from leaf to node */
465 for ( ; ip != NULL; ip = ip->e_links) {
466 if (ip->e_type != LEAF)
467 badentry(ip, "NODE and LEAF links to same inode");
471 ip = addentry(name, ino, type);
474 /* changing from node to leaf */
475 if ((ip->e_flags & TMPNAME) == 0)
477 deleteino(ip->e_ino);
478 ip->e_next = removelist;
480 ip = addentry(name, ino, type);
482 ip->e_flags |= NEW|KEEP;
483 Dprintf(stdout, "[%s] %s: %s\n", keyval(key), name,
488 * A hard link to a directory that has been removed.
492 Dprintf(stdout, "[%s] %s: Extraneous name\n", keyval(key),
498 * If we find a directory entry for a file that is not on
499 * the tape, then we must have found a file that was created
500 * while the dump was in progress. Since we have no contents
501 * for it, we discard the name knowing that it will be on the
502 * next incremental tape.
505 if (compare_ignore_not_found) break;
506 fprintf(stderr, "%s: (inode %lu) not found on tape\n",
507 name, (unsigned long)ino);
512 * If any of these arise, something is grievously wrong with
513 * the current state of the symbol table.
515 case INOFND|NAMEFND|MODECHG:
516 case NAMEFND|MODECHG:
518 fprintf(stderr, "[%s] %s: inconsistent state\n", keyval(key),
523 * These states "cannot" arise for any state of the symbol table.
528 panic("[%s] %s: impossible state\n", keyval(key), name);
535 * Calculate the active flags in a key.
540 static char keybuf[32];
542 (void) strcpy(keybuf, "|NIL");
545 (void) strcat(keybuf, "|ONTAPE");
547 (void) strcat(keybuf, "|INOFND");
549 (void) strcat(keybuf, "|NAMEFND");
551 (void) strcat(keybuf, "|MODECHG");
556 * Find unreferenced link names.
561 struct entry *ep, *np;
564 Vprintf(stdout, "Find unreferenced names.\n");
565 for (i = ROOTINO; i < maxino; i++) {
567 if (ep == NULL || ep->e_type == LEAF || TSTINO(i, dumpmap) == 0)
569 for (np = ep->e_entries; np != NULL; np = np->e_sibling) {
570 if (np->e_flags == 0) {
572 "%s: remove unreferenced name\n",
580 * Any leaves remaining in removed directories is unreferenced.
582 for (ep = removelist; ep != NULL; ep = ep->e_next) {
583 for (np = ep->e_entries; np != NULL; np = np->e_sibling) {
584 if (np->e_type == LEAF) {
585 if (np->e_flags != 0)
586 badentry(np, "unreferenced with flags");
588 "%s: remove unreferenced name\n",
598 * Remove old nodes (directories).
599 * Note that this routine runs in O(N*D) where:
600 * N is the number of directory entries to be removed.
601 * D is the maximum depth of the tree.
602 * If N == D this can be quite slow. If the list were
603 * topologically sorted, the deletion could be done in
609 struct entry *ep, **prev;
612 Vprintf(stdout, "Remove old nodes (directories).\n");
616 for (ep = removelist; ep != NULL; ep = *prev) {
617 if (ep->e_entries != NULL) {
627 for (ep = removelist; ep != NULL; ep = ep->e_next)
628 badentry(ep, "cannot remove, non-empty");
631 /* Compare the file specified in `ep' (which is on tape) to the */
632 /* current copy of this file on disk. If do_compare is 0, then just */
633 /* make our caller think we did it--this is used to handle hard links */
634 /* to files and devices. */
636 compare_entry(struct entry *ep, int do_compare)
638 if ((ep->e_flags & (NEW|EXTRACT)) == 0) {
639 badentry(ep, "unexpected file on tape");
642 if (do_compare) (void) comparefile(myname(ep));
643 ep->e_flags &= ~(NEW|EXTRACT);
647 * This is the routine used to compare files for the 'C' command.
656 first = lowerbnd(ROOTINO);
658 while (curfile.ino < maxino) {
659 first = lowerbnd(first);
661 * If the next available file is not the one which we
662 * expect then we have missed one or more files. Since
663 * we do not request files that were not on the tape,
664 * the lost files must have been due to a tape read error,
665 * or a file that was removed while the dump was in progress.
667 while (first < curfile.ino) {
668 ep = lookupino(first);
670 panic("%d: bad first\n", first);
671 fprintf(stderr, "%s: not found on tape\n", myname(ep));
673 ep->e_flags &= ~(NEW|EXTRACT);
674 first = lowerbnd(first);
677 * If we find files on the tape that have no corresponding
678 * directory entries, then we must have found a file that
679 * was created while the dump was in progress. Since we have
680 * no name for it, we discard it knowing that it will be
681 * on the next incremental tape.
683 if (first != curfile.ino) {
684 fprintf(stderr, "expected next file %ld, got %lu\n",
685 (long)first, (unsigned long)curfile.ino);
690 ep = lookupino(curfile.ino);
692 panic("unknown file on tape\n");
695 compare_entry(ep, 1);
696 for (ep = ep->e_links; ep != NULL; ep = ep->e_links) {
697 compare_entry(ep, 0);
701 * We checkpoint the restore after every tape reel, so
702 * as to simplify the amount of work re quired by the
706 if (curvol != volno) {
712 * If we encounter the end of the tape and the next available
713 * file is not the one which we expect then we have missed one
714 * or more files. Since we do not request files that were not
715 * on the tape, the lost files must have been due to a tape
716 * read error, or a file that was removed while the dump was
719 first = lowerbnd(first);
720 while (first < curfile.ino) {
721 ep = lookupino(first);
723 panic("%d: bad first\n", first);
724 fprintf(stderr, "%s: (inode %lu) not found on tape\n",
725 myname(ep), (unsigned long)first);
727 ep->e_flags &= ~(NEW|EXTRACT);
728 first = lowerbnd(first);
733 * This is the routine used to extract files for the 'r' command.
734 * Extract new leaves.
737 createleaves(char *symtabfile)
743 if (command == 'R') {
744 Vprintf(stdout, "Continue extraction of new leaves\n");
746 Vprintf(stdout, "Extract new leaves.\n");
747 dumpsymtable(symtabfile, volno);
749 first = lowerbnd(ROOTINO);
751 while (curfile.ino < maxino) {
752 first = lowerbnd(first);
754 * If the next available file is not the one which we
755 * expect then we have missed one or more files. Since
756 * we do not request files that were not on the tape,
757 * the lost files must have been due to a tape read error,
758 * or a file that was removed while the dump was in progress.
760 while (first < curfile.ino) {
761 ep = lookupino(first);
763 panic("%d: bad first\n", first);
764 fprintf(stderr, "%s: (inode %lu) not found on tape\n",
765 myname(ep), (unsigned long)first);
766 ep->e_flags &= ~(NEW|EXTRACT);
767 first = lowerbnd(first);
770 * If we find files on the tape that have no corresponding
771 * directory entries, then we must have found a file that
772 * was created while the dump was in progress. Since we have
773 * no name for it, we discard it knowing that it will be
774 * on the next incremental tape.
776 if (first != curfile.ino) {
777 fprintf(stderr, "expected next file %ld, got %lu\n",
778 (long)first, (unsigned long)curfile.ino);
782 ep = lookupino(curfile.ino);
784 panic("unknown file on tape\n");
785 if ((ep->e_flags & (NEW|EXTRACT)) == 0)
786 badentry(ep, "unexpected file on tape");
788 * If the file is to be extracted, then the old file must
789 * be removed since its type may change from one leaf type
790 * to another (e.g. "file" to "character special").
792 if ((ep->e_flags & EXTRACT) != 0) {
794 ep->e_flags &= ~REMOVED;
796 (void) extractfile(myname(ep));
797 ep->e_flags &= ~(NEW|EXTRACT);
799 * We checkpoint the restore after every tape reel, so
800 * as to simplify the amount of work required by the
804 if (curvol != volno) {
805 dumpsymtable(symtabfile, volno);
811 * If we encounter the end of the tape and the next available
812 * file is not the one which we expect then we have missed one
813 * or more files. Since we do not request files that were not
814 * on the tape, the lost files must have been due to a tape
815 * read error, or a file that was removed while the dump was
818 first = lowerbnd(first);
819 while (first < curfile.ino) {
820 ep = lookupino(first);
822 panic("%d: bad first\n", first);
823 fprintf(stderr, "%s: (inode %lu) not found on tape\n",
824 myname(ep), (unsigned long)first);
826 ep->e_flags &= ~(NEW|EXTRACT);
827 first = lowerbnd(first);
832 * This is the routine used to extract files for the 'x' and 'i' commands.
833 * Efficiently extract a subset of the files on a tape.
838 dump_ino_t first, next, last;
843 long long tpos, curtpos;
844 time_t tistart, tiend, titaken;
847 Vprintf(stdout, "Extract requested files\n");
848 curfile.action = SKIP;
854 if (volinfo[1] == ROOTINO)
860 first = lowerbnd(ROOTINO);
861 last = upperbnd(maxino - 1);
866 first = lowerbnd(first);
867 last = upperbnd(last);
869 * Check to see if any files remain to be extracted
874 * Reject any volumes with inodes greater
875 * than the last one needed
877 while (curfile.ino > last) {
878 curfile.action = SKIP;
881 if (curfile.ino == maxino) {
882 next = lowerbnd(first);
883 while (next < curfile.ino) {
884 ep = lookupino(next);
886 panic("corrupted symbol table\n");
887 fprintf(stderr, "%s: (inode %lu) not found on tape\n",
888 myname(ep), (unsigned long)next);
890 next = lowerbnd(next);
898 * Decide on the next inode needed.
899 * Skip across the inodes until it is found
900 * or an out of order volume change is encountered
902 next = lowerbnd(curfile.ino);
904 tistart = time(NULL);
906 /* get tape position for inode (position directly) */
907 (void)Inode2Tapepos(next, &tnum, &tpos, 1);
909 /* get tape position for last available inode
910 * (position before) */
911 (void)Inode2Tapepos(next, &tnum, &tpos, 0);
914 (void)RequestVol(tnum);
915 if (GetTapePos(&curtpos) == 0) {
916 /* curtpos +1000 ???, some drives
917 * might be too slow */
918 if (tpos > curtpos) {
920 msg("positioning tape %ld from %lld to %lld for inode %10lu ...\n", volno, curtpos, tpos, (unsigned long)next);
922 if (GotoTapePos(tpos) == 0) {
924 if (GetTapePos(&curtpos) == 0)
925 msg("before resnyc at tape position %ld\n", curtpos);
927 (void)ReReadFromTape();
929 if (GetTapePos(&curtpos) == 0)
930 msg("after resync at tape position %ld\n", curtpos);
939 if (volinfo[1] == ROOTINO) {
942 for (i = 1; i < TP_NINOS && volinfo[i] != 0; ++i)
943 if (volinfo[i] < next)
946 if (goodvol != volno)
952 while (next > curfile.ino && volno == curvol) {
960 } while (volno == curvol + 1);
963 titaken = tiend - tistart;
965 if (titaken / 60 > 0)
966 msg("%ld reads took %d:%02d:%02d\n",
967 tmpcnt, titaken / 3600,
968 (titaken % 3600) / 60, titaken % 60);
973 * If volume change out of order occurred the
974 * current state must be recalculated
979 * If the current inode is greater than the one we were
980 * looking for then we missed the one we were looking for.
981 * Since we only attempt to extract files listed in the
982 * dump map, the lost files must have been due to a tape
983 * read error, or a file that was removed while the dump
984 * was in progress. Thus we report all requested files
985 * between the one we were looking for, and the one we
986 * found as missing, and delete their request flags.
988 while (next < curfile.ino) {
989 ep = lookupino(next);
991 panic("corrupted symbol table\n");
992 fprintf(stderr, "%s: (inode %lu) not found on tape\n",
993 myname(ep), (unsigned long)next);
995 next = lowerbnd(next);
998 * The current inode is the one that we are looking for,
999 * so extract it per its requested name.
1001 if (next == curfile.ino && next <= last) {
1002 ep = lookupino(next);
1004 panic("corrupted symbol table\n");
1005 (void) extractfile(myname(ep));
1006 ep->e_flags &= ~NEW;
1007 if (volno != curvol)
1019 struct entry *np, *ep;
1023 if ((ep = lookupino(WINO))) {
1024 Vprintf(stdout, "Add whiteouts\n");
1025 for ( ; ep != NULL; ep = ep->e_links) {
1026 if ((ep->e_flags & NEW) == 0)
1029 (void)fprintf(stderr, "BUG! Should call addwhiteout\n");
1031 (void) addwhiteout(myname(ep));
1033 ep->e_flags &= ~NEW;
1036 Vprintf(stdout, "Add links\n");
1037 for (i = ROOTINO; i < maxino; i++) {
1041 for (np = ep->e_links; np != NULL; np = np->e_links) {
1042 if ((np->e_flags & NEW) == 0)
1044 (void) strcpy(name, myname(ep));
1045 if (ep->e_type == NODE) {
1046 (void) linkit(name, myname(np), SYMLINK);
1048 (void) linkit(name, myname(np), HARDLINK);
1050 np->e_flags &= ~NEW;
1056 * Check the symbol table.
1057 * We do this to insure that all the requested work was done, and
1058 * that no temporary names remain.
1066 Vprintf(stdout, "Check the symbol table.\n");
1067 for (i = WINO; i < maxino; i++) {
1068 for (ep = lookupino(i); ep != NULL; ep = ep->e_links) {
1069 ep->e_flags &= ~KEEP;
1070 if (ep->e_type == NODE)
1071 ep->e_flags &= ~(NEW|EXISTED);
1072 if (ep->e_flags /* != NULL */)
1073 badentry(ep, "incomplete operations");
1079 * Compare with the directory structure on the tape
1080 * A paranoid check that things are as they should be.
1083 verifyfile(char *name, dump_ino_t ino, int type)
1085 struct entry *np, *ep;
1086 long descend = GOOD;
1088 ep = lookupname(name);
1090 fprintf(stderr, "Warning: missing name %s\n", name);
1093 np = lookupino(ino);
1096 for ( ; np != NULL; np = np->e_links)
1100 panic("missing inumber %d\n", ino);
1101 if (ep->e_type == LEAF && type != LEAF)
1102 badentry(ep, "type should be LEAF");