moved def of struct st to saio.h, deleted struct devdata
[unix-history] / usr / src / sys / vax / stand / drtest.c
CommitLineData
fe8b7a66 1/* drtest.c 4.2 83/01/16 */
ab600cd3
SL
2
3/*
4 * Standalone program to test a disk driver by reading
5 * every sector on the disk in chunks of CHUNK.
6 */
7extern struct hpst {
8 short nsect;
9 short ntrak;
10 short nspc;
11 short ncyl;
12 short *off;
13} hpst[] ;
14
15extern struct upst {
16 short nsect;
17 short ntrak;
18 short nspc;
19 short ncyl;
20 short *off;
21} upst[] ;
22extern struct updevice;
23extern struct hpdevice;
24extern char up_type[];
25extern char hp_type[];
26
27#define CHUNK 32
28
29main()
30{
31 char buf[50], buffer[CHUNK*512];
32 int unit,fd,chunk,j;
33 register struct upst *st;
34 register i;
35
36 printf("Testprogram for stand-alone hp or up driver\n");
37askunit:
38 printf("Enter device name (e.g, hp(0,0) ) or q to quit >");
39 gets(buf);
40 unit = (int)*(buf+3) - '0';
41 if (unit <0 || unit > 3 ) {
42 printf("unit number out of range\n");
43 goto askunit;
44 }
45 if ((fd=open(buf,0)) < 0) {
46 printf("Can't open %s \n",buf);
47 goto askunit;
48 }
49 switch(*buf) {
50
51 case 'u':
52 st = &upst[up_type[unit]];
53 break;
54
55 case 'h':
56 st = (struct upst *)&hpst[hp_type[unit]];
57 break;
58
59 default:
60 printf("Illegal device name\n");
61 goto askunit;
62 }
63
64 chunk = st->nsect;
65 printf("Testing %s\n",buf);
66 printf("Start ...Make sure %s is online\n",buf);
67 lseek(fd,0,0);
68 for (i=0;i < st->ncyl;i++) {
69 for (j=8;j<st->ntrak+8;j++) {
70 lseek(fd,(i*st->nspc+((j%st->ntrak)*st->nsect))*512,0);
71 read(fd,buffer, chunk*512);
72 }
73 printf("%d\015",i);
74 }
75 goto askunit;
76}