From eb6faa3fb7900f1ad29e5ba17abcaff719bbded8 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 25 May 2013 19:05:42 +0000 Subject: [PATCH] scripts: Merge from trunk git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4879 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/generate-kernel-patch | 4 ++- scripts/specialize-patch | 52 +++++++++++++++++++---------------- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/scripts/generate-kernel-patch b/scripts/generate-kernel-patch index 431afb15c..28d2bd596 100755 --- a/scripts/generate-kernel-patch +++ b/scripts/generate-kernel-patch @@ -262,7 +262,9 @@ done scsi_exec_req_fifo_defined=0 scst_io_context=0 for p in scst/kernel/*-${kver}.patch \ - iscsi-scst/kernel/patches/*-${kver}.patch + $(if [ ${kver} = 3.7 ] && [ "$1" = "3.7.10" -o "$1" ">" "3.7.10" ]; + then echo iscsi-scst/kernel/patches/*-3.7.10.patch; + else echo iscsi-scst/kernel/patches/*-${kver}.patch; fi) do # Exclude the put_page_callback patch when command-line option -u has been # specified since the current approach is not considered acceptable for diff --git a/scripts/specialize-patch b/scripts/specialize-patch index bb93ebcf6..011eb24d2 100755 --- a/scripts/specialize-patch +++ b/scripts/specialize-patch @@ -48,10 +48,10 @@ function evaluate(stmnt, pattern, arg, op, result) { printf "/* debug specialize-patch: (a) %s */\n", stmnt # Remove C-style comments. - gsub("[ ]*\\/\\*[^*]*\\*\\/[ ]*", "", stmnt) + gsub("[[:blank:]]*\\/\\*[^*]*\\*\\/[[:blank:]]*", "", stmnt) # Remove the spaces before the #-sign. - gsub("^+[ ]*#[ ]*", "+#", stmnt) + gsub("^+[[:blank:]]*#[[:blank:]]*", "+#", stmnt) if (match(stmnt, "^+#ifdef (.*)$", arg)) { @@ -93,45 +93,49 @@ function evaluate(stmnt, pattern, arg, op, result) { gsub("RHEL_MINOR", RHEL_MINOR, stmnt) } + gsub("defined\\(RHEL_RELEASE_VERSION\\)", "1", stmnt) if (RHEL_MAJOR == "" || RHEL_MINOR == "") { gsub("defined\\(RHEL_RELEASE_CODE\\)", "0", stmnt) gsub("RHEL_RELEASE_CODE", "", stmnt) + gsub("RHEL_RELEASE_VERSION\\([^,)]*,[ ]*[^,)]*\\)", "0", stmnt) } else { gsub("defined\\(RHEL_RELEASE_CODE\\)", "1", stmnt) gsub("RHEL_RELEASE_CODE", RHEL_MAJOR * 256 + RHEL_MINOR, stmnt) + stmnt = gensub("RHEL_RELEASE_VERSION\\(([^,)]*),[ ]*([^,)]*)\\)", + "(\\1) * 256 + (\\2)", "g", stmnt) } if (SCSI_EXEC_REQ_FIFO_DEFINED != "") { - gsub("defined [ ]*SCSI_EXEC_REQ_FIFO_DEFINED", + gsub("defined[[:blank:]]+SCSI_EXEC_REQ_FIFO_DEFINED", SCSI_EXEC_REQ_FIFO_DEFINED, stmnt) - gsub("defined[ ]*\\([ ]*SCSI_EXEC_REQ_FIFO_DEFINED[ ]*\\)", + gsub("defined[[:blank:]]*\\([[:blank:]]*SCSI_EXEC_REQ_FIFO_DEFINED[[:blank:]]*\\)", SCSI_EXEC_REQ_FIFO_DEFINED, stmnt) } if (SCST_IO_CONTEXT != "") { - gsub("defined [ ]*SCST_IO_CONTEXT", SCST_IO_CONTEXT, stmnt) - gsub("defined[ ]*\\([ ]*SCST_IO_CONTEXT[ ]*\\)", SCST_IO_CONTEXT, stmnt) + gsub("defined[[:blank:]]+SCST_IO_CONTEXT", SCST_IO_CONTEXT, stmnt) + gsub("defined[[:blank:]]*\\([[:blank:]]*SCST_IO_CONTEXT[[:blank:]]*\\)", SCST_IO_CONTEXT, stmnt) } if (generating_upstream_patch_defined) { - gsub("defined [ ]*GENERATING_UPSTREAM_PATCH", 1, stmnt) - gsub("defined[ ]*\\([ ]*GENERATING_UPSTREAM_PATCH[ ]*\\)", 1, stmnt) + gsub("defined[[:blank:]]+GENERATING_UPSTREAM_PATCH", 1, stmnt) + gsub("defined[[:blank:]]*\\([[:blank:]]*GENERATING_UPSTREAM_PATCH[[:blank:]]*\\)", 1, stmnt) } if (config_tcp_zero_copy_transfer_completion_notification_undefined) { - gsub("defined [ ]*CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION", 0, stmnt) - gsub("defined[ ]*\\([ ]*CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION[ ]*\\)", 0, stmnt) + gsub("defined[[:blank:]]+CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION", 0, stmnt) + gsub("defined[[:blank:]]*\\([[:blank:]]*CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION[[:blank:]]*\\)", 0, stmnt) } - gsub("defined [ ]*CONFIG_SCST_PROC", !config_scst_proc_undefined, stmnt) - gsub("defined[ ]*\\([ ]*CONFIG_SCST_PROC[ ]*\\)", !config_scst_proc_undefined, + gsub("defined[[:blank:]]+CONFIG_SCST_PROC", !config_scst_proc_undefined, stmnt) + gsub("defined[[:blank:]]*\\([[:blank:]]*CONFIG_SCST_PROC[[:blank:]]*\\)", !config_scst_proc_undefined, stmnt) if (debug) @@ -141,19 +145,19 @@ function evaluate(stmnt, pattern, arg, op, result) { { last_stmnt = stmnt - pattern = "![ ]*([0-9]+)" + pattern = "![[:blank:]]*([0-9]+)" while (match(stmnt, pattern, op) != 0) { sub(pattern, op[1] == 0, stmnt) } - pattern="KERNEL_VERSION\\([ ]*([0-9]+)[ ]*,[ ]*([0-9]+)[ ]*,[ ]*([0-9]+)[ ]*\\)" + pattern="KERNEL_VERSION\\([[:blank:]]*([0-9]+)[[:blank:]]*,[[:blank:]]*([0-9]+)[[:blank:]]*,[[:blank:]]*([0-9]+)[[:blank:]]*\\)" while (match(stmnt, pattern, op) != 0) { sub(pattern, op[1] * 65536 + op[2] * 256 + op[3], stmnt) } - pattern="(-*[0-9]+)[ ]*(\\*|/)[ ]*(-*[0-9]+)" + pattern="(-*[0-9]+)[[:blank:]]*(\\*|/)[[:blank:]]*(-*[0-9]+)" while (match(stmnt, pattern, op) != 0) { result="error" @@ -162,7 +166,7 @@ function evaluate(stmnt, pattern, arg, op, result) { sub(pattern, result, stmnt) } - pattern="(-*[0-9]+)[ ]*(\\+|-)[ ]*(-*[0-9]+)" + pattern="(-*[0-9]+)[[:blank:]]*(\\+|-)[[:blank:]]*(-*[0-9]+)" while (match(stmnt, pattern, op) != 0) { result="error" @@ -171,7 +175,7 @@ function evaluate(stmnt, pattern, arg, op, result) { sub(pattern, result, stmnt) } - pattern="(-*[0-9]+)[ ]*(<|<=|>|>=|==|!=)[ ]*(-*[0-9]+)" + pattern="(-*[0-9]+)[[:blank:]]*(<|<=|>|>=|==|!=)[[:blank:]]*(-*[0-9]+)" while (match(stmnt, pattern, op) != 0) { result="error" @@ -184,43 +188,43 @@ function evaluate(stmnt, pattern, arg, op, result) { sub(pattern, result, stmnt) } - pattern="(-*[0-9]+)[ ]*\\&\\&[ ]*(-*[0-9]+)" + pattern="(-*[0-9]+)[[:blank:]]*\\&\\&[[:blank:]]*(-*[0-9]+)" while (match(stmnt, pattern, op) != 0) { sub(pattern, (op[1] != 0) && (op[2] != 0), stmnt) } - pattern="^+#if[ ]*([01])[ ]*\\&\\&[ ]*(!*[ ]*defined[ ]*\\([ ]*[A-Za-z_]*[ ]*\\))$" + pattern="^+#if[[:blank:]]*([01])[[:blank:]]*\\&\\&[[:blank:]]*(!*[[:blank:]]*defined[[:blank:]]*\\([[:blank:]]*[A-Za-z_]*[[:blank:]]*\\))$" while (match(stmnt, pattern, op) != 0) { stmnt = "+#if " (op[1] != 0 ? op[2] : op[1]) } - pattern="^+#if[ ]*(!*[ ]*defined[ ]*\\([ ]*[A-Za-z_]*[ ]*\\))\\&\\&[ ]*([01])[ ]*$" + pattern="^+#if[[:blank:]]*(!*[[:blank:]]*defined[[:blank:]]*\\([[:blank:]]*[A-Za-z_]*[[:blank:]]*\\))\\&\\&[[:blank:]]*([01])[[:blank:]]*$" while (match(stmnt, pattern, op) != 0) { stmnt = "+#if " (op[2] != 0 ? op[1] : op[2]) } - pattern="^+#if[ ]*(!*[ ]*[A-Za-z_]*[ ]*)\\&\\&[ ]*([01])[ ]*$" + pattern="^+#if[[:blank:]]*(!*[[:blank:]]*[A-Za-z_]*[[:blank:]]*)\\&\\&[[:blank:]]*([01])[[:blank:]]*$" while (match(stmnt, pattern, op) != 0) { stmnt = "+#if " (op[2] != 0 ? op[1] : op[2]) } - pattern="(-*[0-9]+)[ ]*\\|\\|[ ]*(-*[0-9]+)" + pattern="(-*[0-9]+)[[:blank:]]*\\|\\|[[:blank:]]*(-*[0-9]+)" while (match(stmnt, pattern, op) != 0) { sub(pattern, (op[1] != 0) || (op[2] != 0), stmnt) } - pattern="^+#if[ ]*([01])[ ]*\\|\\|[ ]*(!*[ ]*defined[ ]*\\([ ]*[A-Za-z_]*[ ]*\\))$" + pattern="^+#if[[:blank:]]*([01])[[:blank:]]*\\|\\|[[:blank:]]*(!*[[:blank:]]*defined[[:blank:]]*\\([[:blank:]]*[A-Za-z_]*[[:blank:]]*\\))$" while (match(stmnt, pattern, op) != 0) { stmnt = "+#if " (op[1] == 0 ? op[2] : op[1]) } - pattern="\\(([01])[ ]*\\|\\|[ ]*(!*[ ]*defined[ ]*\\([ ]*[A-Za-z_]*[ ]*\\))\\)" + pattern="\\(([01])[[:blank:]]*\\|\\|[[:blank:]]*(!*[[:blank:]]*defined[[:blank:]]*\\([[:blank:]]*[A-Za-z_]*[[:blank:]]*\\))\\)" while (match(stmnt, pattern, op) != 0) { sub(pattern, op[1] == 0 ? op[2] : op[1], stmnt)