scripts: Merge r8007:8277 from trunk

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.3.x@8281 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2019-04-30 14:27:19 +00:00
parent 06cdc45897
commit 6971f60c14
8 changed files with 155 additions and 194 deletions

View File

@@ -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)
@@ -180,6 +197,8 @@ function evaluate(stmnt, pattern, arg, op, result) {
"(\\1) * 256 + (\\2)", "g", stmnt)
}
gsub("defined\\(UEK_KABI_RENAME\\)", "0", stmnt)
if (SCSI_EXEC_REQ_FIFO_DEFINED != "")
{
gsub("defined[[:blank:]]+SCSI_EXEC_REQ_FIFO_DEFINED",
@@ -371,6 +390,7 @@ function handle_if(evaluated)
|| $0 ~ "RHEL_MINOR" \
|| $0 ~ "RHEL_RELEASE_CODE" \
|| $0 ~ "SOCK_RECVMSG_HAS_FOUR_ARGS" \
|| $0 ~ "UEK_KABI_RENAME" \
|| $0 ~ "USE_PRE_440_WR_STRUCTURE" \
|| generating_upstream_patch_defined \
&& $0 ~ "GENERATING_UPSTREAM_PATCH" \
@@ -505,9 +525,8 @@ function process_preprocessor_statement(evaluated, condition) {
ei = substr(ei, 6)
else if (ei ~ "^+#ifdef")
ei = substr(ei, 9)
evaluated = sprintf("%s /* %s */",
$0 ~ " " ? substr($0, 1, index($0, " ")) : $0,
ei);
match($0, "([^/ ]*)[[:blank:]]*/\\*[^*]*\\*/[[:blank:]]*", arg)
evaluated = sprintf("%s /* %s */", arg[1], ei);
if (match(evaluated, "([^/ ]*) */\\* defined\\(([^()]*)\\) \\*/",
arg))
{