Re: [PATCH v3 01/15] scsi: Add struct for args to execution functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14/12/2022 23:49, Mike Christie wrote:
This begins to move the SCSI execution functions to use a struct for
passing in optional args. This patch adds the new struct, temporarily
converts scsi_execute and scsi_execute_req ands a new helper,
scsi_execute_cmd, which takes the scsi_exec_args struct.

There should be no change in behavior. We no longer alilow users to pass
in any request->rq_flags valu, but they were only passing in RQF_QUIET
which we do support by allowing users to pass in the BLK_MQ_REQ flags used
by blk_mq_alloc_request.

The next patches will convert scsi_execute and scsi_execute_req users to
the new helpers then remove scsi_execute and scsi_execute_req.

Signed-off-by: Mike Christie<michael.christie@xxxxxxxxxx>

Reviewed-by: John Garry <john.g.garry@xxxxxxxxxx>

---
  drivers/scsi/scsi_lib.c    | 52 ++++++++++++++++++--------------------
  include/scsi/scsi_device.h | 51 +++++++++++++++++++++++++++----------
  2 files changed, 62 insertions(+), 41 deletions(-)

...

- req = scsi_alloc_request(sdev->request_queue,
-			data_direction == DMA_TO_DEVICE ?
-			REQ_OP_DRV_OUT : REQ_OP_DRV_IN,
-			rq_flags & RQF_PM ? BLK_MQ_REQ_PM : 0);
+	if (!args)
+		args = &default_args;
+	else if (WARN_ON_ONCE(args->sense &&
+			      args->sense_len != SCSI_SENSE_BUFFERSIZE))

As mentioned elsewhere, this size check is not fool proof as it does rely on the caller to set sense_len to what really is the size of the memory pointed to by args->sense. Better than nothing, I suppose.

+		return -EINVAL;
+




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux