以下是sg驱动程序的原始接口结构,其历史可以追溯到1991年。带有“[o]+”标记的字段元素是由sg版本2驱动程序添加的,该驱动程序于1999年4月首次放入lk 2.2.6。
struct sg_header { int pack_len; /* [o] */ int reply_len; /* [i] */ int pack_id; /* [i->o] */ int result; /* [o] */ unsigned int twelve_byte:1; /* [i] */ unsigned int target_status:5; /* [o]+ */ unsigned int host_status:8; /* [o]+ */ unsigned int driver_status:8; /* [o]+ */ unsigned int other_flags:10; /* unused */ unsigned char sense_buffer[SG_MAX_SENSE]; /* [o] */ }; /* This structure is 36 bytes long on i386 */ |
此接口在 www.torque.net/sg/p/scsi-generic.txt 文件中进行了完整描述,该文件记录了 sg 版本 2 驱动程序。
由于许多 Linux 应用程序使用此接口,因此驱动程序的此版本(即版本 3)仍然支持它。只有其最反常的特性已被修改,并且没有主要的应用程序报告在较新的驱动程序之上运行旧应用程序时出现任何问题。