Annotation of researchv10dc/cmd/worm/scsi/generic/readt.c, revision 1.1.1.1

1.1       root        1: #include       <stdio.h>
                      2: #include       "../scsi.h"
                      3: #include       "../scsish.h"
                      4: #include       "../tcl.h"
                      5: #include       "fns.h"
                      6: 
                      7: int
                      8: gen_readt(ClientData cd, Tcl_Interp *it, int argc, char **argv)
                      9: {
                     10:        struct scsi_cmd cmd;
                     11:        struct scsi_return ret;
                     12:        int unit, i;
                     13:        unsigned long ns, ss;
                     14:        long bs, addr;
                     15:        long t1, t2;
                     16:        int count;
                     17: 
                     18:        if(argc < 3)
                     19:                USAGE_RETURN
                     20:        addr = atol(argv[1]);
                     21:        count = atol(argv[2]);
                     22:        unit = (argc >= 3)? atoi(argv[3]):0;
                     23:        set10(cmd, 0x25, unit<<5, 0, 0, 0, 0, 0, 0, 0, 0);
                     24:        if(s_io(0, &cmd, 0, &ret, 8, cd->err))
                     25:                ERR_RETURN
                     26:        ns = longat(&ret.data[0]);
                     27:        ss = longat(&ret.data[4]);
                     28:        bs = ss? sizeof(ret.data)/ss : 1;
                     29:        time(&t1);
                     30:        srand(t1);
                     31:        printf("read(%d,%d): %d blocks @%d (bs=%dB, %d sectors),", s_id, unit, count, addr, bs*ss, bs);
                     32:        fflush(stdout);
                     33:        time(&t1);
                     34:        for(i = count; i > 0; i -= bs){
                     35:                set10(cmd, 0x28, unit<<5, addr>>24, addr>>16, addr>>8, addr,
                     36:                        0, 0, bs*0, 0);
                     37:                if(s_io(0, &cmd, 0, &ret, bs*ss, cd->err))
                     38:                        ERR_RETURN
                     39:                addr += bs;
                     40:        }
                     41:        time(&t2);
                     42:        printf(" t=%ds (%.0fKB/s)\n", t2-t1, (count*(float)ss/1024.)/((t1 == t2)? 1:t2-t1));
                     43:        return(0);
                     44: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.