|
|
1.1 ! root 1: #include "scsi.h" ! 2: ! 3: static ! 4: swrite(drive, block, nblock, input) ! 5: struct scsi_i *input; ! 6: { ! 7: struct scsi_o output; ! 8: ! 9: input->bus_id = scsi_id; ! 10: input->cmd[0] = 0x2A; ! 11: input->cmd[1] = drive<<5; ! 12: input->cmd[2] = block>>24; ! 13: input->cmd[3] = block>>16; ! 14: input->cmd[4] = block>>8; ! 15: input->cmd[5] = block; ! 16: input->cmd[6] = 0; ! 17: input->cmd[7] = nblock>>8; ! 18: input->cmd[8] = nblock; ! 19: input->cmd[9] = 0; ! 20: if(scsiio(input, nblock*1024, &output, 0, "write") < 0) ! 21: return(1); ! 22: if(CHECK(output)){ ! 23: prcheck(1, &output); ! 24: return(1); ! 25: } ! 26: return(0); ! 27: } ! 28: ! 29: s_write(drive, block, nblock) ! 30: { ! 31: struct scsi_o output; ! 32: struct scsi_i input; ! 33: register long *j, i; ! 34: int nb = 3; ! 35: ! 36: if((drive < 0) || (drive > 7)){ ! 37: fprint(2, "bad drive number %d\n", drive); ! 38: return(1); ! 39: } ! 40: fprint(1, "writing %d blocks [%d-%d] on drive %d: ", nblock, block, block+nblock-1, drive); ! 41: while(nblock > 0){ ! 42: if(nblock < nb) ! 43: nb = nblock; ! 44: for(j = (long *)input.data, i = nb*256-1; i >= 0; i--) ! 45: *j++ = block; ! 46: if(swrite(drive, block, nb, &input)) ! 47: return(1); ! 48: nblock -= nb; ! 49: block += nb; ! 50: } ! 51: fprint(1, "done\n"); ! 52: return(0); ! 53: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.