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