From 66b51069b3ec331d8ba8405329408b60fffc0777 Mon Sep 17 00:00:00 2001 From: Yan Burman Date: Thu, 4 Sep 2014 06:36:01 +0000 Subject: [PATCH] Merged revisions 5740,5744-5745,5751-5755,5758,5760,5762,5764 via svnmerge from svn+ssh://yanb123@svn.code.sf.net/p/scst/svn/trunk ........ r5740 | vlnb | 2014-08-28 04:26:11 +0300 (Thu, 28 Aug 2014) | 11 lines scst_lib: Fix READ POSITION parsing For code 08h (EXTENDED FORM) minimal response length is 32, see table "READ POSITION data format, extended form". In SSC-[2,3] table "READ POSITION service action codes" requests minimum response lenght 28 bytes, but it is an apparent typo, because the actual data format is 32 bytes long. In SSC-4 it is fixed. Signed-off-by: Bart Van Assche ........ r5744 | bvassche | 2014-09-02 09:33:32 +0300 (Tue, 02 Sep 2014) | 4 lines scripts/rebuild-rhel-kernel-rpm: Fix for invocation from current directory Reported-by: Hiroyuki Sato ........ r5745 | bvassche | 2014-09-02 09:35:06 +0300 (Tue, 02 Sep 2014) | 1 line scripts/generate-patched-kernel: Fix for invocation from current directory ........ r5751 | bvassche | 2014-09-03 13:23:51 +0300 (Wed, 03 Sep 2014) | 4 lines scst: Build fix for hex_to_bin() for RHEL 6.1 and later Reported-by: Yan Burman ........ r5752 | bvassche | 2014-09-03 13:47:16 +0300 (Wed, 03 Sep 2014) | 1 line scst.h: Make vzalloc() available on RHEL 6.0 ........ r5753 | bvassche | 2014-09-03 13:50:52 +0300 (Wed, 03 Sep 2014) | 1 line scst: Refine r5751, the hex_to_bin() build fix for RHEL >= 6.1 ........ r5754 | bvassche | 2014-09-03 13:58:03 +0300 (Wed, 03 Sep 2014) | 1 line scst_vdisk: RHEL 6.0 build fix ........ r5755 | bvassche | 2014-09-03 14:00:55 +0300 (Wed, 03 Sep 2014) | 1 line scst_vdisk: Follow-up for r5754 ........ r5758 | bvassche | 2014-09-03 16:43:23 +0300 (Wed, 03 Sep 2014) | 1 line scst.h: RHEL 5.10 build fix ........ r5760 | bvassche | 2014-09-03 16:52:16 +0300 (Wed, 03 Sep 2014) | 1 line scst.h: RHEL 5.10 build fix ........ r5762 | bvassche | 2014-09-03 17:00:14 +0300 (Wed, 03 Sep 2014) | 1 line scst.h: Fix definition of __aligned() ........ r5764 | bvassche | 2014-09-03 17:24:52 +0300 (Wed, 03 Sep 2014) | 1 line scst_vdisk: Use parentheses around && inside || ........ git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/iser@5767 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/generate-patched-kernel | 1 + scripts/rebuild-rhel-kernel-rpm | 1 + scst/include/scst.h | 17 +++++++++++++---- scst/src/dev_handlers/scst_vdisk.c | 10 ++++++---- scst/src/scst_lib.c | 6 ++++-- 5 files changed, 25 insertions(+), 10 deletions(-) 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",