19973Ssam 2*10354Shelge #include "../h/param.h" 3*10354Shelge #include "../h/inode.h" 4*10354Shelge #include "../h/fs.h" 5*10354Shelge #include "saio.h" 6*10354Shelge 7*10354Shelge /* Standalone program to test a disk driver by reading every sector on 8*10354Shelge * the disk in chunks of CHUNK. 99973Ssam */ 109973Ssam 11*10354Shelge #define CHUNK 32 12*10354Shelge #define SECTSIZ 512 139973Ssam 149973Ssam main() 159973Ssam { 16*10354Shelge char buf[50], buffer[CHUNK*SECTSIZ]; 179973Ssam int unit,fd,chunk,j; 18*10354Shelge struct st st; 199973Ssam register i; 209973Ssam 219973Ssam printf("Testprogram for stand-alone hp or up driver\n"); 229973Ssam askunit: 239973Ssam printf("Enter device name (e.g, hp(0,0) ) or q to quit >"); 249973Ssam gets(buf); 259973Ssam unit = (int)*(buf+3) - '0'; 269973Ssam if (unit <0 || unit > 3 ) { 279973Ssam printf("unit number out of range\n"); 289973Ssam goto askunit; 299973Ssam } 309973Ssam if ((fd=open(buf,0)) < 0) { 31*10354Shelge printf("Can't open %s \n",buf); 329973Ssam goto askunit; 339973Ssam } 34*10354Shelge ioctl(fd,SAIODEVDATA,&st); 359973Ssam 36*10354Shelge chunk = st.nsect*SECTSIZ; 37*10354Shelge printf("Testing %s, chunk size is %d\n",buf, chunk); 389973Ssam printf("Start ...Make sure %s is online\n",buf); 399973Ssam lseek(fd,0,0); 40*10354Shelge for (i=0;i < st.ncyl*st.ntrak; i++) { 41*10354Shelge /* for (j=8;j<st.ntrak+8;j++) { 42*10354Shelge lseek(fd,(i*st.nspc+((j%st.ntrak)*st.nsect))*SECTSIZ,0); 43*10354Shelge */ 44*10354Shelge read(fd,buffer, chunk); 45*10354Shelge /* } */ 46*10354Shelge if (i%st.ntrak == 0) printf("%d\r",i/st.ntrak); 479973Ssam } 489973Ssam goto askunit; 499973Ssam } 50