From 1b23ac912036aa87d1ab91ba41a45b7b19a282f6 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 9 Mar 2019 23:08:47 +0000 Subject: [PATCH] scripts/specialize-patch: Support specializing a patch for RHEL 6.x/7.x This patch is based on a patch from . git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8020 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/specialize-patch | 43 ++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/scripts/specialize-patch b/scripts/specialize-patch index a4bf4e6f4..674a5f3d3 100755 --- a/scripts/specialize-patch +++ b/scripts/specialize-patch @@ -20,7 +20,8 @@ ############################################################################ # Usage: -# * Specify the kernel version code as follows: -v kernel_version=... +# * Specify the kernel version code and optionally the RHEL version as follows: +# -v kernel_version=... -vRHEL_MAJOR=... -vRHEL_MINOR=... # * Provide the patch to be processed to stdin. # # The output of this script will be a patch that is specialized for the @@ -64,31 +65,39 @@ function evaluate(stmnt, pattern, arg, op, result) { } gsub("defined\\(REGISTER_MAD_AGENT_HAS_FLAGS_ARG\\)", - "(LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0))", stmnt) + "(LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) || " \ + "RHEL_RELEASE_CODE -0 >= 6 * 256 + 10)", stmnt) gsub("SOCK_RECVMSG_HAS_FOUR_ARGS", "(LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))", stmnt) gsub("defined\\(USE_PRE_440_WR_STRUCTURE\\)", - "(LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0))", stmnt) + "(LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || " \ + "RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt) gsub("defined\\(IB_CREATE_CQ_HAS_INIT_ATTR\\)", - "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0))", stmnt) + "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) || " \ + "RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt) gsub("defined\\(CREATE_SEND_MAD_HAS_BASE_ARG\\)", - "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0))", stmnt) + "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) || " \ + "RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt) gsub("defined\\(IB_CM_LISTEN_TAKES_FOURTH_ARG\\)", - "(LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0))", stmnt) + "(LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) || " \ + "RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt) gsub("defined\\(IB_CLIENT_REMOVE_TAKES_TWO_ARGS\\)", - "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0))", stmnt) + "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) || " \ + "RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt) gsub("defined\\(IB_QUERY_GID_HAS_ATTR_ARG\\)", - "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))", stmnt) + "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) || " \ + "RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt) gsub("RDMA_CREATE_ID_TAKES_NET_ARG", - "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))", stmnt) + "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) || " \ + "RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt) gsub("HAVE_DEV_ATTR_MAX_SEND_SGE", "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))", stmnt) @@ -108,17 +117,25 @@ function evaluate(stmnt, pattern, arg, op, result) { gsub("defined\\(USE_PRE_440_WR_STRUCTURE\\)", "(LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0))", stmnt) + gsub("defined\\(HAVE_IB_EVENT_GID_CHANGE\\)", + "(LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) || " \ + "RHEL_RELEASE_CODE -0 >= 6 * 256 + 10)", stmnt) + gsub("defined\\(HAVE_IB_QUERY_DEVICE\\)", - "(LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0))", stmnt) + "(LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) || " \ + "RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt) gsub("defined\\(MAD_HANDLER_TAKES_SEND_BUF\\)", - "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0))", stmnt) + "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) || " \ + "RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt) gsub("defined\\(HAVE_IB_SET_CPI_RESP_TIME\\)", - "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))", stmnt) + "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) || " \ + "RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt) gsub("defined\\(IB_PD_HAS_LOCAL_DMA_LKEY\\)", - "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))", stmnt) + "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) || " \ + "RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt) gsub("defined\\(HAVE_IB_DMA_MAP_OPS\\)", "(LINUX_VERSION_CODE >= KERNEL_VERSION(0, 0, 0))", stmnt)