diff options
author | Christoph Hellwig <hch@infradead.org> | 2011-10-12 11:09:12 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-10-24 03:21:13 +0000 |
commit | 485fd0d1e3b8010b538bd0b209f3592acc825677 (patch) | |
tree | a13b8785b9b24fcec032b9f28fd06597edae7256 /drivers/target/target_core_cdb.c | |
parent | 6193f06e6fe27c9475e407cb3cf2b0d4cd2725b0 (diff) | |
download | talos-op-linux-485fd0d1e3b8010b538bd0b209f3592acc825677.tar.gz talos-op-linux-485fd0d1e3b8010b538bd0b209f3592acc825677.zip |
target: replace ->get_cdb with a target_get_task_cdb helper
Instead of calling out to the backends from the core to get a per-task
CDB and then modify it for the LBA/len pair used for this CDB provide
a helper that writes the adjusted CDB into a provided buffer and call
this method from ->do_task in pscsi.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_cdb.c')
-rw-r--r-- | drivers/target/target_core_cdb.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c index 0d02391d1fb1..fb0b6308038b 100644 --- a/drivers/target/target_core_cdb.c +++ b/drivers/target/target_core_cdb.c @@ -1265,3 +1265,19 @@ transport_emulate_control_cdb(struct se_task *task) return PYX_TRANSPORT_SENT_TO_TRANSPORT; } + +/* + * Write a CDB into @cdb that is based on the one the intiator sent us, + * but updated to only cover the sectors that the current task handles. + */ +void target_get_task_cdb(struct se_task *task, unsigned char *cdb) +{ + struct se_cmd *cmd = task->task_se_cmd; + + memcpy(cdb, cmd->t_task_cdb, scsi_command_size(cmd->t_task_cdb)); + if (cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB) { + cmd->transport_split_cdb(task->task_lba, task->task_sectors, + cdb); + } +} +EXPORT_SYMBOL(target_get_task_cdb); |