scsi_data_t Structure

The scsi_data_t structure is a DATA IN/OUT buffer.

typedef struct scsi_data {
                size_t   data_size;     /* DATA IN/OUT buffer size */
                uint8_t  *data_ptr;     /* DATA IN/OUT buffer */
                int      data_mapped;   /* data_ptr is kernel mapped, boolean */
                buf_t    *data_buf;     /* pointer to buf(9S), internal */
} scsi_data_t;

The data_ptr member points to a DATA IN/OUT payload associated with some SCSI commands such as INQUIRY, READ, WRITE, and REPORT LUNS. You can read the data from the data_ptr only when data_mapped is set to 1.

While using the scsi:::cmd-request probe, the data_ptr is not set in the following conditions:

  • When buf(9S) is sent with the B_PAGEIO flag or the B_MVECTOR flag in b_flags.

  • If the data buffer is not mapped to a kernel virtual address space.

You can overcome this condition by using the scsi:::cmd-request-mapin probe. This probe behaves like cmd-request and also executes the bp_mapin() function, which sets the data_mapped flag to 1. You can then access the data buffer from the kernel memory by using data_ptr.

Caution:

The cmd-request-mapin probe might have significant performance impact.

The cmd-request-mapin probe also ensures that the same data buffer is accessible during the cmd-response probe.

For more information, see the buf(9S) and bp_mapin(9F) man pages.