The arguments are as follows:int inquiry12(struct dsreq *dsp, caddr_t data, long datalen, int vu);
dsp | The address of a dsreq structure prepared by dsopen(). |
data | The address of a buffer to receive the inquiry response. |
datalen | The length of the buffer, at least 36 and typically 64. |
vu | The least-significant two bits are used to set the vendor-specific bits in the Control byte in the command. |
The arguments are as follows:int modeselect15(struct dsreq *dsp, caddr_t data, long datalen, int save, int vu);
dsp | The address of a dsreq structure prepared by dsopen(). |
data | The address of a mode data page to send. |
datalen | The length of the data. |
save | The least significant bit sets the SP bit in the command. |
vu | The least-significant two bits are used to set the vendor-specific bits in the Control byte in the command. |
The arguments are as follows:int modesense1a(struct dsreq *dsp, caddr_t data, long datalen, int pagectrl, int pagecode, int vu);
dsp | The address of a dsreq structure prepared by dsopen(). |
data | The address of a buffer to receive the page of data. |
datalen | The length of the buffer. |
pagectrl | The least significant 2 bits are set as the PCF bits in the command. |
pagecode | The least significant 6 bits are set as the page number. |
vu | The least-significant two bits are used to set the vendor-specific bits in the Control byte in the command. |
For reference, the PCF codes are as follows:
0 | Current values. |
1 | Changeable values. |
2 | Default values. |
3 | Saved values. |
For reference, some page numbers are as follows:
0 | Vendor unique. |
1 | Read/write error recovery. |
2 | Disconnect/reconnect. |
3 | Direct access device format; parallel interface; measurement units. |
4 | Rigid disk geometry; serial interface. |
5 | Flexible disk; printer options. |
6 | Optical memory. |
7 | Verification error. |
8 | Caching. |
9 | Peripheral device. |
63 (0x3f) | Return all pages supported. |
The function prototypes are
int read08(struct dsreq *dsp, caddr_t data, long datalen, long lba, int vu); int readextended28(struct dsreq *dsp, caddr_t data, long datalen, long lba, int vu);The arguments are as follows:
dsp | The address of a dsreq structure prepared by dsopen(). |
data | The address of a buffer to receive the data. |
datalen | The length of the buffer (not exceeding 255 for read08) |
lba | The logical block address for the start of the read (not exceeding 16 bits for read08) |
vu | The least-significant two bits are used to set the vendor-specific bits in the Control byte in the command. |
The functions set the transfer length in the command to the number of bytes given by datalen. This is often incorrect; many devices want a number of blocks of some size. Function read08() sets only 16 bits from lba as the logical block number, although the SCSI command format permits another 5 bits to be encoded in the command. For these and other reasons you are likely to need to create customized Read functions of your own.
The arguments are as follows:int readcapacity25(struct dsreq *dsp, caddr_t data, long datalen, long lba, int pmi, int vu);
dsp | The address of a dsreq structure prepared by dsopen(). |
data | The address of a buffer to receive the capacity data. |
datalen | The length of the buffer, typically 8. |
lba | Last block address, 0 unless pmi is nonzero. |
pmi | The least-significant bit is used to set the partial medium indicator (PMI) bit of the command. |
vu | The least-significant two bits are used to set the vendor-specific bits in the Control byte in the command. |
When pmi is 0, lba should be given as 0 and the command returns the device capacity. When pmi is 1, the command returns the last block following block lba before which a delay (seek) will occur.
The arguments are:int requestsense03(struct dsreq *dsp, caddr_t data, long datalen, int vu);
dsp | The address of a dsreq structure prepared by dsopen(). |
data | The address of a buffer to receive the sense data. |
datalen | The length of the buffer. |
vu | The least-significant two bits are used to set the vendor-specific bits in the Control byte in the command. |
int reservunit16(struct dsreq *dsp, caddr_t data, long datalen, int tpr, int tpdid, int extent, int res_id, int vu); int releaseunit17(struct dsreq *dsp, int tpr, int tpdid, int extent, int res_id, int vu);The arguments are as follows:
dsp | The address of a dsreq structure prepared by dsopen(). |
data | The address of data to send with the Reserve Unit. (This may be NULL for reservunit16() which does not normally transfer data.) |
datalen | The length of the data (typically 0). |
tpr | The least-significant bit is used to set the Third-Party Reservation bit in the command: 1 means the reservation is on behalf of another initiator. |
tpdid | The device ID for the device to hold the reservation: 0 unless tpr is 1. |
extent | The least-significant bit sets the least-significant bit of byte 1 of the command string. |
res_id | Passed as byte 2 of the command string. |
vu | The least-significant two bits are used to set the vendor-specific bits in the Control byte in the command. |
int senddiagnostic1d(struct dsreq *dsp, caddr_t data, long datalen, int self, int dofl, int uofl, int vu);
The arguments are as follows:
dsp | The address of a dsreq structure prepared by dsopen(). |
data | The address of a page or pages of diagnostic parameter data to be sent. |
datalen | The length of the data (0 if none). |
self | The least-significant bit sets the Self Test (ST) bit in the command: 1 means return status from the self-test; 0 means hold the results. |
dofl | The least-significant bit sets the Device Offline bit of the command: 1 authorizes tests that can change the status of other logical units. |
uofl | The least-significant bit sets the Unit Offline bit of the command: 1 authorizes tests that can change the status of the logical unit. |
vu | The least-significant two bits are used to set the vendor-specific bits in the Control byte in the command. |
When self is 1, the status reflects the success of the self-test. You should either set the DSRQ_SENSE flag in the dsreq so that if the self-test fails, a Sense command will be issued, or be prepared to call requestsense03(). When self is 0, you can use a Read Diagnostic command to return detailed results of the test (however, dslib does not contain a predefined function for Read Diagnostic).
This function is reproduced here in Example 5-2 as an example of how other command-oriented functions can be created.int testunitready00(struct dsreq *dsp);
Example 5-2 : Code of the testunitread00() Function
int testunitready00(struct dsreq *dsp) { fillg0cmd(dsp, CMDBUF(dsp), G0_TEST, 0, 0, 0, 0, 0); filldsreq(dsp, 0, 0, DSRQ_READ|DSRQ_SENSE); return(doscsireq(getfd(dsp), dsp)); }
The function prototypes are
int write0a(struct dsreq *dsp, caddr_t data, long datalen, long lba, int vu); int writeextended2a(struct dsreq *dsp, caddr_t data, long datalen, long lba, int vu);The arguments are as follows:
dsp | The address of a dsreq structure prepared by dsopen(). |
data | The address of the data to be sent. |
datalen | The length of the data (at most 255 for write0a) |
lba | The logical block address (at most 16 bits for write0a) |
vu | The least-significant two bits are used to set the vendor-specific bits in the Control byte in the command. |