xref: /csrg-svn/sys/vax/stand/drtest.c (revision 10727)
1 /*	drtest.c	4.7	83/02/04	*/
2 
3 #include "../h/param.h"
4 #include "../h/inode.h"
5 #include "../h/fs.h"
6 #include "saio.h"
7 
8 /* Standalone program to test a disk driver by reading every sector on
9  * the disk in chunks of CHUNK.
10  */
11 
12 #define CHUNK	32
13 #define SECTSIZ	512
14 
15 char diskname[] = "xx(00,0)";
16 
17 main()
18 {
19 	char buf[50], buffer[CHUNK*SECTSIZ];
20 	int unit,fd,chunk,j;
21 	struct st st;
22 	register i;
23 
24 	printf("Testprogram for stand-alone hp or up driver\n\n");
25 askunit:
26 	printf("Enter disk name [ type(adapter,unit), e.g, hp(1,3) ] > ");
27 	gets(buf);
28 	unit = (*(buf+3) - '0')*8 + *(buf+5)-'0';
29 	diskname[0] = *buf;
30 	diskname[1] = *(buf+1);
31 	diskname[3] = '0' + unit/10;
32 	diskname[4] = '0' + unit%10;
33 	if ((fd=open(diskname,0)) < 0) {
34 		goto askunit;
35 	}
36 	ioctl(fd,SAIODEVDATA,&st);
37 	printf("Device data: #cylinders=%d, #tracks=%d, #sectors=%d\n",
38 		st.ncyl, st.ntrak, st.nsect);
39 	chunk = st.nsect*SECTSIZ;
40 	printf("Testing %s, chunk size is %d bytes\n",buf, chunk);
41 	printf("Start ...Make sure %s is online\n",buf);
42 	lseek(fd,0,0);
43 	for (i=0;i < st.ncyl*st.ntrak; i++) {
44 /*		for (j=8;j<st.ntrak+8;j++) {
45 			lseek(fd,(i*st.nspc+((j%st.ntrak)*st.nsect))*SECTSIZ,0);
46 */
47 			read(fd,buffer, chunk);
48 /*		}					*/
49 		if (i%(st.ntrak*5) == 0) printf("%d\r",i/st.ntrak);
50 	}
51 	goto askunit;
52 }
53