diff --git a/scripts/generate-patched-kernel b/scripts/generate-patched-kernel index a0cbdbb96..2faba70fd 100755 --- a/scripts/generate-patched-kernel +++ b/scripts/generate-patched-kernel @@ -28,6 +28,7 @@ script_dir="$(dirname $0)" if [ "${script_dir#/}" = "${script_dir}" ]; then script_dir="$PWD/$script_dir" fi +scriptdir="${scriptdir%/.}" scst_dir="$(dirname "${script_dir}")" source "${script_dir}/kernel-functions" diff --git a/scripts/rebuild-rhel-kernel-rpm b/scripts/rebuild-rhel-kernel-rpm index 7452e3542..f03da6df9 100755 --- a/scripts/rebuild-rhel-kernel-rpm +++ b/scripts/rebuild-rhel-kernel-rpm @@ -40,6 +40,7 @@ scriptdir="$(dirname "$0")" if [ "${scriptdir:0:1}" != "/" ]; then scriptdir="$PWD/${scriptdir}" fi +scriptdir="${scriptdir%/.}" source "${scriptdir}/rhel-rpm-functions" scst_dir="$(dirname "$scriptdir")" downloaddir=$HOME/software/downloads diff --git a/scst/include/scst.h b/scst/include/scst.h index 7e853dd64..b47ce4b7e 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -81,9 +81,13 @@ typedef _Bool bool; #define false 0 #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 21) && !defined(RHEL_MAJOR) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 21) +#ifndef __packed #define __packed __attribute__((packed)) -#define __aligned __attribute__((aligned)) +#endif +#ifndef __aligned +#define __aligned(x) __attribute__((aligned(x))) +#endif #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) @@ -242,7 +246,9 @@ static inline unsigned int queue_max_hw_sectors(struct request_queue *q) #endif #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35) && \ + (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 6 || \ + RHEL_MAJOR -0 == 6 && RHEL_MINOR -0 < 1) extern int hex_to_bin(char ch); #endif @@ -4847,7 +4853,10 @@ int scst_scsi_exec_async(struct scst_cmd *cmd, void *data, void (*done)(void *data, char *sense, int result, int resid)); #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37) && !defined(RHEL_MAJOR) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37) && \ + (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 5 || \ + RHEL_MAJOR -0 == 5 && RHEL_MINOR -0 < 10 || \ + RHEL_MAJOR -0 == 6 && RHEL_MINOR -0 < 1) /* * See also patch "mm: add vzalloc() and vzalloc_node() helpers" (commit * e1ca7788dec6773b1a2bce51b7141948f2b8bccf). diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 71d42d22c..e1906b78e 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -5254,16 +5254,18 @@ static void vdisk_bio_set_failfast(struct bio *bio) static void vdisk_bio_set_hoq(struct bio *bio) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) || \ - defined(RHEL_MAJOR) && RHEL_MAJOR -0 >= 6 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) || \ + (defined(RHEL_MAJOR) && \ + (RHEL_MAJOR -0 > 6 || RHEL_MAJOR -0 == 6 && RHEL_MINOR -0 > 0)) bio->bi_rw |= REQ_SYNC; #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) bio->bi_rw |= 1 << BIO_RW_SYNCIO; #else bio->bi_rw |= 1 << BIO_RW_SYNC; #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) || \ - defined(RHEL_MAJOR) && RHEL_MAJOR -0 >= 6 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) || \ + (defined(RHEL_MAJOR) && \ + (RHEL_MAJOR -0 > 6 || RHEL_MAJOR -0 == 6 && RHEL_MINOR -0 > 0)) bio->bi_rw |= REQ_META; #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) /* diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index ae416cb0a..f05ac814e 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -100,7 +100,9 @@ char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35) && \ + (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 6 || \ + RHEL_MAJOR -0 == 6 && RHEL_MINOR -0 < 1) /* * See also "lib: introduce common method to convert hex digits" (commit * 903788892ea0fc7fcaf7e8e5fac9a77379fc215b). @@ -6838,7 +6840,7 @@ static int get_cdb_info_read_pos(struct scst_cmd *cmd, cmd->bufflen = 32; break; case 8: - cmd->bufflen = max(28, cmd->bufflen); + cmd->bufflen = max(32, cmd->bufflen); break; default: PRINT_ERROR("READ POSITION: Invalid service action %x",