Annotation of researchv10dc/cmd/oworm/oscsi/capacity.c, revision 1.1

1.1     ! root        1: #include       "scsi.h"
        !             2: 
        !             3: s_capacity(drive, nb, bl)
        !             4:        long *nb, *bl;
        !             5: {
        !             6:        struct scsi_i input;
        !             7:        struct scsi_o output;
        !             8:        long c, l;
        !             9: 
        !            10:        input.bus_id = 1<<scsi_id;
        !            11:        input.cmd[0] = 0x25;
        !            12:        input.cmd[1] = drive<<5;
        !            13:        input.cmd[2] = 0;
        !            14:        input.cmd[3] = 0;
        !            15:        input.cmd[4] = 0;
        !            16:        input.cmd[5] = 0;
        !            17:        input.cmd[6] = 0;
        !            18:        input.cmd[7] = 0;
        !            19:        input.cmd[8] = 0;
        !            20:        input.cmd[9] = 0;
        !            21:        if(scsiio(&input, &output, 8, "capacity") < 0)
        !            22:                return(1);
        !            23:        if(CHECK(output)){
        !            24:                scsidump(&output);
        !            25:                return(1);
        !            26:        } else {
        !            27:                c = ULONG((&output.data[0]));
        !            28:                l = ULONG((&output.data[4]));
        !            29:                if(V)
        !            30:                        Fprint(1, "drive %d: capacity %dx%d (%uxx%ux)\n", drive,
        !            31:                                c, l, c, l);
        !            32:                if(bl) *bl = l;
        !            33:                if(nb) *nb = c;
        !            34:                return(0);
        !            35:        }
        !            36: }

unix.superglobalmegacorp.com

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