On Thu, Mar 23, 2006 at 12:01:48AM +0000, Alistair G. Crooks wrote: > > Module Name: src > Committed By: agc > Date: Thu Mar 23 00:01:48 UTC 2006 > > Modified Files: > src/dist/iscsi/include: scsi_cmd_codes.h > src/dist/iscsi/src: disk.c > > Log Message: > First stab at implementing INQUIRY for Vital Product Data, aka Page 83 > information in the Solaris initiator, with information taken from > SPC3, T10/1416-D Revision 23, from www.t10.org. > > This is untested, work-in-progress. This change isn't fully correct (which I expect you knew :-) The concept behind the "done" variable is wrong. If you see the VPD bit is set, you should NEVER send back non-VPD data. For readability, I recommend folding the inquiry code into its own file. So the default: code in the switch(cdb[2]) block also needs changing. As per SPC2 (7.3.4) and SPC3 (6.4.4), if the VPD info isn't known about, you are supposed to terminate the task with CHECK CONDITION status, with the sense key set to ILLEGAL REQUEST and ASC/Q INVALID FIELD IN CDB. strlcpy() aren't correct for inquiry data. They NUL-terminate the string, while the vendor, product, and are fixed-length, space-filled strings. Also, the product revision field is only 4 characters. The VPD info isn't right, either. The INQUIRY_DEVICE_ISCSI_PROTOCOL use needs the PIV bit set. I recommend factoring the VPD identifier info into: a) build outer frame, b) shove VPD identifiers into it. The number of identifiers will grow over time (you already are supposed to really have almost the same identifier for the LU too; you should have something for INQUIRY_DEVICE_ASSOCIATION_TARGET_LU). If you haven't already, I recommend registering "NetBSD" as a SCSI vendor. It's free, you just send an EMail to some address at t10. Take care, Bill
Attachment:
pgp7HLRgBCml1.pgp
Description: PGP signature