This indicates that the operation in question is a read operation. i.e., data is being read from the SCSI device to the user-supplied buffer.
This indicates that the operation is a write operation. i.e., data is being written from the user-supplied buffer to the device.
This indicates that there is no data to be transferred for this command.
This flag disables device queue freezing as an error recovery mechanism.
This flag tells the pass(4) driver to enable error recovery. The default is to not perform error recovery, which means that the retry count will not be honored without this flag, among other things.
This indicates that the address contained in data_ptr is a physical address, not a virtual address.
The retry_count tells the kernel how many times to retry the command in question. The retry count is ignored unless the pass(4) driver is told to enable error recovery via the CAM_PASS_ERR_RECOVER flag.
The timeout tells the kernel how long to wait for the given command to complete. If the timeout expires and the command has not completed, the CCB will be returned from the kernel with an appropriate error status.
cmd_spec is a CDB format specifier used to build up the SCSI CDB. This text string is made up of a list of field specifiers. Field specifiers specify the value for each CDB field (including indicating that the value be taken from the next argument in the variable argument list), the width of the field in bits or bytes, and an optional name. White space is ignored, and the pound sign (#) introduces a comment that ends at the end of the current line.
The optional name is the first part of a field specifier and is in curly braces. The text in curly braces in this example are the names:
This field specifier has two one bit fields and one six bit field. The second one bit field is the constant value 0 and the first one bit field and the six bit field are taken from the variable argument list. Multi byte fields are swapped into the SCSI byte order in the CDB and white space is ignored.
When the field is a hex value or the letter v, (e.g., "1A" or "v") then a single byte value is copied to the next unused byte of the CDB. When the letter v is used the next integer argument is taken from the variable argument list and that value used.
A constant hex value followed by a field width specifier or the letter v followed by a field width specifier (e.g., 3:4, 3:b4, 3:i3, v:i3) specifies a field of a given bit or byte width. Either the constant value or (for the V specifier) the next integer value from the variable argument list is copied to the next unused bits or bytes of the CDB.
A decimal number or the letter b followed by a decimal number field width indicates a bit field of that width. The bit fields are packed as tightly as possible beginning with the high bit (so that it reads the same as the SCSI spec), and a new byte of the CDB is started whenever a byte fills completely or when an i field is encountered.
A field width specifier consisting of the letter i followed by either 1, 2, 3 or 4 indicates a 1, 2, 3 or 4 byte integral value that must be swapped into SCSI byte order (MSB first).
For the v field specifier the next integer argument is taken from the variable argument list and that value is used swapped into SCSI byte order.
csio_build_visit operates similarly to csio_build, except that the values to substitute for variable arguments in cmd_spec are retrieved via the arg_get function passed in to csio_build_visit instead of via stdarg(3). The arg_get function takes two arguments:
is passed into the arg_get function at each invocation. This enables the arg_get function to keep some state in between calls without using global or static variables.
is the field name supplied in fmt, if any.
csio_decode is used to decode information from the data in phase of the SCSI transfer.
The decoding is similar to the command specifier processing of csio_build except that the data is extracted from the data pointed to by csio->data_ptr. The stdarg list should be pointers to integers instead of integer values. A seek field type and a suppression modifier are added. The * suppression modifier (e.g., *i3 or *b4) suppresses assignment from the field and can be used to skip over bytes or bits in the data, without having to copy them to a dummy variable in the arg list.
The seek field type s permits you to skip over data. This seeks to an absolute position (s3) or a relative position (s+3) in the data, based on whether or not the presence of the + sign. The seek value can be specified as v and the next integer value from the argument list will be used as the seek value.
csio_decode_visit operates like csio_decode except that instead of placing the decoded contents of the buffer in variadic arguments, the decoded buffer contents are returned to the user via the arg_put function that is passed in. The arg_put function takes several arguments:
The "hook" is a mechanism to allow the arg_put function to save state in between calls.
is the letter describing the format of the argument being passed into the function.
is a void pointer to the value being passed into the function.
is the size of the value being passed into the arg_put function. The argument format determines the unit of measure.
This is a text description of the field, if one was provided in the fmt.
buff_decode decodes an arbitrary data buffer using the method described above for csio_decode.
buff_decode_visit decodes an arbitrary data buffer using the method described above for csio_decode_visit.
csio_encode encodes the data_ptr portion (not the CDB!) of a ccb_scsiio structure, using the method described above for csio_build.
csio_encode_visit encodes the data_ptr portion (not the CDB!) of a ccb_scsiio structure, using the method described above for csio_build_visit.
buff_encode_visit encodes an arbitrary data pointer, using the method described above for csio_build_visit.