Re: [PATCH v6 03/35] scsi: Add struct for args to execution functions

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

 



On Fri, Nov 04, 2022 at 06:18:55PM -0500, Mike Christie wrote:
> This begins to move the SCSI execution functions to use a struct for
> passing in args. This patch adds the new struct, converts the low level
> helpers and then adds a new helper the next patches will convert the rest
> of the code to.
> 
> Signed-off-by: Mike Christie <michael.christie@xxxxxxxxxx>
> Reviewed-by: Martin Wilck <mwilck@xxxxxxxx>
> Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>
> ---
>  drivers/scsi/scsi_lib.c    | 69 +++++++++++++++-----------------------
>  include/scsi/scsi_device.h | 69 ++++++++++++++++++++++++++++++--------
>  2 files changed, 82 insertions(+), 56 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index fc1560981a03..f832befb50b0 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -185,55 +185,39 @@ void scsi_queue_insert(struct scsi_cmnd *cmd, int reason)
>  	__scsi_queue_insert(cmd, reason, true);
>  }
>  
> -
>  /**
> - * __scsi_execute - insert request and wait for the result
> - * @sdev:	scsi device
> - * @cmd:	scsi command
> - * @data_direction: data direction
> - * @buffer:	data buffer
> - * @bufflen:	len of buffer
> - * @sense:	optional sense buffer
> - * @sshdr:	optional decoded sense header
> - * @timeout:	request timeout in HZ
> - * @retries:	number of times to retry request
> - * @flags:	flags for ->cmd_flags
> - * @rq_flags:	flags for ->rq_flags
> - * @resid:	optional residual length
> + * __scsi_exec_req - insert request and wait for the result
> + * @scsi_exec_args: See struct definition for description of each field
>   *
>   * Returns the scsi_cmnd result field if a command was executed, or a negative
>   * Linux error code if we didn't get that far.
>   */
> -int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
> -		 int data_direction, void *buffer, unsigned bufflen,
> -		 unsigned char *sense, struct scsi_sense_hdr *sshdr,
> -		 int timeout, int retries, blk_opf_t flags,
> -		 req_flags_t rq_flags, int *resid)
> +int __scsi_exec_req(const struct scsi_exec_args *args)

I find the struct for everyhing a somewhat confusing calling convention.
So I'd pass the required arguments directly, and stuff all the optional
bits into the struct.  Based on the previous discussion maybe
something like:

int __scsi_execute_cmd(struct scsi_device *sdev, const unsigned char *cmd,
		blk_opf_t opf, void *buffer, unsigned int bufflen,
		int timeout, int retries,
		const struct scsi_exec_args *args)

which would be a nice replacement for all the existing scsi_execute*
interfaces.




[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