more ioctl's & some bug fixes
authorHelge Skrivervik <helge@ucbvax.Berkeley.EDU>
Tue, 18 Jan 1983 02:53:20 +0000 (18:53 -0800)
committerHelge Skrivervik <helge@ucbvax.Berkeley.EDU>
Tue, 18 Jan 1983 02:53:20 +0000 (18:53 -0800)
SCCS-vsn: sys/vax/stand/drtest.c 4.2

usr/src/sys/vax/stand/drtest.c

index 5e6c0f4..2ce3d2c 100644 (file)
@@ -1,36 +1,21 @@
-/*     drtest.c        4.2     83/01/16        */
 
 
-/*
- * Standalone program to test a disk driver by reading
- * every sector on the disk in chunks of CHUNK.
- */
-extern struct hpst  {
-       short nsect;
-       short ntrak;
-       short nspc;
-       short ncyl;
-       short *off;
-} hpst[] ;
+#include "../h/param.h"
+#include "../h/inode.h"
+#include "../h/fs.h"
+#include "saio.h"
 
 
-extern struct upst  {
-       short nsect;
-       short ntrak;
-       short nspc;
-       short ncyl;
-       short *off;
-} upst[] ;
-extern struct updevice;
-extern struct hpdevice;
-extern char up_type[];
-extern char hp_type[];
+/* Standalone program to test a disk driver by reading every sector on
+ * the disk in chunks of CHUNK.
+ */
 
 
-#define CHUNK 32
+#define CHUNK  32
+#define SECTSIZ        512
 
 main()
 {
 
 main()
 {
-       char buf[50], buffer[CHUNK*512];
+       char buf[50], buffer[CHUNK*SECTSIZ];
        int unit,fd,chunk,j;
        int unit,fd,chunk,j;
-       register struct upst *st;
+       struct st st;
        register i;
 
        printf("Testprogram for stand-alone hp or up driver\n");
        register i;
 
        printf("Testprogram for stand-alone hp or up driver\n");
@@ -43,34 +28,22 @@ askunit:
                goto askunit;
        }
        if ((fd=open(buf,0)) < 0) {
                goto askunit;
        }
        if ((fd=open(buf,0)) < 0) {
-               printf("Can't open %s \n",buf);
-               goto askunit;
-       }
-       switch(*buf) {
-
-       case 'u':
-               st = &upst[up_type[unit]];
-               break;
-
-       case 'h':
-               st = (struct upst *)&hpst[hp_type[unit]];
-               break;
-
-       default:
-               printf("Illegal device name\n");
+            printf("Can't open %s \n",buf);
                goto askunit;
        }
                goto askunit;
        }
+       ioctl(fd,SAIODEVDATA,&st);
 
 
-       chunk = st->nsect;
-       printf("Testing %s\n",buf);
+       chunk = st.nsect*SECTSIZ;
+       printf("Testing %s, chunk size is %d\n",buf, chunk);
        printf("Start ...Make sure %s is online\n",buf);
        lseek(fd,0,0);
        printf("Start ...Make sure %s is online\n",buf);
        lseek(fd,0,0);
-       for (i=0;i < st->ncyl;i++) {
-               for (j=8;j<st->ntrak+8;j++) {
-                       lseek(fd,(i*st->nspc+((j%st->ntrak)*st->nsect))*512,0);
-                       read(fd,buffer, chunk*512);
-               }
-               printf("%d\015",i);
+       for (i=0;i < st.ncyl*st.ntrak; i++) {
+/*             for (j=8;j<st.ntrak+8;j++) {
+                       lseek(fd,(i*st.nspc+((j%st.ntrak)*st.nsect))*SECTSIZ,0);
+*/
+                       read(fd,buffer, chunk);
+/*             }                                       */
+               if (i%st.ntrak == 0) printf("%d\r",i/st.ntrak);
        }
        goto askunit;
 }
        }
        goto askunit;
 }