|
|
1.1 root 1: #include "scsi.h"
2:
3: static
4: srch(drive, blk, nblk, blank)
5: {
6: struct scsi_i input;
7: struct scsi_o output;
8: int addr;
9:
10: input.bus_id = scsi_id;
11: input.cmd[0] = blank? 0x2C:0x2D;
12: input.cmd[1] = drive<<5;
13: input.cmd[2] = blk>>24;
14: input.cmd[3] = blk>>16;
15: input.cmd[4] = blk>>8;
16: input.cmd[5] = blk;
17: input.cmd[6] = 0;
18: input.cmd[7] = 0;
19: input.cmd[8] = 0;
20: input.cmd[9] = 0;
21: if(scsiio(&input, 0, &output, 6, "?search") < 0)
22: return(-1);
23: if(CHECK(output)){
24: prcheck(1, &output);
25: return(-1);
26: }
27: if(output.data[0] != 0x80){
28: fprint(2, "%csearch error: ad %sval, class=0x%x code=0x%x\n",
29: blank?'b':'w', (output.data[0]&0x80)?"":"in",
30: (output.data[0]>>4)&7, output.data[0]&0xF);
31: return(-1);
32: }
33: addr = ULONG((&output.data[2]))-blk;
34: if(output.data[1]&0x01)
35: if(addr < nblk)
36: return(addr);
37: return(nblk);
38: }
39:
40: s_bsearch(drive, base, nblk)
41: {
42: return(srch(drive, base, nblk, 1));
43: }
44:
45: s_wsearch(drive, base, nblk)
46: {
47: return(srch(drive, base, nblk, 0));
48: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.