19973Ssam 210354Shelge #include "../h/param.h" 310354Shelge #include "../h/inode.h" 410354Shelge #include "../h/fs.h" 510354Shelge #include "saio.h" 610354Shelge 710354Shelge /* Standalone program to test a disk driver by reading every sector on 810354Shelge * the disk in chunks of CHUNK. 99973Ssam */ 109973Ssam 1110354Shelge #define CHUNK 32 1210354Shelge #define SECTSIZ 512 139973Ssam 14*10608Ssam char diskname[] = "xx(00,0)"; 15*10608Ssam 169973Ssam main() 179973Ssam { 1810354Shelge char buf[50], buffer[CHUNK*SECTSIZ]; 199973Ssam int unit,fd,chunk,j; 2010354Shelge struct st st; 219973Ssam register i; 229973Ssam 239973Ssam printf("Testprogram for stand-alone hp or up driver\n"); 249973Ssam askunit: 25*10608Ssam printf("Enter disk name [ type(adapter,unit), e.g, hp(1,3) ] > "); 269973Ssam gets(buf); 27*10608Ssam unit = (*(buf+3) - '0')*8 + *(buf+5)-'0'; 28*10608Ssam diskname[0] = *buf; 29*10608Ssam diskname[1] = *(buf+1); 30*10608Ssam diskname[3] = '0' + unit/10; 31*10608Ssam diskname[4] = '0' + unit%10; 32*10608Ssam if ((fd=open(diskname,0)) < 0) { 339973Ssam goto askunit; 349973Ssam } 3510354Shelge ioctl(fd,SAIODEVDATA,&st); 369973Ssam 3710354Shelge chunk = st.nsect*SECTSIZ; 3810354Shelge printf("Testing %s, chunk size is %d\n",buf, chunk); 399973Ssam printf("Start ...Make sure %s is online\n",buf); 409973Ssam lseek(fd,0,0); 4110354Shelge for (i=0;i < st.ncyl*st.ntrak; i++) { 4210354Shelge /* for (j=8;j<st.ntrak+8;j++) { 4310354Shelge lseek(fd,(i*st.nspc+((j%st.ntrak)*st.nsect))*SECTSIZ,0); 4410354Shelge */ 4510354Shelge read(fd,buffer, chunk); 4610354Shelge /* } */ 4710354Shelge if (i%st.ntrak == 0) printf("%d\r",i/st.ntrak); 489973Ssam } 499973Ssam goto askunit; 509973Ssam } 51