sbin/restore/restore.c
/*
 * This is the routine used to extract files for the 'x' and 'i' commands.
 * Efficiently extract a subset of the files on a tape.
 */
This is the routine used to extract files for the 'x' and 'i' commands.
Efficiently extract a subset of the files on a tape.
This is the routine used to extract files for the ' x ' and ' i ' commands . Efficiently extract a subset of the files on a tape .
void
createfiles()
{
	register ino_t first, next, last;
	register struct entry *ep;
	long curvol;
	vprintf(stdout, "Extract requested files\n");
	curfile.action = SKIP;
	getvol((long)1);
	skipmaps();
	skipdirs();
	first = lowerbnd(ROOTINO);
	last = upperbnd(maxino - 1);
	for (;;) {
		first = lowerbnd(first);
		last = upperbnd(last);
		if (first > last)
			return;
		while (curfile.ino > last) {
			curfile.action = SKIP;
			getvol((long)0);
			skipmaps();
			skipdirs();
		}
		next = lowerbnd(curfile.ino);
		do	{
			curvol = volno;
			while (next > curfile.ino && volno == curvol)
				skipfile();
			skipmaps();
			skipdirs();
		} while (volno == curvol + 1);
		if (volno != curvol)
			continue;
		while (next < curfile.ino) {
			ep = lookupino(next);
			if (ep == NULL)
				panic("corrupted symbol table\n");
			fprintf(stderr, "%s: not found on tape\n", myname(ep));
			ep->e_flags &= ~NEW;
			next = lowerbnd(next);
		}
		if (next == curfile.ino && next <= last) {
			ep = lookupino(next);
			if (ep == NULL)
				panic("corrupted symbol table\n");
			(void) extractfile(myname(ep));
			ep->e_flags &= ~NEW;
			if (volno != curvol)
				skipmaps();
		}
	}
}
void createfiles ( ) { register ino_t first , next , last ; register struct entry * ep ; long curvol ; vprintf ( stdout , " \n " ) ; curfile . action = SKIP ; getvol ( ( long ) 1 ) ; skipmaps ( ) ; skipdirs ( ) ; first = lowerbnd ( ROOTINO ) ; last = upperbnd ( maxino - 1 ) ; for ( ; ; ) { first = lowerbnd ( first ) ; last = upperbnd ( last ) ; if ( first > last ) return ; while ( curfile . ino > last ) { curfile . action = SKIP ; getvol ( ( long ) 0 ) ; skipmaps ( ) ; skipdirs ( ) ; } next = lowerbnd ( curfile . ino ) ; do { curvol = volno ; while ( next > curfile . ino && volno == curvol ) skipfile ( ) ; skipmaps ( ) ; skipdirs ( ) ; } while ( volno == curvol + 1 ) ; if ( volno != curvol ) continue ; while ( next < curfile . ino ) { ep = lookupino ( next ) ; if ( ep == NULL ) panic ( " \n " ) ; fprintf ( stderr , " \n " , myname ( ep ) ) ; ep -> e_flags &= ~ NEW ; next = lowerbnd ( next ) ; } if ( next == curfile . ino && next <= last ) { ep = lookupino ( next ) ; if ( ep == NULL ) panic ( " \n " ) ; ( void ) extractfile ( myname ( ep ) ) ; ep -> e_flags &= ~ NEW ; if ( volno != curvol ) skipmaps ( ) ; } } }
This is the routine used to extract files for the 'x' and 'i' commands.
This is the routine used to extract files for the ' x ' and ' i ' commands .
/*
		 * Check to see if any files remain to be extracted
		 */ /*
		 * Reject any volumes with inodes greater
		 * than the last one needed
		 */ /*
		 * Decide on the next inode needed.
		 * Skip across the inodes until it is found
		 * or an out of order volume change is encountered
		 */ /*
		 * If volume change out of order occurred the
		 * current state must be recalculated
		 */ /*
		 * If the current inode is greater than the one we were
		 * looking for then we missed the one we were looking for.
		 * Since we only attempt to extract files listed in the
		 * dump map, the lost files must have been due to a tape
		 * read error, or a file that was removed while the dump
		 * was in progress. Thus we report all requested files
		 * between the one we were looking for, and the one we
		 * found as missing, and delete their request flags.
		 */ /*
		 * The current inode is the one that we are looking for,
		 * so extract it per its requested name.
		 */