Lines Matching +full:if +full:- +full:no +full:- +full:files +full:- +full:found

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 if (TSTINO(ino, dumpmap) == 0) in listfile()
73 if (TSTINO(ino, dumpmap) == 0) { in addfile()
77 if (ino == UFS_WINO && command == 'i' && !vflag) in addfile()
79 if (!mflag) { in addfile()
82 if (type == NODE) { in addfile()
88 if (ep != NULL) { in addfile()
89 if (strcmp(name, myname(ep)) == 0) { in addfile()
90 ep->e_flags |= NEW; in addfile()
96 if (type == NODE) in addfile()
98 ep->e_flags |= NEW; in addfile()
113 if (TSTINO(ino, dumpmap) == 0) in deletefile()
116 if (ep != NULL) { in deletefile()
117 ep->e_flags &= ~NEW; in deletefile()
118 ep->e_flags |= REMOVED; in deletefile()
119 if (ep->e_type != NODE) in deletefile()
133 * other files in them which need to be moved out first. As
134 * directories to be deleted are found, they are put on the
152 if ((ep = lookupino(UFS_WINO))) { in removeoldleaves()
155 nextep = ep->e_links; in removeoldleaves()
156 mydirino = ep->e_parent->e_ino; in removeoldleaves()
161 if (TSTINO(mydirino, usedinomap) && in removeoldleaves()
170 if (ep == NULL) in removeoldleaves()
172 if (TSTINO(i, usedinomap)) in removeoldleaves()
174 for ( ; ep != NULL; ep = ep->e_links) { in removeoldleaves()
176 if (ep->e_type == LEAF) { in removeoldleaves()
181 deleteino(ep->e_ino); in removeoldleaves()
182 ep->e_next = removelist; in removeoldleaves()
192 * KEEP - entries that are to be left alone.
193 * NEW - new entries to be added.
194 * EXTRACT - files that must be updated with new contents.
195 * LINK - new links to be added.
217 * Check to see if the file is on the tape. in nodeupdates()
219 if (TSTINO(ino, dumpmap)) in nodeupdates()
222 * Check to see if the name exists, and if the name is a link. in nodeupdates()
225 if (np != NULL) { in nodeupdates()
227 ip = lookupino(np->e_ino); in nodeupdates()
228 if (ip == NULL) in nodeupdates()
230 if (ip != np) in nodeupdates()
234 * Check to see if the inode exists, and if one of its links in nodeupdates()
235 * corresponds to the name (if one was found). in nodeupdates()
238 if (ip != NULL) { in nodeupdates()
240 for (ep = ip->e_links; ep != NULL; ep = ep->e_links) { in nodeupdates()
241 if (ep == np) { in nodeupdates()
248 * If both a name and an inode are found, but they do not in nodeupdates()
250 * been found and the inode corresponding to the name that in nodeupdates()
251 * has been found need to be renamed. The current pathname in nodeupdates()
252 * is the new name for the inode that has been found. Since in nodeupdates()
253 * all files to be deleted have already been removed, the in nodeupdates()
255 * under a new name in this dump level. If it is a link, it in nodeupdates()
256 * can be removed. If it is not a link, it is given a in nodeupdates()
258 * when it is later found by inode number. in nodeupdates()
260 if (((key & (INOFND|NAMEFND)) == (INOFND|NAMEFND)) && ip != np) { in nodeupdates()
261 if (lookuptype == LINK) { in nodeupdates()
272 if ((key & ONTAPE) && in nodeupdates()
273 (((key & INOFND) && ip->e_type != type) || in nodeupdates()
274 ((key & NAMEFND) && np->e_type != type))) in nodeupdates()
280 * a name and inode are found that correspond to different files. in nodeupdates()
281 * Thus if both NAMEFND and INOFND are set then ip == np. in nodeupdates()
286 * A previously existing file has been found. in nodeupdates()
292 ip->e_flags |= KEEP; in nodeupdates()
300 * Since all files to be deleted have already been removed, in nodeupdates()
302 * under a new name in this dump level. If it is a link, it in nodeupdates()
303 * can simply be removed. If it is not a link, it is given a in nodeupdates()
305 * when it is later found by inode number (see INOFND case in nodeupdates()
310 if (lookuptype == LINK) { in nodeupdates()
319 * A previously non-existent file. in nodeupdates()
321 * If it is a directory, create it immediately. in nodeupdates()
322 * (Since the name is unused there can be no conflict) in nodeupdates()
326 if (type == NODE) in nodeupdates()
328 ep->e_flags |= NEW|KEEP; in nodeupdates()
335 * name has been found. If the other name has not already in nodeupdates()
336 * been found (indicated by the KEEP flag, see above) then in nodeupdates()
338 * If the other name has been found then this must be a in nodeupdates()
341 * symbolic links. Finally, if the file is on the tape, in nodeupdates()
345 if (type == LEAF && (ip->e_flags & KEEP) == 0) in nodeupdates()
346 ip->e_flags |= EXTRACT; in nodeupdates()
349 if ((ip->e_flags & KEEP) == 0) { in nodeupdates()
352 ip->e_flags |= KEEP; in nodeupdates()
357 if (ip->e_type == NODE) { in nodeupdates()
365 ep->e_flags |= NEW; in nodeupdates()
371 * A previously known file which is to be updated. If it is a link, in nodeupdates()
376 if (lookuptype == LINK) { in nodeupdates()
380 if (type == NODE) in nodeupdates()
382 ep->e_flags |= NEW|KEEP; in nodeupdates()
387 if (type == LEAF && lookuptype != LINK) in nodeupdates()
388 np->e_flags |= EXTRACT; in nodeupdates()
389 np->e_flags |= KEEP; in nodeupdates()
399 * delete a directory since it may still contain files in nodeupdates()
402 * Conversely if a directory is to be created, it must be in nodeupdates()
408 if (ip->e_flags & KEEP) { in nodeupdates()
412 if (ip->e_type == LEAF) { in nodeupdates()
414 for (ip = lookupino(ino); ip != NULL; ip = ip->e_links) { in nodeupdates()
415 if (ip->e_type != LEAF) in nodeupdates()
424 if ((ip->e_flags & TMPNAME) == 0) in nodeupdates()
426 deleteino(ip->e_ino); in nodeupdates()
427 ip->e_next = removelist; in nodeupdates()
431 ip->e_flags |= NEW|KEEP; in nodeupdates()
447 * If we find a directory entry for a file that is not on in nodeupdates()
448 * the tape, then we must have found a file that was created in nodeupdates()
449 * while the dump was in progress. Since we have no contents in nodeupdates()
454 fprintf(stderr, "%s: (inode %ju) not found on tape\n", in nodeupdates()
459 * If any of these arise, something is grievously wrong with in nodeupdates()
491 if (key & ONTAPE) in keyval()
493 if (key & INOFND) in keyval()
495 if (key & NAMEFND) in keyval()
497 if (key & MODECHG) in keyval()
514 if (ep == NULL || ep->e_type == LEAF || TSTINO(i, dumpmap) == 0) in findunreflinks()
516 for (np = ep->e_entries; np != NULL; np = np->e_sibling) { in findunreflinks()
517 if (np->e_flags == 0) { in findunreflinks()
529 for (ep = removelist; ep != NULL; ep = ep->e_next) { in findunreflinks()
530 for (np = ep->e_entries; np != NULL; np = np->e_sibling) { in findunreflinks()
531 if (np->e_type == LEAF) { in findunreflinks()
532 if (np->e_flags != 0) in findunreflinks()
549 * If N == D this can be quite slow. If the list were
564 if (ep->e_entries != NULL) { in removeoldnodes()
565 prev = &ep->e_next; in removeoldnodes()
568 *prev = ep->e_next; in removeoldnodes()
574 for (ep = removelist; ep != NULL; ep = ep->e_next) in removeoldnodes()
575 badentry(ep, "cannot remove, non-empty"); in removeoldnodes()
579 * This is the routine used to extract files for the 'r' command.
589 if (command == 'R') { in createleaves()
600 * If the next available file is not the one which we in createleaves()
601 * expect then we have missed one or more files. Since in createleaves()
602 * we do not request files that were not on the tape, in createleaves()
603 * the lost files must have been due to a tape read error, in createleaves()
608 if (ep == NULL) in createleaves()
610 fprintf(stderr, "%s: not found on tape\n", myname(ep)); in createleaves()
611 ep->e_flags &= ~(NEW|EXTRACT); in createleaves()
615 * If we find files on the tape that have no corresponding in createleaves()
616 * directory entries, then we must have found a file that in createleaves()
618 * no name for it, we discard it knowing that it will be in createleaves()
621 if (first != curfile.ino) { in createleaves()
628 if (ep == NULL) in createleaves()
630 if ((ep->e_flags & (NEW|EXTRACT)) == 0) in createleaves()
633 * If the file is to be extracted, then the old file must in createleaves()
637 if ((ep->e_flags & EXTRACT) != 0) { in createleaves()
639 ep->e_flags &= ~REMOVED; in createleaves()
642 ep->e_flags &= ~(NEW|EXTRACT); in createleaves()
649 if (curvol != volno) { in createleaves()
658 * This is the routine used to extract files for the 'x' and 'i' commands.
659 * Efficiently extract a subset of the files on a tape.
668 vprintf(stdout, "Extract requested files\n"); in createfiles()
674 last = upperbnd(maxino - 1); in createfiles()
680 * Check to see if any files remain to be extracted in createfiles()
682 if (first > last) in createfiles()
684 if (Dflag) { in createfiles()
685 if (curfile.ino == maxino) in createfiles()
687 if((ep = lookupino(curfile.ino)) != NULL && in createfiles()
688 (ep->e_flags & (NEW|EXTRACT))) { in createfiles()
699 * if there are no further volumes available (curfile.ino in createfiles()
700 * >= maxino) or if we are already at the first tape. in createfiles()
702 if (curfile.ino > last && curfile.ino < maxino && volno > 1) { in createfiles()
711 * Skip across the inodes until it is found in createfiles()
714 if (curfile.ino < maxino) { in createfiles()
718 if (volno != curvol) { in createfiles()
725 * No further volumes or inodes available. Set in createfiles()
732 * If the current inode is greater than the one we were in createfiles()
734 * Since we only attempt to extract files listed in the in createfiles()
735 * dump map, the lost files must have been due to a tape in createfiles()
737 * was in progress. Thus we report all requested files in createfiles()
739 * found as missing, and delete their request flags. in createfiles()
743 if (ep == NULL) in createfiles()
745 fprintf(stderr, "%s: not found on tape\n", myname(ep)); in createfiles()
746 ep->e_flags &= ~NEW; in createfiles()
753 if (next == curfile.ino && next <= last) { in createfiles()
755 if (ep == NULL) in createfiles()
759 ep->e_flags &= ~NEW; in createfiles()
760 if (volno != curvol) in createfiles()
776 if ((ep = lookupino(UFS_WINO))) { in createlinks()
778 for ( ; ep != NULL; ep = ep->e_links) { in createlinks()
779 if ((ep->e_flags & NEW) == 0) in createlinks()
782 ep->e_flags &= ~NEW; in createlinks()
788 if (ep == NULL) in createlinks()
790 for (np = ep->e_links; np != NULL; np = np->e_links) { in createlinks()
791 if ((np->e_flags & NEW) == 0) in createlinks()
794 if (ep->e_type == NODE) { in createlinks()
799 np->e_flags &= ~NEW; in createlinks()
807 * that no temporary names remain.
817 for (ep = lookupino(i); ep != NULL; ep = ep->e_links) { in checkrestore()
818 ep->e_flags &= ~KEEP; in checkrestore()
819 if (ep->e_type == NODE) in checkrestore()
820 ep->e_flags &= ~(NEW|EXISTED); in checkrestore()
821 if (ep->e_flags != 0) in checkrestore()
838 if (ep == NULL) { in verifyfile()
843 if (np != ep) in verifyfile()
845 for ( ; np != NULL; np = np->e_links) in verifyfile()
846 if (np == ep) in verifyfile()
848 if (np == NULL) in verifyfile()
850 if (ep->e_type == LEAF && type != LEAF) in verifyfile()