B.5. sg 变更

主要的变更在于添加了一个新的接口结构,名为 "sg_io_hdr"。 现有的接口结构 (称为 "sg_header") 被发现不够灵活,需要在 read() 和 write() 命令中将原始数据与元数据连接在一起。

sg_io_hdr          {new interface structure}
SG_IO              {new ioctl}
direct IO          {present but commented out, see ALLOW_DIO}
procfs output      {new information in /proc/scsi/sg directory}
boot/module parameters  {new}

通过 sg_io_hdr 接口结构,最多可以获取 64 字节的 sense 数据。 此外,还可以获得与数据传输相关的剩余计数(如果底层驱动程序支持,否则剩余计数将为 0)。