From 2821f808b0f1ca0b65da837ac1e5131f07ab60fa Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 1 May 2017 20:22:56 +0000 Subject: [PATCH 1/3] scst_debug: Remove a duplicated #include directive git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7156 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_debug.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/scst/src/scst_debug.c b/scst/src/scst_debug.c index 8d36da1c7..3e5de31b0 100644 --- a/scst/src/scst_debug.c +++ b/scst/src/scst_debug.c @@ -19,8 +19,6 @@ * GNU General Public License for more details. */ -#include - #ifndef INSIDE_KERNEL_TREE #include #endif From 0c838469178e9a4a5adac6524ffe44c7b9836e18 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 1 May 2017 20:26:08 +0000 Subject: [PATCH 2/3] Surround #include with #ifndef INSIDE_KERNEL_TREE / #endif git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7157 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/isert-scst/iser.h | 5 ++++- iscsi-scst/kernel/isert-scst/iser_rdma.c | 4 +++- iscsi-scst/kernel/isert-scst/isert.h | 2 +- iscsi-scst/kernel/isert-scst/isert_dbg.h | 3 +-- iscsi-scst/kernel/isert-scst/isert_login.c | 2 ++ iscsi-scst/kernel/session.c | 2 ++ scst/src/dev_handlers/scst_user.c | 9 +++++---- scst/src/scst_event.c | 2 ++ scst/src/scst_lib.c | 6 ++---- 9 files changed, 22 insertions(+), 13 deletions(-) diff --git a/iscsi-scst/kernel/isert-scst/iser.h b/iscsi-scst/kernel/isert-scst/iser.h index 082cf9cd4..65ae7e3db 100644 --- a/iscsi-scst/kernel/isert-scst/iser.h +++ b/iscsi-scst/kernel/isert-scst/iser.h @@ -36,10 +36,13 @@ #ifndef __ISER_H__ #define __ISER_H__ -#include #include #include #include +#ifndef INSIDE_KERNEL_TREE +#include +#endif + #if defined(RHEL_MAJOR) && RHEL_MAJOR -0 == 5 static inline u16 vlan_dev_vlan_id(const void *dev) { diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index e24b5ecdb..bfc03f0d9 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -36,9 +36,11 @@ #include #include -#include #include #include +#ifndef INSIDE_KERNEL_TREE +#include +#endif #include "isert_dbg.h" #include "iser.h" diff --git a/iscsi-scst/kernel/isert-scst/isert.h b/iscsi-scst/kernel/isert-scst/isert.h index ee48c33ea..7a4554bce 100644 --- a/iscsi-scst/kernel/isert-scst/isert.h +++ b/iscsi-scst/kernel/isert-scst/isert.h @@ -43,7 +43,6 @@ #include #include #include -#include #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37) #include @@ -55,6 +54,7 @@ #include #include #else +#include #include "isert_scst.h" #include "iscsi_scst.h" #endif diff --git a/iscsi-scst/kernel/isert-scst/isert_dbg.h b/iscsi-scst/kernel/isert-scst/isert_dbg.h index 4531b0c09..9bf2aba17 100644 --- a/iscsi-scst/kernel/isert-scst/isert_dbg.h +++ b/iscsi-scst/kernel/isert-scst/isert_dbg.h @@ -16,8 +16,6 @@ #ifndef ISERT_DBG_H #define ISERT_DBG_H -#include - #ifdef LOG_PREFIX #undef LOG_PREFIX #endif @@ -27,6 +25,7 @@ #ifdef INSIDE_KERNEL_TREE #include #else +#include #include #endif diff --git a/iscsi-scst/kernel/isert-scst/isert_login.c b/iscsi-scst/kernel/isert-scst/isert_login.c index f0220e958..a6ffea6af 100644 --- a/iscsi-scst/kernel/isert-scst/isert_login.c +++ b/iscsi-scst/kernel/isert-scst/isert_login.c @@ -39,7 +39,9 @@ #include /* error codes */ #include #include +#ifndef INSIDE_KERNEL_TREE #include +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) #include #else diff --git a/iscsi-scst/kernel/session.c b/iscsi-scst/kernel/session.c index 19f9b4f84..6111b73d1 100644 --- a/iscsi-scst/kernel/session.c +++ b/iscsi-scst/kernel/session.c @@ -14,7 +14,9 @@ * GNU General Public License for more details. */ +#ifndef INSIDE_KERNEL_TREE #include +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) #include #endif diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index debed3370..6f94728e9 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -22,10 +22,6 @@ #include #include #include -#include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) -#include -#endif #define LOG_PREFIX DEV_USER_NAME @@ -33,11 +29,16 @@ #include #include #else +#include #include "scst.h" #include "scst_user.h" #endif #include "scst_dev_handler.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) +#include +#endif + #ifndef INSIDE_KERNEL_TREE #if defined(CONFIG_HIGHMEM4G) || defined(CONFIG_HIGHMEM64G) #warning HIGHMEM kernel configurations are not supported by this module, \ diff --git a/scst/src/scst_event.c b/scst/src/scst_event.c index 4ec509bf0..ff2a0074b 100644 --- a/scst/src/scst_event.c +++ b/scst/src/scst_event.c @@ -11,7 +11,9 @@ #include #include #include +#ifndef INSIDE_KERNEL_TREE #include +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) #include #endif diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 1b105209b..dbf5cdbd5 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -33,7 +33,9 @@ #include #include #include +#ifndef INSIDE_KERNEL_TREE #include +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) #include #endif @@ -43,10 +45,6 @@ #include #include -#ifndef INSIDE_KERNEL_TREE -#include -#endif - #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) #include #endif From 2fcd2f24b05718f2de7cedfc5c51384946c39047 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 1 May 2017 21:01:33 +0000 Subject: [PATCH 3/3] scst: Kernel v4.12 build fixes git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7158 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 2 ++ scst/src/scst_lib.c | 30 ++++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 882904c1e..6a32a3189 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -1091,7 +1091,9 @@ check: if (virt_dev->unmap_opt_gran == virt_dev->unmap_align) virt_dev->unmap_align = 0; virt_dev->unmap_max_lba_cnt = q->limits.max_discard_sectors >> (block_shift - 9); +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) virt_dev->discard_zeroes_data = q->limits.discard_zeroes_data; +#endif #else sBUG(); #endif diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index dbf5cdbd5..3da17c97f 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -8267,16 +8267,26 @@ static void scsi_end_async(struct request *req, int error) lockdep_assert_held(req->q->queue_lock); #endif - if (sioc->done) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) - sioc->done(sioc->data, sioc->sense, req->errors, - scsi_req(req)->resid_len); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) - sioc->done(sioc->data, sioc->sense, req->errors, - req->resid_len); + if (sioc->done) { + int result, resid_len; + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) + result = scsi_req(req)->result; #else - sioc->done(sioc->data, sioc->sense, req->errors, req->data_len); + result = req->errors; #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) + resid_len = scsi_req(req)->resid_len; +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) + resid_len = req->resid_len; +#endif + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) + sioc->done(sioc->data, sioc->sense, result, resid_len); +#else + sioc->done(sioc->data, sioc->sense, result, req->data_len); +#endif + } kmem_cache_free(scsi_io_context_cache, sioc); @@ -8365,7 +8375,11 @@ int scst_scsi_exec_async(struct scst_cmd *cmd, void *data, req->sense = sioc->sense; req->sense_len = sizeof(sioc->sense); rq->timeout = cmd->timeout; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) + req->retries = cmd->retries; +#else rq->retries = cmd->retries; +#endif rq->end_io_data = sioc; #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35) rq->cmd_flags |= REQ_FAILFAST_MASK;