Message ID | 1583857550-12049-7-git-send-email-john.garry@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | scsi: enable reserved commands for LLDDs | expand |
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 82a4499539b3..c73280b3706d 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -153,6 +153,16 @@ static inline void *scsi_cmd_priv(struct scsi_cmnd *cmd) return cmd + 1; } +/* + * Return the scsi_cmnd structure located before the driver + * private allocation. Only works if cmd_size is set in the + * host template. + */ +static inline struct scsi_cmnd *scsi_cmd_from_priv(void *priv) +{ + return priv - sizeof(struct scsi_cmnd); +} + /* make sure not to use it with passthrough commands */ static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd) {