FreeBSD/sbin/restore/tape.c
/*
 * Check that a header is where it belongs and predict the next header
 */
Check that a header is where it belongs and predict the next header
Check that a header is where it belongs and predict the next header
static void
accthdr(struct s_spcl *header)
{
	static ino_t previno = 0x7fffffff;
	static int prevtype;
	static long predict;
	long blks, i;
	if (header->c_type == TS_TAPE) {
		fprintf(stderr, "Volume header ");
 		if (header->c_firstrec)
 			fprintf(stderr, "begins with record %jd",
			    (intmax_t)header->c_firstrec);
 		fprintf(stderr, "\n");
		previno = 0x7fffffff;
		return;
	}
	if (previno == 0x7fffffff)
		goto newcalc;
	switch (prevtype) {
	case TS_BITS:
		fprintf(stderr, "Dumped inodes map header");
		break;
	case TS_CLRI:
		fprintf(stderr, "Used inodes map header");
		break;
	case TS_INODE:
		fprintf(stderr, "File header, ino %ju", (uintmax_t)previno);
		break;
	case TS_ADDR:
		fprintf(stderr, "File continuation header, ino %ju",
		    (uintmax_t)previno);
		break;
	case TS_END:
		fprintf(stderr, "End of tape header");
		break;
	}
	if (predict != blksread - 1)
		fprintf(stderr, "; predicted %ld blocks, got %ld blocks",
			predict, blksread - 1);
	fprintf(stderr, "\n");
newcalc:
	blks = 0;
	if (header->c_type != TS_END)
		for (i = 0; i < header->c_count; i++)
			if (readmapflag || header->c_addr[i] != 0)
				blks++;
	predict = blks;
	blksread = 0;
	prevtype = header->c_type;
	previno = header->c_inumber;
}
static void accthdr ( struct s_spcl * header ) { static ino_t previno = 0x7fffffff ; static int prevtype ; static long predict ; long blks , i ; if ( header -> c_type == TS_TAPE ) { fprintf ( stderr , " " ) ; if ( header -> c_firstrec ) fprintf ( stderr , " " , ( intmax_t ) header -> c_firstrec ) ; fprintf ( stderr , " \n " ) ; previno = 0x7fffffff ; return ; } if ( previno == 0x7fffffff ) goto newcalc ; switch ( prevtype ) { case TS_BITS : fprintf ( stderr , " " ) ; break ; case TS_CLRI : fprintf ( stderr , " " ) ; break ; case TS_INODE : fprintf ( stderr , " " , ( uintmax_t ) previno ) ; break ; case TS_ADDR : fprintf ( stderr , " " , ( uintmax_t ) previno ) ; break ; case TS_END : fprintf ( stderr , " " ) ; break ; } if ( predict != blksread - 1 ) fprintf ( stderr , " " , predict , blksread - 1 ) ; fprintf ( stderr , " \n " ) ; newcalc : blks = 0 ; if ( header -> c_type != TS_END ) for ( i = 0 ; i < header -> c_count ; i ++ ) if ( readmapflag || header -> c_addr [ i ] != 0 ) blks ++ ; predict = blks ; blksread = 0 ; prevtype = header -> c_type ; previno = header -> c_inumber ; }
Check that a header is where it belongs and predict the next header
Check that a header is where it belongs and predict the next header