Skip to contentSkip to conversation

target/core: Document target_cmd_size_check()

PATCH Applied Bart Van Assche 2 participants 2 messages Nov 7, 2019 – Nov 19, 2019 SCSI target

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/core: Document target_cmd_size_check()

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 <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Hannes Reinecke <[email protected]>
Cc Nicholas Bellinger <[email protected]>
---
 drivers/target/target_core_transport.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/target/target_core_transport.c +13 -0
index d7d4004f83f9..ba7a01bcad7c 100644
@@ -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)
 {
Signature · 1 line
2.24.0.rc1.363.gb1bccd3e3d-goog
#1 lore raw

Bart,

Quoted 2 lines

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!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering