SCCS-vsn: sys/vax/stand/drtest.c 4.2
-/* 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 SECTSIZ 512
- char buf[50], buffer[CHUNK*512];
+ char buf[50], buffer[CHUNK*SECTSIZ];
- register struct upst *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");
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);
+ 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);