From 102a0743326a03cd1a1202ceda21e175b7d3575c Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Tue, 20 Feb 2024 01:20:52 +0000 Subject: [PATCH] add new system file --- kernel/include/scsi/scsi.h | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-) diff --git a/kernel/include/scsi/scsi.h b/kernel/include/scsi/scsi.h index eb7853c..ef33451 100644 --- a/kernel/include/scsi/scsi.h +++ b/kernel/include/scsi/scsi.h @@ -88,6 +88,21 @@ return (lun & 0xff00) == SCSI_W_LUN_BASE; } +/** + * scsi_status_is_check_condition - check the status return. + * + * @status: the status passed up from the driver (including host and + * driver components) + * + * This returns true if the status code is SAM_STAT_CHECK_CONDITION. + */ +static inline int scsi_status_is_check_condition(int status) +{ + if (status < 0) + return false; + status &= 0xfe; + return status == SAM_STAT_CHECK_CONDITION; +} /* * MESSAGE CODES @@ -273,11 +288,5 @@ /* Used to obtain the PCI location of a device */ #define SCSI_IOCTL_GET_PCI 0x5387 - -/* Pull a u32 out of a SCSI message (using BE SCSI conventions) */ -static inline __u32 scsi_to_u32(__u8 *ptr) -{ - return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3]; -} #endif /* _SCSI_SCSI_H */ -- Gitblit v1.6.2