|
|
1.1 ! root 1: #include "scsi.h" ! 2: ! 3: static ! 4: myread(drive, block, o) ! 5: long block; ! 6: struct scsi_o *o; ! 7: { ! 8: struct scsi_i input; ! 9: ! 10: input.bus_id = scsi_id; ! 11: input.cmd[0] = 0x28; ! 12: input.cmd[1] = drive<<5; ! 13: input.cmd[2] = block>>24; ! 14: input.cmd[3] = block>>16; ! 15: input.cmd[4] = block>>8; ! 16: input.cmd[5] = block; ! 17: input.cmd[6] = 0; ! 18: input.cmd[7] = 0; ! 19: input.cmd[8] = 1; ! 20: input.cmd[9] = 0; ! 21: if(scsiio(&input, 0, o, 1024, "readid") < 0) ! 22: return(1); ! 23: if(CHECK(*o)) ! 24: return(1); ! 25: return(0); ! 26: } ! 27: ! 28: /* ! 29: return label, UNLABELLED or "" (error) ! 30: */ ! 31: ! 32: s_readid(drive, buf) ! 33: char *buf; ! 34: { ! 35: struct scsi_i input; ! 36: struct scsi_o output; ! 37: long b, lastb; ! 38: ! 39: buf[0] = 0; ! 40: scsi_shush = 1; ! 41: if(myread(drive, 0L, &output) == 0) ! 42: goto done; ! 43: for(b = 1, lastb = -1;;){ ! 44: if(myread(drive, b, &output)) ! 45: break; ! 46: lastb = b; ! 47: b = ((long *)output.data)[9]; ! 48: } ! 49: scsi_shush = 0; ! 50: if(lastb < 0){ ! 51: s_sense(drive, 1); ! 52: strcpy(buf, UNLABELLED); ! 53: return; ! 54: } ! 55: myread(drive, lastb, &output); ! 56: done: ! 57: strncpy(buf, (char *)&output.data[42], 128); ! 58: buf[127] = 0; ! 59: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.