* [PATCH] target/core: Document target_cmd_size_check()
@ 2019-11-07 21:54 Bart Van Assche
2019-11-19 5:29 ` Martin K. Petersen
0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2019-11-07 21:54 UTC (permalink / raw)
To: target-devel
Since it is nontrivial to derive the meaning of the size argument from
the code, add a documentation header above target_cmd_size_check().
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/target/target_core_transport.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index d7d4004f83f9..ba7a01bcad7c 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1243,6 +1243,19 @@ target_check_max_data_sg_nents(struct se_cmd *cmd, struct se_device *dev,
return TCM_NO_SENSE;
}
+/**
+ * target_cmd_size_check - Check whether there will be a residual.
+ * @cmd: SCSI command.
+ * @size: Data buffer size derived from CDB. The data buffer size provided by
+ * the SCSI transport driver is available in @cmd->data_length.
+ *
+ * Compare the data buffer size from the CDB with the data buffer limit from the transport
+ * header. Set @cmd->residual_count and SCF_OVERFLOW_BIT or SCF_UNDERFLOW_BIT if necessary.
+ *
+ * Note: target drivers set @cmd->data_length by calling transport_init_se_cmd().
+ *
+ * Return: TCM_NO_SENSE
+ */
sense_reason_t
target_cmd_size_check(struct se_cmd *cmd, unsigned int size)
{
--
2.24.0.rc1.363.gb1bccd3e3d-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] target/core: Document target_cmd_size_check()
2019-11-07 21:54 [PATCH] target/core: Document target_cmd_size_check() Bart Van Assche
@ 2019-11-19 5:29 ` Martin K. Petersen
0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2019-11-19 5:29 UTC (permalink / raw)
To: target-devel
Bart,
> Since it is nontrivial to derive the meaning of the size argument from
> the code, add a documentation header above target_cmd_size_check().
Applied to 5.5/scsi-queue. Thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-19 5:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07 21:54 [PATCH] target/core: Document target_cmd_size_check() Bart Van Assche
2019-11-19 5:29 ` Martin K. Petersen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.