From: vlnb Date: Tue, 3 Nov 2009 18:56:19 +0000 (+0000) Subject: The patch below converts the #ifndef SYMBOL / #define SYMBOL / #endif symbol X-Git-Url: http://git.etherboot.org/mirror/scst/.git/commitdiff_plain/c34602c748e8144d3e6e82ddd7aa66874d4d9f2a The patch below converts the #ifndef SYMBOL / #define SYMBOL / #endif symbol constructs in the SCST source code into one of the following: * These three lines are removed entirely if the symbol definition is present in the Linux 2.6.18 source tree. * The definition has been made unconditional if the symbol definition is not yet present in the 2.6.31 source tree. * Converted the definition into #if LINUX_VERSION_CODE < KERNEL_VERSION(...) / #define SYMBOL / #endif if a definition for the symbol has been added between kernel versions 2.6.18 and 2.6.31. The patch below has been tested by veryfing whether the SCST tree still compiles on RHEL 5.4 and by verifying the output of the following command: for ((i=24;i<=31;i++)); do scripts/run-regression-tests 2.6.$i; done Signed-off-by: Bart Van Assche also MI_REPORT_TARGET_PGS removed as not used. git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@1315 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- diff --git a/scst/include/scst_const.h b/scst/include/scst_const.h index 011193e..2dbf389 100644 --- a/scst/include/scst_const.h +++ b/scst/include/scst_const.h @@ -20,6 +20,14 @@ #ifndef __SCST_CONST_H #define __SCST_CONST_H +#ifndef GENERATING_UPSTREAM_PATCH +/* + * Include only when not converting this header file into + * a patch for upstream review because only then the symbol LINUX_VERSION_CODE + * is needed. + */ +#include +#endif #include #define SCST_CONST_VERSION "$Revision$" @@ -178,36 +186,23 @@ enum scst_cmd_queue_type { /************************************************************* * SCSI opcodes not listed anywhere else *************************************************************/ -#ifndef REPORT_DEVICE_IDENTIFIER #define REPORT_DEVICE_IDENTIFIER 0xA3 -#endif -#ifndef INIT_ELEMENT_STATUS #define INIT_ELEMENT_STATUS 0x07 -#endif -#ifndef INIT_ELEMENT_STATUS_RANGE #define INIT_ELEMENT_STATUS_RANGE 0x37 -#endif -#ifndef PREVENT_ALLOW_MEDIUM #define PREVENT_ALLOW_MEDIUM 0x1E -#endif -#ifndef READ_ATTRIBUTE #define READ_ATTRIBUTE 0x8C -#endif -#ifndef REQUEST_VOLUME_ADDRESS #define REQUEST_VOLUME_ADDRESS 0xB5 -#endif -#ifndef WRITE_ATTRIBUTE #define WRITE_ATTRIBUTE 0x8D -#endif -#ifndef WRITE_VERIFY_16 #define WRITE_VERIFY_16 0x8E -#endif -#ifndef VERIFY_6 #define VERIFY_6 0x13 -#endif -#ifndef VERIFY_12 #define VERIFY_12 0xAF -#endif +#ifndef GENERATING_UPSTREAM_PATCH +/* + * The constants below have been defined in the kernel header + * and hence are not needed when this header file is included in kernel code. + * The definitions below are only used when this header file is included during + * compilation of SCST's user space components. + */ #ifndef READ_16 #define READ_16 0x88 #endif @@ -224,13 +219,12 @@ enum scst_cmd_queue_type { /* values for service action in */ #define SAI_READ_CAPACITY_16 0x10 #endif -#ifndef MI_REPORT_TARGET_PGS -/* values for maintenance in */ -#define MI_REPORT_TARGET_PGS 0x0a #endif +#ifndef GENERATING_UPSTREAM_PATCH #ifndef REPORT_LUNS #define REPORT_LUNS 0xa0 #endif +#endif /************************************************************* ** SCSI Architecture Model (SAM) Status codes. Taken from SAM-3 draft @@ -251,12 +245,8 @@ enum scst_cmd_queue_type { /************************************************************* ** Control byte field in CDB *************************************************************/ -#ifndef CONTROL_BYTE_LINK_BIT #define CONTROL_BYTE_LINK_BIT 0x01 -#endif -#ifndef CONTROL_BYTE_NACA_BIT #define CONTROL_BYTE_NACA_BIT 0x04 -#endif /************************************************************* ** Byte 1 in INQUIRY CDB