Re: [PATCH 002/117] Introduce enums for the SAM, message, host and driver status codes

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

 



On 4/20/21 2:06 AM, Bart Van Assche wrote:
Allow the compiler to verify whether SAM, message, host and driver status
codes are used correctly. Add the attribute "__packed" to these enum
definitions such that instances of the new enum types only occupy a single
byte.

Cc: Hannes Reinecke <hare@xxxxxxxx>
Cc: John Garry <john.garry@xxxxxxxxxx>
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
  drivers/scsi/scsi_error.c  |  2 +
  include/scsi/scsi.h        | 84 ++---------------------------------
  include/scsi/scsi_cmnd.h   | 11 +++--
  include/scsi/scsi_proto.h  | 53 ++++++++++++----------
  include/scsi/scsi_status.h | 91 ++++++++++++++++++++++++++++++++++++++
  5 files changed, 133 insertions(+), 108 deletions(-)
  create mode 100644 include/scsi/scsi_status.h

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 9afd65eb2c8b..54213c37806b 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1775,6 +1775,8 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd)
  		fallthrough;
  	case DID_SOFT_ERROR:
  		return (scmd->request->cmd_flags & REQ_FAILFAST_DRIVER);
+	default:
+		break;

Remind me, what are the compiler warnings we use during build?
Adding a default case seems OK for me if we use -Wswitch-enum, but I'm not sure if we only have -Wswitch because then we would not get static build warnings if we ever were to add new enum values but forgot to address them here?

  	}

  	if (status_byte(scmd->result) != CHECK_CONDITION)



--
Mit freundlichen Gruessen / Kind regards
Steffen Maier

Linux on IBM Z Development

https://www.ibm.com/privacy/us/en/
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Matthias Hartmann
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294



[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