1*29530Ssam #ifndef lint
2*29530Ssam static char sccsid[] = "@(#)exercise.c	1.1 (Berkeley/CCI) 07/05/86";
3*29530Ssam #endif
4*29530Ssam 
5*29530Ssam #include	"vdfmt.h"
6*29530Ssam 
7*29530Ssam #define	verbose	1
8*29530Ssam 
9*29530Ssam /*
10*29530Ssam **
11*29530Ssam */
12*29530Ssam 
13*29530Ssam exercise()
14*29530Ssam {
15*29530Ssam 	int		cyl, trk;
16*29530Ssam 	dskadr		ead, sad;
17*29530Ssam 
18*29530Ssam 	print("Starting disk exercise on ");
19*29530Ssam 	printf("controller %d, drive %d, ", cur.controller, cur.drive);
20*29530Ssam 	printf("type %s.\n",CURRENT->vc_name);
21*29530Ssam 
22*29530Ssam 	if(read_bad_sector_map() == true) {
23*29530Ssam 		if(bad_map->bs_id != D_INFO.id) {
24*29530Ssam 			print("Module serial numbers do not match!\n");
25*29530Ssam 			print("Use `info' to find the real serial number.\n");
26*29530Ssam 			_longjmp(abort_environ, 1);
27*29530Ssam 		}
28*29530Ssam 	}
29*29530Ssam 	else if(is_formatted() == false) {
30*29530Ssam 		print("Can not exercise unformatted drives!\n");
31*29530Ssam 		_longjmp(abort_environ, 1);
32*29530Ssam 	}
33*29530Ssam 	print("Starting read test.\n");
34*29530Ssam 	cur.state = exec;
35*29530Ssam 	sad.track = sad.sector = 0;
36*29530Ssam 	indent();
37*29530Ssam 	for(sad.cylinder=0; sad.cylinder<CURRENT->vc_ncyl; sad.cylinder++) {
38*29530Ssam 		print("pass %d...\n", sad.cylinder);
39*29530Ssam 		for(cyl=0; cyl<CURRENT->vc_ncyl-NUMSYS; cyl++){
40*29530Ssam 			ead.cylinder = cyl;
41*29530Ssam 			for(trk=0; trk<CURRENT->vc_ntrak; trk++) {
42*29530Ssam 				ead.track = trk;
43*29530Ssam 				ead.sector = 0;
44*29530Ssam 				access_dsk((char *)scratch, &sad, SEEK, 1, 1);
45*29530Ssam 				verify_track(&ead, 16, verbose);
46*29530Ssam 				if(kill_processes == true)
47*29530Ssam 					goto exit;
48*29530Ssam 			}
49*29530Ssam 		}
50*29530Ssam 	}
51*29530Ssam 	exdent(2);
52*29530Ssam exit:	sync_bad_sector_map();
53*29530Ssam 	printf("Exercise completed successfully.\n");
54*29530Ssam }
55*29530Ssam 
56