From: Nicholas Bellinger <nab at linux-iscsi.org> This patch adds struct scsi_cmd->cmd_sg_iovec usage for bs_sg and updates bs_sg_cmd_submit() to set iovec base and len using STGT macros and set pointer assignment to io_hdr.dxferp. Signed-off-by: Nicholas A. Bellinger <nab at linux-iscsi.org> --- usr/bs_sg.c | 10 ++++++++-- usr/scsi_cmnd.h | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/usr/bs_sg.c b/usr/bs_sg.c index f01a3ef..bb03d46 100644 --- a/usr/bs_sg.c +++ b/usr/bs_sg.c @@ -132,11 +132,17 @@ static int bs_sg_cmd_submit(struct scsi_cmd *cmd) if (scsi_get_data_dir(cmd) == DATA_WRITE) { io_hdr.dxfer_direction = SG_DXFER_TO_DEV; io_hdr.dxfer_len = scsi_get_out_length(cmd); - io_hdr.dxferp = (void *)scsi_get_out_buffer(cmd); + cmd->cmd_sg_iovec.iov_len = scsi_get_out_length(cmd); + cmd->cmd_sg_iovec.iov_base = scsi_get_out_buffer(cmd); + io_hdr.dxferp = &cmd->cmd_sg_iovec; + io_hdr.iovec_count = 1; } else { io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; io_hdr.dxfer_len = scsi_get_in_length(cmd); - io_hdr.dxferp = (void *)scsi_get_in_buffer(cmd); + cmd->cmd_sg_iovec.iov_len = scsi_get_in_length(cmd); + cmd->cmd_sg_iovec.iov_base = scsi_get_in_buffer(cmd); + io_hdr.dxferp = &cmd->cmd_sg_iovec; + io_hdr.iovec_count = 1; } io_hdr.mx_sb_len = sizeof(cmd->sense_buffer); io_hdr.sbp = cmd->sense_buffer; diff --git a/usr/scsi_cmnd.h b/usr/scsi_cmnd.h index 011f3e6..fc4861a 100644 --- a/usr/scsi_cmnd.h +++ b/usr/scsi_cmnd.h @@ -17,6 +17,8 @@ struct scsi_data_buffer { uint64_t buffer; }; +#include <scsi/sg.h> + struct scsi_cmd { struct target *c_target; /* linked it_nexus->cmd_hash_list */ @@ -31,6 +33,8 @@ struct scsi_cmd { enum data_direction data_dir; struct scsi_data_buffer in_sdb; struct scsi_data_buffer out_sdb; + /* Used for bs_sg.c:bs_bs_cmd_submit() */ + struct sg_iovec cmd_sg_iovec; uint64_t cmd_itn_id; uint64_t offset; -- 1.5.6.5 -- To unsubscribe from this list: send the line "unsubscribe stgt" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html |