[004/117] libiscsi: Use the host_status enum

Message ID 20210420000845.25873-5-bvanassche@acm.org
State New
Headers show
Series
  • Make better use of static type checking
Related show

Commit Message

Bart Van Assche April 20, 2021, 12:06 a.m.
Allow the compiler to verify the type of the last argument passed to
fail_scsi_task() and fail_scsi_tasks().

Cc: Lee Duncan <lduncan@suse.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/libiscsi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Lee Duncan May 6, 2021, 4:51 p.m. | #1
On 4/19/21 5:06 PM, Bart Van Assche wrote:
> Allow the compiler to verify the type of the last argument passed to

> fail_scsi_task() and fail_scsi_tasks().

> 

> Cc: Lee Duncan <lduncan@suse.com>

> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

> ---

>  drivers/scsi/libiscsi.c | 5 +++--

>  1 file changed, 3 insertions(+), 2 deletions(-)

> 

> diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c

> index 7ad11e42306d..4b8c9b9cf927 100644

> --- a/drivers/scsi/libiscsi.c

> +++ b/drivers/scsi/libiscsi.c

> @@ -590,7 +590,7 @@ static bool cleanup_queued_task(struct iscsi_task *task)

>   * session frwd lock must be held and if not called for a task that is still

>   * pending or from the xmit thread, then xmit thread must be suspended

>   */

> -static void fail_scsi_task(struct iscsi_task *task, int err)

> +static void fail_scsi_task(struct iscsi_task *task, enum host_status err)

>  {

>  	struct iscsi_conn *conn = task->conn;

>  	struct scsi_cmnd *sc;

> @@ -1885,7 +1885,8 @@ static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn,

>  /*

>   * Fail commands. session frwd lock held and xmit thread flushed.

>   */

> -static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun, int error)

> +static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun,

> +			    enum host_status error)

>  {

>  	struct iscsi_session *session = conn->session;

>  	struct iscsi_task *task;

> 


Reviewed-by: Lee Duncan <lduncan@suse.com>

Patch

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 7ad11e42306d..4b8c9b9cf927 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -590,7 +590,7 @@  static bool cleanup_queued_task(struct iscsi_task *task)
  * session frwd lock must be held and if not called for a task that is still
  * pending or from the xmit thread, then xmit thread must be suspended
  */
-static void fail_scsi_task(struct iscsi_task *task, int err)
+static void fail_scsi_task(struct iscsi_task *task, enum host_status err)
 {
 	struct iscsi_conn *conn = task->conn;
 	struct scsi_cmnd *sc;
@@ -1885,7 +1885,8 @@  static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn,
 /*
  * Fail commands. session frwd lock held and xmit thread flushed.
  */
-static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun, int error)
+static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun,
+			    enum host_status error)
 {
 	struct iscsi_session *session = conn->session;
 	struct iscsi_task *task;