129530Ssam #ifndef lint
2*32662Skarels static char sccsid[] = "@(#)exercise.c	1.3 (Berkeley/CCI) 11/23/87";
329530Ssam #endif
429530Ssam 
529530Ssam #include	"vdfmt.h"
629530Ssam 
729530Ssam #define	verbose	1
829530Ssam 
929530Ssam /*
1029530Ssam **
1129530Ssam */
1229530Ssam 
exercise()1329530Ssam exercise()
1429530Ssam {
1529530Ssam 	int		cyl, trk;
1629530Ssam 	dskadr		ead, sad;
1729530Ssam 
1829530Ssam 	print("Starting disk exercise on ");
1929530Ssam 	printf("controller %d, drive %d, ", cur.controller, cur.drive);
20*32662Skarels 	printf("type %s.\n", lab->d_typename);
2129530Ssam 
2229530Ssam 	if(read_bad_sector_map() == true) {
23*32662Skarels 		if(bad_map->bs_id != D_INFO->id) {
2429530Ssam 			print("Module serial numbers do not match!\n");
2529530Ssam 			print("Use `info' to find the real serial number.\n");
2629530Ssam 			_longjmp(abort_environ, 1);
2729530Ssam 		}
2829530Ssam 	}
2929530Ssam 	else if(is_formatted() == false) {
3029530Ssam 		print("Can not exercise unformatted drives!\n");
3129530Ssam 		_longjmp(abort_environ, 1);
3229530Ssam 	}
3329530Ssam 	print("Starting read test.\n");
3429530Ssam 	cur.state = exec;
3529530Ssam 	sad.track = sad.sector = 0;
3629530Ssam 	indent();
37*32662Skarels 	for(sad.cylinder=0; sad.cylinder<lab->d_ncylinders; sad.cylinder++) {
3829530Ssam 		print("pass %d...\n", sad.cylinder);
39*32662Skarels 		for(cyl=0; cyl<lab->d_ncylinders-NUMSYS; cyl++){
4029530Ssam 			ead.cylinder = cyl;
41*32662Skarels 			for(trk=0; trk<lab->d_ntracks; trk++) {
4229530Ssam 				ead.track = trk;
4329530Ssam 				ead.sector = 0;
4431318Ssam 				access_dsk((char *)scratch, &sad,
4531318Ssam 				    VDOP_SEEK, 1, 1);
4629530Ssam 				verify_track(&ead, 16, verbose);
4729530Ssam 				if(kill_processes == true)
4829530Ssam 					goto exit;
4929530Ssam 			}
5029530Ssam 		}
5129530Ssam 	}
5229530Ssam 	exdent(2);
5329530Ssam exit:	sync_bad_sector_map();
5429530Ssam 	printf("Exercise completed successfully.\n");
5529530Ssam }
5629530Ssam 
57