struct sdata { unsigned int inlen; [i] Length of data written to device unsigned int outlen; [i] Length of data read from device unsigned char cmd[x]; [i] SCSI command (6 <= x <= 16) [o] Data read from device starts here [o] On error, sense buffer starts here unsigned char wdata[y]; [i] Data written to device starts here }; |
SCSI 命令长度是通过检查给定命令的第一个字节来确定的[1] 。 无法覆盖此设置。
数据传输被限制为 PAGE_SIZE (在 i386 上为 4K,在 alpha 上为 8K)。
长度 (x + y) 必须至少为 OMAX_SB_LEN 字节长,以容纳发生错误时的 sense buffer。 sense buffer 被截断为 OMAX_SB_LEN (16) 字节,以便旧代码不会感到意外。
如果发生 Unix 错误 (例如 ENOMEM),则用户将收到负返回值,并且错误代码将在 'errno' 中。 如果 SCSI 命令成功,则返回 0。 返回的正数是压缩的 SCSI 错误代码(一个 int 中包含 4 个字节),其中最低字节是 SCSI 状态。 有关此的更多信息,请参见 drivers/scsi/scsi.h 文件。
[1] | 以下是从 SCSI 操作码“组”(操作码的最高 3 位)到假定长度的映射(在 lk 2.4.15 中)
|