Copied r3377 of the some scripts and the nightly build config file from the trunk.

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.0.0.x@3378 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2011-04-10 14:39:31 +00:00
parent db25b605c0
commit 493af798ee
5 changed files with 539 additions and 209 deletions

View File

@@ -3,4 +3,4 @@
ABT_DETAILS="x86_64, Fedora 10"
ABT_JOBS=3
ABT_KERNELS="2.6.35.4 2.6.34.6-nc 2.6.33.7-nc 2.6.32.21-nc 2.6.31.14-nc 2.6.31.13-u 2.6.30.10-nc 2.6.29.6-nc 2.6.28.10-nc 2.6.27.53-nc 2.6.26.8 2.6.25.20-nc 2.6.24.7-nc 2.6.23.17-nc"
ABT_KERNELS="2.6.38.2 2.6.37.6 2.6.36.4 2.6.35.12 2.6.35.12-u-nc 2.6.34.8-nc 2.6.33.9-nc 2.6.32.36-nc 2.6.31.14-nc 2.6.30.10-nc 2.6.29.6-nc 2.6.28.10-nc 2.6.27.58-nc 2.6.26.8-nc 2.6.25.20-nc 2.6.24.7-nc 2.6.23.17-nc"

View File

@@ -26,27 +26,29 @@ function categorize_line(line) {
if (line ~ "^+$")
is_blank = 1
else if (line ~ "^+\tTRACE_ENTRY\\(\\);$")
is_trace_exit = 1
is_trace_entry = 1
else if (line ~ "^+\tTRACE_EXIT\\(\\);$" \
|| line ~ "^+\tTRACE_EXIT_RES\\(.*\\);$" \
|| line ~ "^+\tTRACE_EXIT_HRES\\(.*\\);$")
is_trace_exit = 1
}
# Leave out TRACE_ENTRY() and the blank line below it and also TRACE_EXIT()
# and the blank line before it.
function print_conditionally() {
if (! previous_is_trace_entry \
&& ! (before_previous_is_trace_entry && previous_is_blank) \
&& ! previous_is_trace_exit \
&& ! (previous_is_blank && is_trace_exit))
{
# printf "[%d] %s\n", lines, previous_line
line[lines++] = previous_line
}
else
if (previous_is_trace_entry \
|| (before_previous_is_trace_entry && previous_is_blank) \
|| previous_is_trace_exit \
|| (previous_is_blank && is_trace_exit))
{
# print "deleted", previous_line
lines_deleted++
}
else
{
# printf "[%d] %s\n", lines, previous_line
line[lines++] = previous_line
}
}
function shift_state_variables(line) {

View File

@@ -24,12 +24,15 @@
########################
function usage {
echo "Usage: $0 [-h] [-m] [-n] [-p <dir>] [-u] <kernel version>, where: "
echo "Usage: $0 [-d] [-h] [-m] [-n] [-p <dir>] [-s] [-u] <kernel version>"
echo "where: "
echo " -d - enable patch specialization debugging"
echo " -h - show this text"
echo " -m - add mpt target driver"
echo " -n - do not delete code disabled via preprocessor statements"
echo " -p - generate multiple patches instead of one big patch into"\
"the specified directory."
echo " -s - disable patch specialization."
echo " -u - enables #define GENERATING_UPSTREAM_PATCH."
}
@@ -101,32 +104,48 @@ EOF
# Run the script specialize_patch with appropriate options on the patch
# passed via stdin and send the specialized patch to stdout.
function specialize_patch {
"$(dirname $0)/specialize-patch" \
${specialize_patch_options} \
-v kernel_version="${kernel_version}" \
-v SCSI_EXEC_REQ_FIFO_DEFINED="${scsi_exec_req_fifo_defined}" \
-v SCST_IO_CONTEXT="${scst_io_context}" \
| if [ "${generating_upstream_patch}" = "true" ]; then
scripts/filter-trace-entry-exit
else
cat
fi
if [ "${enable_specialize}" = "true" ]; then
"$(dirname $0)/specialize-patch" \
${specialize_patch_options} \
-v kernel_version="${kernel_version}" \
-v SCSI_EXEC_REQ_FIFO_DEFINED="${scsi_exec_req_fifo_defined}" \
-v SCST_IO_CONTEXT="${scst_io_context}" \
| if [ "${generating_upstream_patch}" = "true" ]; then
scripts/filter-trace-entry-exit
else
cat
fi
else
cat
fi
}
# Read a patch from stdin, specialize it for kernel version ${kernel_version}
# and write the output either to stdout or to the file $1 (if not empty),
# depending on the value of the variable ${multiple_patches}.
function process_patch {
local tmppatch
if [ "${multiple_patches}" = "true" ]; then
if [ "$1" != "" ]; then
if [ -e "${patchdir}/$1" ]; then
echo "Warning: overwriting ${patchdir}/$1"
fi
(
echo "Signed-off-by: ${SIGNED_OFF_BY}"
echo ""
specialize_patch
) >"${patchdir}/$1"
tmppatch="$(/bin/mktemp)"
(
specialize_patch
) >"${tmppatch}"
touch "${tmppatch}"
{
if [ -e /usr/bin/diffstat ]; then
awk 'BEGIN{h=1}/^diff/{h=0}/^---/{h=0}h!=0{print}' < "${tmppatch}"
echo "---"
diffstat "${tmppatch}"
echo ""
awk 'BEGIN{h=1}/^diff/{h=0}/^---/{h=0}h==0{print}' < "${tmppatch}"
fi
} \
> "${patchdir}/$(basename $1)"
rm -f "${tmppatch}"
else
# echo "Discarded $(wc -l) lines."
true
@@ -148,6 +167,7 @@ function in_separate_patch {
#########################
debug_specialize="false"
enable_specialize="true"
generating_upstream_patch="false"
mpt_scst="false"
multiple_patches="false"
@@ -162,7 +182,7 @@ if [ ! -e scst -o ! -e iscsi-scst -o ! -e srpt -o ! -e scst_local ]; then
exit 1
fi
set -- $(/usr/bin/getopt dhlmnp:u "$@")
set -- $(/usr/bin/getopt dhlmnp:su "$@")
while [ "$1" != "${1#-}" ]
do
case "$1" in
@@ -174,28 +194,45 @@ do
shift
;;
'-p') multiple_patches="true"; patchdir="$2"; shift; shift;;
'-s') enable_specialize="false"; shift;;
'-u') generating_upstream_patch="true"; shift;;
'--') shift;;
*) usage; exit 1;;
esac
done
if [ "${debug_specialize}" = "true" ]; then
specialize_patch_options="${specialize_patch_options} -v debug=1"
fi
if [ "${generating_upstream_patch}" = "true" ]; then
specialize_patch_options="${specialize_patch_options} -v generating_upstream_patch_defined=1 -v config_tcp_zero_copy_transfer_completion_notification_undefined=1 -v config_scst_proc_undefined=1"
fi
if [ $# != 1 ]; then
usage
exit 1
fi
if [ "${multiple_patches}" = "" ]; then
# Strip patch level from the kernel version number.
if [ "${1#[0-9]*.[0-9]*.[0-9]*.[0-9]*}" != "$1" ]; then
kernel_version="${1%.[0-9]*}"
patch_level="${1#${kernel_version}.}"
else
kernel_version="$1"
fi
# Make sure that for kernel 2.6.33 and later the line
# "#define CONFIG_SCST_PROC" is removed from scst/include/scst.h.
if grep -qw scst_sysfs scst/kernel/in-tree/Makefile.scst-${kernel_version} \
|| [ "${generating_upstream_patch}" = "true" ];
then
specialize_patch_options="${specialize_patch_options} -v config_scst_proc_undefined=1"
fi
if [ "${debug_specialize}" = "true" ]; then
specialize_patch_options="${specialize_patch_options} -v debug=1"
fi
if [ "${generating_upstream_patch}" = "true" ]; then
specialize_patch_options="${specialize_patch_options} -v generating_upstream_patch_defined=1 -v config_tcp_zero_copy_transfer_completion_notification_undefined=1"
fi
if [ "${multiple_patches}" = "true" ]; then
if [ -e "${patchdir}" ]; then
echo "Patch output directory ${patchdir} already exists."
fi
mkdir -p "${patchdir}"
if [ ! -d "${patchdir}" ]; then
echo "Error: ${patchdir} is not a directory."
fi
@@ -206,14 +243,6 @@ fi
# Patch Generation #
####################
# Strip patch level from the kernel version number.
if [ "${1#[0-9]*.[0-9]*.[0-9]*.[0-9]*}" != "$1" ]; then
kernel_version="${1%.[0-9]*}"
patch_level="${1#${kernel_version}.}"
else
kernel_version="$1"
fi
for f in fcst/linux-patches/series-${kernel_version}*
do
if [ -e "$f" ]; then
@@ -221,18 +250,6 @@ do
fi
done
# Make sure that for kernel 2.6.33 and later the line
# "#define CONFIG_SCST_PROC" is removed from scst/include/scst.h.
if grep -qw scst_sysfs scst/kernel/in-tree/Makefile.scst-${kernel_version};
then
specialize_patch_options="${specialize_patch_options} -v config_scst_proc_undefined=1"
fi
if [ "${multiple_patches}" = "false" ]; then
echo "Signed-off-by: ${SIGNED_OFF_BY}"
echo ""
fi
# General kernel patches.
@@ -260,24 +277,28 @@ do
done
scst_debug="scst/include/scst_debug.h scst/src/scst_debug.c"
scst_03_public_headers="scst/include/scst.h scst/include/scst_const.h"
scst_04_main="scst/src/scst_main.c scst/src/scst_module.c scst/src/scst_priv.h"
scst_05_targ="scst/src/scst_targ.c"
scst_06_lib="scst/src/scst_lib.c"
scst_07_pres="scst/src/scst_pres.h scst/src/scst_pres.c"
scst_08_sysfs="scst/src/scst_sysfs.c"
scst_09_debug="scst/include/scst_debug.h scst/src/scst_debug.c"
scst_proc="scst/src/scst_proc.c"
scst_sgv="scst/include/scst_sgv.h scst/src/scst_mem.h scst/src/scst_mem.c doc/sgv_cache.txt"
scst_10_sgv="scst/include/scst_sgv.h scst/src/scst_mem.h scst/src/scst_mem.c doc/sgv_cache.sgml"
scst_user="scst/include/scst_user.h scst/src/dev_handlers/scst_user.c"
scst_vdisk="scst/src/dev_handlers/scst_vdisk.c"
separate_patches="scst_debug scst_proc scst_sgv scst_user scst_vdisk"
source_files_in_separate_patch="${scst_debug} ${scst_proc} ${scst_sgv} ${scst_user} ${scst_vdisk}"
scst_13_vdisk="scst/src/dev_handlers/scst_vdisk.c"
separate_patches="scst_03_public_headers scst_04_main scst_05_targ scst_06_lib scst_07_pres scst_08_sysfs scst_09_debug scst_10_sgv scst_user scst_13_vdisk"
# Directory include/scst/
for f in $(ls scst/include/*h 2>/dev/null)
if [ "${generating_upstream_patch}" = "false" ]; then
separate_patches+=" scst_proc"
fi
source_files_in_separate_patch=""
for s in ${separate_patches}
do
if ! in_separate_patch "${f}"; then
add_file "${f}" "include/scst/${f#scst/include/}"
fi
done \
| process_patch "scst_public_headers.diff"
source_files_in_separate_patch+=" $(set | \
sed -n -e "s/^$s='\(.*\)'$/\1/p" -e "s/^$s=\(.*\)$/\1/p")"
done
# Directory drivers/
@@ -289,7 +310,7 @@ add_patch "scst/kernel/in-tree/Kconfig.drivers.Linux-${kernel_version}.patch" \
add_patch "scst/kernel/in-tree/Makefile.drivers.Linux-${kernel_version}.patch"\
"drivers/Makefile"
) \
| process_patch "misc.diff"
| process_patch "scst_01_drivers_kbuild.diff"
# Directory drivers/scst/
@@ -309,6 +330,11 @@ add_file "${tmp_Kconfig}" "drivers/scst/Kconfig"
tmp_Makefile="${tmpdir}/Makefile.scst-${kernel_version}"
cat "scst/kernel/in-tree/Makefile.scst-${kernel_version}" | \
if [ "${generating_upstream_patch}" = "true" ]; then
grep -v 'scst_proc'
else
cat
fi | \
if [ -e "${fcst_patch_series}" ]; then
cat
else
@@ -317,29 +343,14 @@ fi >"$tmp_Makefile"
add_file "$tmp_Makefile" "drivers/scst/Makefile"
rm -rf "${tmpdir}"
for f in $(ls scst/src/*.[ch] 2>/dev/null)
do
if [ "${generating_upstream_patch}" = "true" \
-a "${f}" = "scst/src/scst_proc.c" ]; then
continue
fi
if ! in_separate_patch "${f}"; then
add_file "${f}" "drivers/scst/${f#scst/src/}"
fi
done
) \
| process_patch "scst_core.diff"
| process_patch "scst_02_scst_kbuild.diff"
for s in ${separate_patches}
do
fileset=$s
for f in $(set | grep "^$s=" | sed -e "s/^$s='\(.*\)'\$/\1/" -e "s/^$s=\(.*\)\$/\1/")
do
if [ "${generating_upstream_patch}" = "true" \
-a "${f}" = "scst/src/scst_proc.c" ]; then
continue
fi
if [ "${f#scst/include}" != "${f}" ]; then
add_file "${f}" "include/scst/${f#scst/include/}"
elif [ "${f#doc}" != "${f}" ]; then
@@ -352,26 +363,24 @@ do
done
{
add_file "scst/README_in-tree" "Documentation/scst/README.scst"
add_file "scst/SysfsRules" "Documentation/scst/SysfsRules"
} | process_patch "scst_core_doc.diff"
add_file "scst/README_in-tree" "Documentation/scst/README.scst"
add_file "scst/SysfsRules" "Documentation/scst/SysfsRules"
} | process_patch "scst_11_core_doc.diff"
# Directory drivers/scst/dev_handlers/
(
add_file "scst/kernel/in-tree/Makefile.dev_handlers-${kernel_version}" \
"drivers/scst/dev_handlers/Makefile" \
| process_patch "dev_handlers_makefile.diff"
| process_patch "scst_11_dev_handlers_makefile.diff"
for f in $(ls scst/src/dev_handlers/*.[ch] 2>/dev/null)
do
if ! in_separate_patch "${f}"; then
add_file "${f}" "drivers/scst/dev_handlers/${f#scst/src/dev_handlers/}"
fi
done
) \
| process_patch "scst_passthrough.diff"
done \
| process_patch "scst_14_passthrough.diff"
# Directory drivers/scst/fcst/
@@ -386,9 +395,9 @@ done
add_file "fcst/Makefile_in-tree" \
"drivers/scst/fcst/Makefile"
add_file "fcst/Kconfig" "drivers/scst/fcst/Kconfig"
for f in $(ls fcst/*.[ch] 2>/dev/null)
do
add_file "${f}" "drivers/scst/fcst/${f#fcst/}"
@@ -477,8 +486,28 @@ fi \
# Directory drivers/scst/srpt
{
cat <<EOF
This patch adds the kernel module ib_srpt, which is a SCSI RDMA Protocol (SRP)
target implementation. This driver uses the InfiniBand stack and the SCST core.
It is a high performance driver capable of handling 600K+ 4K random write
IOPS by a single target as well as 2.5+ GB/s sequential throughput over
a single QDR IB port.
It was originally developed by Vu Pham (Mellanox) and has been optimized by
Bart Van Assche.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Vu Pham <vu@mellanox.com>
Cc: Roland Dreier <rdreier@cisco.com>
Cc: David Dillow <dillowda@ornl.gov>
EOF
if [ "$srpt" = "true" ]; then
add_file "srpt/README_in-tree" "Documentation/scst/README.srpt"
add_file "srpt/src/Kconfig" "drivers/scst/srpt/Kconfig"
add_file "srpt/src/Makefile.in_kernel" "drivers/scst/srpt/Makefile"
@@ -495,10 +524,7 @@ else
add_empty_file "drivers/scst/srpt/Makefile"
fi \
| process_patch "srpt.diff"
add_file "srpt/README_in-tree" "Documentation/scst/README.srpt" \
| process_patch "srpt-doc.diff"
} | process_patch "scst_17_srpt.diff"
# Directory drivers/message/fusion/mpt_scst
@@ -527,13 +553,195 @@ fi
# Directory drivers/scst/scst_local
(
add_file "scst_local/README" "Documentation/scst/README.scst_local"
add_file "scst_local/in-tree/Kconfig" "drivers/scst/scst_local/Kconfig"
add_file "scst_local/in-tree/Makefile-${kernel_version}" "drivers/scst/scst_local/Makefile"
add_file "scst_local/scst_local.c" "drivers/scst/scst_local/scst_local.c"
) \
| process_patch "scst_local.diff"
| process_patch "scst_16_local.diff"
add_file "scst_local/README" "Documentation/scst/README.scst_local" \
| process_patch "scst_local-doc.diff"
# Directory drivers/scsi/ibmvstgt
{
( cd ibmvstgt && ./generate-in-tree-patches "${kernel_version}" )
if [ -e "ibmvstgt/in-tree-patches/${kernel_version}" ]; then
if [ "${multiple_patches}" = "true" ]; then
cat <<EOF
[SCSI] ibmvstgt: Port from tgt to SCST
The ibmvstgt and libsrp kernel modules as included in the 2.6.37 kernel are
based on the tgt SCSI target framework. Both kernel modules need the scsi_tgt
kernel module and the tgtd user space process in order to function
properly. This patch modifies the ibmvstgt and libsrp kernel modules such that
both use the SCST storage target framework instead of tgt. As a result,
neither the scsi_tgt kernel module nor the tgtd user space process are any
more necessary when using the ibmvstgt driver.
This patch introduces one backwards-incompatible change, namely that the path
of the ibmvstgt sysfs attributes is modified. This change is unavoidable
because this patch dissociates ibmvstgt SRP sessions from a SCSI host
instance. Since the user space STGT driver ibmvio was the only user of
these attributes, that shouldn't be an issue.
Changes in ibmvstgt compared to kernel 2.6.36:
- Increased maximum data size for a single SRP command from 128 KB to 64 MB
such that an initiator is not forced to split large transfers into
multiple SCSI commands.
- The maximum RDMA transfer size supported by a single H_COPY_RDMA call is
queried at driver initialization time from the open firmware tree / larger
transfers than 128 KB are now supported too.
- If DMA mapping fails while handling a READ or WRITE command, the offending
command is retried until the associated data has been transferred instead of
reporting to the ibmvscsi client that the SCSI command failed.
- VSCSI command/response queue: one element has been reserved for management
datagrams since these fall outside the SRP credit mechanism. Added a compile-
time check whether the size of this queue is a power of two.
- Fixed a race condition which in theory could have caused the VSCSI receive
queue to overflow: srp_iu_put() is now invoked before a response is sent back
to the initiator instead of after.
- Moved enum iue_flags from libsrp to ibmvstgt because it is ibmvstgt-specific.
- Removed a variable that was modified but never read from ibmvstgt_rdma().
- ibmvstgt_probe(): changed the datatype of the variable "dma" from
unsigned * into const unsigned * such that a cast could be removed.
- Fixed all compiler and sparse warnings (C=2 CF=-D__CHECK_ENDIAN__).
Changes in libsrp compared to kernel 2.6.36:
- Renamed vscsis_data_length() into srp_data_length() and exported
this function.
- All error messages reported via printk() do now have prefix KERN_ERR.
- modified srp_target_alloc() and srp_target_free() such that the
driver-private data reflects whether or not target data has been allocated.
This change was necessary to avoid that ibmvstgt_remove() triggers a
NULL-pointer dereference if ibmvstgt_probe() failed.
- srp_transfer_data(): All three return statements related to DMA mapping
failure do now return -ENOMEM instead of 0, -EIO and -ENOMEM.
- srp_direct_data(): Removed the ext_desc argument since not used.
- srp_direct_data() and srp_indirect_data(): Use DMA_TO/FROM_DEVICE
instead of DMA_BIDIRECTIONAL for the buffers mapped for transferring data
via DMA.
- struct srp_target: eliminated the information unit linked list and also the
V_FLYING flag since both were duplicating information managed by the SCST
core.
- Fixed all compiler and sparse warnings (C=2 CF=-D__CHECK_ENDIAN__).
Tests performed on a backport to kernel version 2.6.18 of this driver with a
Linux initiator system:
- Verified that the kernel module ibmvstgt loads and initializes successfully
and also that the client connects after loading.
- Verified that all virtual disks configured in scst_vdisk were discovered by
the client after rescanning the SCSI bus.
- Verified that after unloading and reloading ibmvstgt and after client
recovery that the initiator devices were functioning normally.
- Verified that after a client reboot ibmvscsic reconnected with the target
and that the target devices were again usable.
- Performed IO stress testing on the device.
- Verified that SCSI task abortion works correctly.
- Performed basic I/O performance testing. With a RAM disk as target linear
direct I/O throughput was above 2 GB/s and a random I/O test resulted in
about 30000 IOPS for all block sizes between 512 bytes and 16 KB.
Both initiator and target were dual core POWER6 LPAR systems.
Note: ibmvstgt is the only user of libsrp.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Fujita Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Brian King <brking@linux.vnet.ibm.com>
Cc: Robert Jennings <rcj@linux.vnet.ibm.com>
EOF
fi
for f in \
drivers/scsi/ibmvscsi/ibmvstgt.c \
drivers/scsi/libsrp.c \
include/scsi/libsrp.h \
include/scsi/srp.h
do
patch="ibmvstgt/in-tree-patches/${kernel_version}/$(basename $f).patch"
if [ -e "${patch}" ]; then
add_patch "${patch}" $f
fi
done
add_file "ibmvstgt/README.sysfs" "Documentation/powerpc/ibmvstgt.txt"
fi
} \
| process_patch "scst_18_ibmvstgt.diff"
{
( cd ibmvstgt && ./generate-in-tree-patches "${kernel_version}" )
if [ -e "ibmvstgt/in-tree-patches/${kernel_version}" ]; then
if [ "${multiple_patches}" = "true" ]; then
cat <<EOF
[SCSI] tgt: Removal
Because of the conversion of the ibmvstgt driver from tgt to SCST, and because
the ibmvstgt driver was the only user of scsi_tgt, the scsi_tgt kernel module,
the CONFIG_SCSI_TGT, CONFIG_SCSI_SRP_TGT_ATTRS and CONFIG_SCSI_FC_TGT_ATTRS
kbuild variable, the scsi_host_template member variables transfer_response,
supportedmode and active_mode and the constants MODE_UNKNOWN, MODE_INITIATOR
and MODE_TARGET are no longer needed.
Note: this patch applies cleanly on a 2.6.35 kernel tree. The patch tool
however complains about the defconfig changes when trying to apply this patch
on a 2.6.36 kernel tree.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
EOF
fi
for f in \
arch/arm/configs/at572d940hfek_defconfig \
arch/arm/configs/cam60_defconfig \
arch/arm/configs/s3c2410_defconfig \
arch/m68k/configs/amiga_defconfig \
arch/m68k/configs/apollo_defconfig \
arch/m68k/configs/atari_defconfig \
arch/m68k/configs/bvme6000_defconfig \
arch/m68k/configs/hp300_defconfig \
arch/m68k/configs/mac_defconfig \
arch/m68k/configs/multi_defconfig \
arch/m68k/configs/mvme147_defconfig \
arch/m68k/configs/mvme16x_defconfig \
arch/m68k/configs/q40_defconfig \
arch/m68k/configs/sun3_defconfig \
arch/m68k/configs/sun3x_defconfig \
arch/mips/configs/bcm47xx_defconfig \
arch/mips/configs/decstation_defconfig \
arch/mips/configs/ip22_defconfig \
arch/mips/configs/ip27_defconfig \
arch/mips/configs/ip32_defconfig \
arch/mips/configs/jazz_defconfig \
arch/mips/configs/malta_defconfig \
arch/mips/configs/markeins_defconfig \
arch/mips/configs/pnx8550-jbs_defconfig \
arch/mips/configs/pnx8550-stb810_defconfig \
arch/mips/configs/rm200_defconfig \
arch/mips/configs/tb0226_defconfig \
arch/mips/configs/tb0287_defconfig \
arch/powerpc/configs/52xx/motionpro_defconfig \
arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig \
arch/powerpc/configs/mpc5200_defconfig \
drivers/scsi/Kconfig \
drivers/scsi/Makefile \
drivers/scsi/hosts.c \
drivers/scsi/scsi_sysfs.c \
drivers/scsi/scsi_tgt_if.c \
drivers/scsi/scsi_tgt_lib.c \
drivers/scsi/scsi_tgt_priv.h \
drivers/scsi/scsi_transport_fc.c \
drivers/scsi/scsi_transport_fc_internal.h \
drivers/scsi/scsi_transport_srp.c \
drivers/scsi/scsi_transport_srp_internal.h \
include/scsi/scsi_host.h \
include/scsi/scsi_tgt.h \
include/scsi/scsi_tgt_if.h
do
add_patch "ibmvstgt/in-tree-patches/${kernel_version}/$(basename $f).patch" $f
done
fi
} \
| process_patch "scst_19_scsi_tgt.diff"

View File

@@ -55,7 +55,7 @@
########################
function usage {
echo "Usage: $0 [-c <dir>] [-d <dir>] [-f] [-h] [-j <jobs>] [-q] <kver1> <kver2> ..."
echo "Usage: $0 [-c <dir>] [-d <dir>] [-f] [-h] [-j <jobs>] [-p <patchdir>] [-q] <kver1> <kver2> ..."
echo " -c - cache directory for Linux kernel tarballs."
echo " -d - directory for temporary regression test files."
echo " -h - display this help information."
@@ -152,6 +152,27 @@ See also http://lkml.org/lkml/2009/9/26/51
#define kmemcheck_annotate_variable(var) \
do { \
EOF
fi
if [ "$1" = 2.6.32 -o "${1#2.6.32.}" != "$1" -o "$1" = "2.6.33" \
-o "${1#2.6.33.}" != "$1" ]
then
cd "../linux-$1" || return $?
patch -f -s -p1 <<'EOF'
Get rid of sparse errors on sk_buff.protocol.
--- linux/include/linux/skbuff-orig.h 2010-12-07 13:40:51.000000000 -0500
+++ linux/include/linux/skbuff.h 2010-12-07 13:41:05.000000000 -0500
@@ -349,8 +349,8 @@ struct sk_buff {
ipvs_property:1,
peeked:1,
nf_trace:1;
- __be16 protocol:16;
kmemcheck_bitfield_end(flags1);
+ __be16 protocol;
void (*destructor)(struct sk_buff *skb);
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
EOF
fi
)
@@ -271,7 +292,9 @@ function download_kernel {
download_file "${kernel_mirror}/linux-$(kernel_version $1).tar.bz2" \
|| return $?
if [ "${plevel}" != "" ]; then
download_file "${kernel_mirror}/patch-$1.bz2" || return $?
download_file "${kernel_mirror}/patch-$1.bz2" \
|| download_file "${kernel_longterm}/v$(kernel_version $1)/patch-$1.bz2" \
|| return $?
fi
)
}
@@ -283,21 +306,17 @@ function generate_kernel_patch {
local kver="$(kernel_version $1)"
local patchfile="${outputdir}/scst-$1-kernel.patch"
local patchfile_m="${outputdir}/scst-$1-kernel-matching-line-numbers.patch"
local driver_options=""
SIGNED_OFF_BY="..." \
scripts/generate-kernel-patch \
$([ "${scst_local}" = "true" ] && echo "-l") \
$([ "${mpt_scst}" = "true" ] && echo "-m") \
$([ "${qla2x00t}" = "true" ] && echo "-q") \
$2 $1 > "${patchfile}"
driver_options="$([ "${scst_local}" = "true" ] && echo "-l") \
$([ "${mpt_scst}" = "true" ] && echo "-m") \
$([ "${qla2x00t}" = "true" ] && echo "-q")"
SIGNED_OFF_BY="..." \
scripts/generate-kernel-patch \
-n \
$([ "${scst_local}" = "true" ] && echo "-l") \
$([ "${mpt_scst}" = "true" ] && echo "-m") \
$([ "${qla2x00t}" = "true" ] && echo "-q") \
$2 $1 > "${patchfile_m}"
scripts/generate-kernel-patch ${driver_options} $2 $1 > "${patchfile}"
scripts/generate-kernel-patch ${driver_options} -n $2 $1 > "${patchfile_m}"
scripts/generate-kernel-patch ${driver_options} -p "${outputdir}/${patchdir}" $2 $1
}
# Run checkpatch on the generated kernel patch. Assumes that there is a
@@ -309,11 +328,22 @@ function run_checkpatch {
local outputfile="${outputdir}/checkpatch-$1-output.txt"
local patchfile="${outputdir}/scst-$1-kernel.patch"
if [ -e "${outputdir}/linux-$1/scripts/checkpatch.pl" ]
then
echo "Running checkpatch on the SCST kernel patch ..."
( cd "${outputdir}/linux-$1" \
&& scripts/checkpatch.pl - < "${patchfile}" &> "${outputfile}")
if [ -e "${outputdir}/linux-$1/scripts/checkpatch.pl" ]; then
if [ "${multiple_patches}" = "false" ]; then
echo "Running checkpatch on the SCST kernel patch ..."
( cd "${outputdir}/linux-$1" \
&& scripts/checkpatch.pl --no-tree --no-signoff - < "${patchfile}" &> "${outputfile}")
else
echo "Running checkpatch on the SCST kernel patches ..."
rm -f "${outputfile}"
( cd "${outputdir}/linux-$1" \
&& for p in "${outputdir}/${patchdir}"/*
do
echo "==== $p" >>"${outputfile}"
scripts/checkpatch.pl --no-tree --no-signoff - < "$p" >> "${outputfile}" 2>&1
done
)
fi
local errors=$(grep -c '^ERROR' "${outputfile}")
local warnings=$(grep -c '^WARNING' "${outputfile}")
echo "${errors} errors / ${warnings} warnings."
@@ -325,14 +355,33 @@ function run_checkpatch {
}
function patch_and_configure_kernel {
local kver="$(kernel_version $1)"
local patchfile="${outputdir}/scst-$1-kernel-matching-line-numbers.patch"
local patchoutput="${outputdir}/patch-command-output-$1.txt"
echo "Patching and configuring kernel ..."
(
cd "${outputdir}/linux-$1" \
&& patch -p1 -f -s <"${patchfile}" \
>"${outputdir}/patch-command-output-$1.txt" \
&& make -s allmodconfig &>/dev/null \
local srcdir="$PWD"
cd "${outputdir}/linux-$1" \
&& if [ "${multiple_patches}" = "false" ]; then
patch -p1 -f -s <"${patchfile}" >"${patchoutput}"
else
rm -f "${patchoutput}"
for p in "${outputdir}/${patchdir}"/*
do
echo "==== $p" >>"${patchoutput}"
patch -p1 -f -s <"${p}" >>"${patchoutput}" 2>&1
done
fi \
&& if [ -e $srcdir/srpt/patches/kernel-${kver}-pre-cflags.patch ]; then
echo "$srcdir/srpt/patches/kernel-${kver}-pre-cflags.patch ..." \
>>"${patchoutput}"
patch -p1 -f -s <$srcdir/srpt/patches/kernel-${kver}-pre-cflags.patch \
>>"${patchoutput}";
else
echo "srpt/patches/kernel-${kver}-pre-cflags.patch not found."; \
fi \
&& make -s allmodconfig &>"${outputdir}/make-config-output.txt" \
&& sed -i.tmp 's/^CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y$/CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=n/' .config \
&& for c in CONFIG_BINARY_PRINTF CONFIG_BLK_DEV_IO_TRACE CONFIG_BRANCH_PROFILE_NONE CONFIG_CONTEXT_SWITCH_TRACER CONFIG_DYNAMIC_FTRACE CONFIG_EVENT_TRACE_TEST_SYSCALLS CONFIG_EVENT_TRACING CONFIG_FTRACE CONFIG_FTRACE_MCOUNT_RECORD CONFIG_FTRACE_NMI_ENTER CONFIG_FTRACE_SELFTEST CONFIG_FTRACE_STARTUP_TEST CONFIG_FTRACE_SYSCALLS CONFIG_FUNCTION_GRAPH_TRACER CONFIG_FUNCTION_PROFILER CONFIG_FUNCTION_TRACER CONFIG_GENERIC_TRACER CONFIG_HAVE_FTRACE_NMI_ENTER CONFIG_IRQSOFF_TRACER CONFIG_IWLWIFI_DEVICE_TRACING CONFIG_IWM_TRACING CONFIG_KVM_MMU_AUDIT CONFIG_MAC80211_DRIVER_API_TRACER CONFIG_MMIOTRACE CONFIG_NET_DROP_MONITOR CONFIG_NOP_TRACER CONFIG_SCHED_TRACER CONFIG_STACK_TRACER CONFIG_TRACEPOINTS CONFIG_TRACER_MAX_TRACE CONFIG_TRACING; do sed -i.tmp "s/^$c=y\$/$c=n/" .config; done \
&& make -s oldconfig &>/dev/null
@@ -383,17 +432,21 @@ function compile_kernel {
# For more information about endianness annotations, see also
# http://lwn.net/Articles/205624/.
function run_sparse {
local k="$1"
local kver="$(kernel_version $1)"
local plevel="$(patchlevel $1)"
local outputfile="${outputdir}/sparse-$1-output.txt"
local subdir="$2"
shift
shift
echo "Running sparse on the patched kernel ..."
(
cd "${outputdir}/linux-$1" \
echo "Running sparse on the patched kernel in ${subdir} $@ ..."
(
cd "${outputdir}/linux-$k" \
&& make -s prepare \
&& make -s scripts \
&& LC_ALL=C make -k C=2 CF=-D__CHECK_ENDIAN__ M="${subdir}"
&& if grep -q '^CONFIG_PPC=y$' .config; then LC_ALL=C make -k M=arch/powerpc/lib; fi \
&& LC_ALL=C make -k C=2 CF=-D__CHECK_ENDIAN__ M="${subdir}" "$@"
) &> "${outputfile}"
local errors=$(grep -c ' error:' "${outputfile}")
local warnings=$(grep -c ' warning:' "${outputfile}")
@@ -492,18 +545,21 @@ fi
kernel_sources="$HOME/software/downloads"
# URL for downloading kernel tarballs and kernel patches.
kernel_mirror="ftp://ftp.eu.kernel.org/pub/linux/kernel/v2.6"
kernel_longterm="http://www.kernel.org/pub/linux/kernel/v2.6/longterm"
kernel_versions=""
# Directory in which the regression test output files will be stored. Must be
# an absolute path.
outputdir="${PWD}/regression-test-output-$(date +%Y-%m-%d_%Hh%Mm%Ss)"
# Driver configuration.
mpt_scst="false"
multiple_patches="false"
qla2x00t="false"
remove_temporary_files_at_end="false"
run_local_compilation="true"
scst_local="true"
quiet_download="false"
set -- $(/usr/bin/getopt "c:d:j:hkq" "$@")
set -- $(/usr/bin/getopt "c:d:j:hklpq" "$@")
while [ "$1" != "${1#-}" ]
do
case "$1" in
@@ -512,6 +568,8 @@ do
'-h') usage; exit 1;;
'-j') export MAKEFLAGS="-j$2"; shift; shift;;
'-k') remove_temporary_files_at_end="true"; shift;;
'-l') run_local_compilation="false"; shift;;
'-p') multiple_patches="true"; shift;;
'-q') quiet_download="true"; shift;;
'--') shift;;
*) usage; exit 1;;
@@ -552,10 +610,12 @@ if ! mkdir -p "${outputdir}"; then
fi
test_scst_tree_patches || exit $?
compile_scst_unpatched || exit $?
compile_scst_patched debug2release || exit $?
compile_scst_patched debug2perf || exit $?
compile_scst_patched enable_proc || exit $?
if [ "${run_local_compilation}" = "true" ]; then
compile_scst_unpatched || exit $?
compile_scst_patched debug2release || exit $?
compile_scst_patched debug2perf || exit $?
compile_scst_patched enable_proc || exit $?
fi
first_iteration="true"
for kv in ${kernel_versions}
@@ -566,8 +626,10 @@ do
full_check="false"
generate_kernel_patch_options=""
ibmvio="false"
run_checkpatch="true"
run_sparse="true"
global_multiple_patches="${multiple_patches}"
while [ "${kv%-?}" != "${kv}" -o "${kv%-??}" != "${kv}" ]; do
kv_without_opt="${kv%-?}"
if [ "${kv_without_opt}" = "${kv}" ]; then
@@ -576,13 +638,16 @@ do
kopt="${kv#${kv_without_opt}}"
case "${kopt}" in
'-f') full_check="true";;
'-i') ibmvio="true";;
'-nc') run_checkpatch="false";;
'-ns') run_sparse="false";;
'-u') generate_kernel_patch_options="-u";;
'-p') multiple_patches="true";;
*) echo "Error: unknown option ${kopt}."; exit 1;;
esac
kv="${kv_without_opt}"
done
patchdir="patchdir-${kv}"
k="${kv}"
download_kernel $k || continue
@@ -594,6 +659,18 @@ do
patch_and_configure_kernel $k
if [ "${run_sparse}" = "true" ]; then
run_sparse $k drivers/scst
mv ${outputdir}/sparse-$k-output.txt ${outputdir}/sparse-$k-scst-output.txt
if [ "${ibmvio}" = "true" ]; then
run_sparse $k drivers/scsi libsrp.ko scsi_sysfs.ko \
scsi_transport_fc.ko scsi_transport_srp.ko
mv ${outputdir}/sparse-$k-output.txt \
${outputdir}/sparse-$k-scsi-output.txt
if [ $(uname -m) = "ppc32" -o $(uname -m) = "ppc64" ]; then
run_sparse $k drivers/scsi/ibmvscsi ibmvstgt.ko
mv ${outputdir}/sparse-$k-output.txt \
${outputdir}/sparse-$k-ibmvstgt-output.txt
fi
fi
fi
compile_kernel $k drivers/scst
if [ "${full_check}" = "true" ]; then
@@ -607,4 +684,6 @@ do
rm -rf "${outputdir}"
mkdir -p "${outputdir}"
fi
multiple_patches="${global_multiple_patches}"
done

View File

@@ -30,7 +30,7 @@
# Convert a kernel version in the x.y.z format into numeric form, just like
# the KERNEL_VERSION() macro.
function version_code(kver) {
function version_code(kver, array) {
match(kver, "([0-9]+).([0-9]+).([0-9]+)", array)
return 65536*array[1] + 256*array[2] + array[3]
}
@@ -41,16 +41,16 @@ function version_code(kver) {
# Note: the order in which the substitutions appear below is important --
# it is the same order as the order of operators in C.
function evaluate(stmnt) {
function evaluate(stmnt, pattern, arg, op, result) {
if (debug)
printf "/* debug specialize-patch: (a) %s */\n", stmnt
# Remove C-style comments.
gsub(" *\\/\\*[^*]*\\*\\/ *", "", stmnt)
gsub("[ ]*\\/\\*[^*]*\\*\\/[ ]*", "", stmnt)
# Remove the spaces before the #-sign.
gsub("^+ *# *", "+#", stmnt)
gsub("^+[ ]*#[ ]*", "+#", stmnt)
if (match(stmnt, "^+#ifdef (.*)$", arg))
{
@@ -105,35 +105,33 @@ function evaluate(stmnt) {
if (SCSI_EXEC_REQ_FIFO_DEFINED != "")
{
gsub("defined *SCSI_EXEC_REQ_FIFO_DEFINED",
gsub("defined [ ]*SCSI_EXEC_REQ_FIFO_DEFINED",
SCSI_EXEC_REQ_FIFO_DEFINED, stmnt)
gsub("defined *\\( *SCSI_EXEC_REQ_FIFO_DEFINED *\\)",
gsub("defined[ ]*\\([ ]*SCSI_EXEC_REQ_FIFO_DEFINED[ ]*\\)",
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 [ ]*SCST_IO_CONTEXT", SCST_IO_CONTEXT, stmnt)
gsub("defined[ ]*\\([ ]*SCST_IO_CONTEXT[ ]*\\)", 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 [ ]*GENERATING_UPSTREAM_PATCH", 1, stmnt)
gsub("defined[ ]*\\([ ]*GENERATING_UPSTREAM_PATCH[ ]*\\)", 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 [ ]*CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION", 0, stmnt)
gsub("defined[ ]*\\([ ]*CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION[ ]*\\)", 0, stmnt)
}
if (config_scst_proc_undefined)
{
gsub("defined *CONFIG_SCST_PROC", 0, stmnt)
gsub("defined *\\( *CONFIG_SCST_PROC *\\)", 0, stmnt)
}
gsub("defined [ ]*CONFIG_SCST_PROC", !config_scst_proc_undefined, stmnt)
gsub("defined[ ]*\\([ ]*CONFIG_SCST_PROC[ ]*\\)", !config_scst_proc_undefined,
stmnt)
if (debug)
printf "/* debug specialize-patch: (b) %s */\n", stmnt
@@ -142,19 +140,19 @@ function evaluate(stmnt) {
{
last_stmnt = stmnt
pattern = "! *([0-9]+)"
pattern = "![ ]*([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\\([ ]*([0-9]+)[ ]*,[ ]*([0-9]+)[ ]*,[ ]*([0-9]+)[ ]*\\)"
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]+)[ ]*(\\*|/)[ ]*(-*[0-9]+)"
while (match(stmnt, pattern, op) != 0)
{
result="error"
@@ -163,7 +161,7 @@ function evaluate(stmnt) {
sub(pattern, result, stmnt)
}
pattern="(-*[0-9]+) *(\\+|-) *(-*[0-9]+)"
pattern="(-*[0-9]+)[ ]*(\\+|-)[ ]*(-*[0-9]+)"
while (match(stmnt, pattern, op) != 0)
{
result="error"
@@ -172,7 +170,7 @@ function evaluate(stmnt) {
sub(pattern, result, stmnt)
}
pattern="(-*[0-9]+) *(<|<=|>|>=|==|!=) *(-*[0-9]+)"
pattern="(-*[0-9]+)[ ]*(<|<=|>|>=|==|!=)[ ]*(-*[0-9]+)"
while (match(stmnt, pattern, op) != 0)
{
result="error"
@@ -185,24 +183,36 @@ function evaluate(stmnt) {
sub(pattern, result, stmnt)
}
pattern="(-*[0-9]+) *\\&\\& *(-*[0-9]+)"
pattern="(-*[0-9]+)[ ]*\\&\\&[ ]*(-*[0-9]+)"
while (match(stmnt, pattern, op) != 0)
{
sub(pattern, (op[1] != 0) && (op[2] != 0), stmnt)
}
pattern="([01]) *\\&\\& *(!* *defined *\\( *[A-Za-z_]* *\\))"
pattern="^+#if[ ]*([01])[ ]*\\&\\&[ ]*(!*[ ]*defined[ ]*\\([ ]*[A-Za-z_]*[ ]*\\))$"
while (match(stmnt, pattern, op) != 0)
{
sub(pattern, op[1] != 0 ? op[2] : op[1], stmnt)
stmnt = "+#if " (op[1] != 0 ? op[2] : op[1])
}
pattern="(-*[0-9]+) *\\|\\| *(-*[0-9]+)"
pattern="(-*[0-9]+)[ ]*\\|\\|[ ]*(-*[0-9]+)"
while (match(stmnt, pattern, op) != 0)
{
sub(pattern, (op[1] != 0) || (op[2] != 0), stmnt)
}
pattern="^+#if[ ]*([01])[ ]*\\|\\|[ ]*(!*[ ]*defined[ ]*\\([ ]*[A-Za-z_]*[ ]*\\))$"
while (match(stmnt, pattern, op) != 0)
{
stmnt = "+#if " (op[1] == 0 ? op[2] : op[1])
}
pattern="\\(([01])[ ]*\\|\\|[ ]*(!*[ ]*defined[ ]*\\([ ]*[A-Za-z_]*[ ]*\\))\\)"
while (match(stmnt, pattern, op) != 0)
{
sub(pattern, op[1] == 0 ? op[2] : op[1], stmnt)
}
pattern="\\((-*[0-9]+)\\)"
while (match(stmnt, pattern, op) != 0)
{
@@ -220,14 +230,13 @@ function evaluate(stmnt) {
# Evaluate ! stmnt
function invert(stmnt) {
sub("^+#if ", "+#if ! ", stmnt)
return evaluate(stmnt)
return evaluate(gensub("^+#if (.*)$", "+#if ! (\\1)", "g", stmnt))
}
# Handle #if or #elif
function handle_if()
function handle_if(evaluated)
{
# Only act on preprocessor conditional expressions with regard to the Linux
# kernel version, and do not interpret other expressions.
@@ -257,40 +266,52 @@ function handle_if()
{
if_stmnt[if_nesting_level] = evaluated
any_section_output[if_nesting_level] = 0
decision[if_nesting_level] = evaluated
inv_decision[if_nesting_level] = evaluate(sprintf("+#if ! %s", substr(evaluated, 6)))
if (debug)
printf "/* debug specialize-patch: (f) %s / %s */\n", \
decision[if_nesting_level], inv_decision[if_nesting_level]
}
else
{
sub("^+#elif ",
sprintf("+#if ! %d \\&\\& ", decision[if_nesting_level]),
sprintf("+#if %s \\&\\& ", substr(inv_decision[if_nesting_level], 6)),
evaluated)
if (debug)
printf "/* debug specialize-patch: (e) %s */\n", evaluated
evaluated = evaluate(evaluated)
decision[if_nesting_level] = evaluated
inv_decision[if_nesting_level] \
= evaluate(sprintf("+#if %s && ! %s", \
substr(inv_decision[if_nesting_level], 6), \
substr(evaluated, 6)))
if (debug)
printf "/* debug specialize-patch: (f) %s / %s */\n", \
decision[if_nesting_level], inv_decision[if_nesting_level]
}
decision[if_nesting_level] = evaluated
matching_if = if_stmnt[if_nesting_level]
return evaluated
}
# Decide whether or not to print the preprocessor statement $0.
function process_preprocessor_statement() {
last_if_nesting_level = if_nesting_level
orig_stmnt = $0
function process_preprocessor_statement(evaluated, condition) {
evaluated = evaluate($0)
condition = 1
delete_next_blank_line = 0
if (evaluated ~ "^+#if")
{
if_nesting_level++
handle_if()
evaluated = handle_if(evaluated)
}
else if (evaluated ~ "^+#elif")
{
handle_if()
evaluated = handle_if(evaluated)
}
else if (evaluated ~ "^+#else")
{
matching_if = if_stmnt[if_nesting_level]
decision[if_nesting_level] = invert(decision[if_nesting_level])
decision[if_nesting_level] = inv_decision[if_nesting_level]
}
else if (evaluated ~ "^+#endif")
{
@@ -318,13 +339,7 @@ function process_preprocessor_statement() {
|| (evaluated ~ "^+#define CONFIG_SCST_PROC$" \
&& config_scst_proc_undefined))
{
if (blank_deleted_code)
for (i = 0; i < input_line_count; i++)
line[lines++] = "+"
else
{
lines_deleted += input_line_count
}
discard = 1
delete_next_blank_line = 1
}
else if (output && (! condition || condition && matching_if !~ "^+#if [01]"))
@@ -334,22 +349,20 @@ function process_preprocessor_statement() {
}
else
{
if (blank_deleted_code)
for (i = 0; i < input_line_count; i++)
line[lines++] = "+"
else
lines_deleted += input_line_count
discard = 1
if (lines >= 1 && line[lines - 1] == "+")
delete_next_blank_line = 1
}
}
function reset_hunk_state_variables() {
lines = 0
lines_deleted = 0
output = 1
if_nesting_level = -1
delete_next_blank_line = 0
lines = 0
lines_less_added = 0
lines_less_deleted = 0
output = 1
if_nesting_level = -1
delete_next_blank_line = 0
h[0] = ""
}
function dump_lines() {
@@ -368,9 +381,9 @@ function dump_lines() {
if (first_modif >= 0)
{
if (h[0] != "")
printf "@@ -%d,%d +%d,%d @@%s\n",h[1],h[2],h[3],h[4]-lines_deleted,h[5]
printf "@@ -%d,%d +%d,%d @@%s\n",h[1],h[2]-lines_less_deleted,h[3],h[4]-lines_less_added,h[5]
for (i = 0; i < lines; i++)
print line[i]
print line[i]
}
}
@@ -397,15 +410,35 @@ BEGIN {
config_scst_proc_undefined = 0
# Variable initialization.
is_c_source = 0
reset_hunk_state_variables()
}
{
if (match($0, "^diff[ \t]+[^ \t]+[ \t]+[^ \t]+[ \t]+([^ \t]+)$", filename) \
|| match($0, "^\\+\\+\\+[ \t]+([^ \t]+)[ \t]+", filename))
{
# Start of new file.
dump_lines()
reset_hunk_state_variables()
is_c_source = match(filename[1], "\\.[ch]$") != 0
}
if (!is_c_source)
{
print
next
}
if (!config_scst_proc_undefined)
{
gsub("^+/\\* #define CONFIG_SCST_PROC \\*/$", "+#define CONFIG_SCST_PROC")
}
else
{
gsub("^+/\\* #define CONFIG_SCST_PROC \\*/$", "+")
}
input_line[0] = $0
input_line_count = 1
# Join continued lines before processing these.
@@ -419,6 +452,7 @@ BEGIN {
$0 = previous_line $0
}
discard = 0
# If the line currently being processed is a hunk header, print all lines
# that were stored in the array line[] since the last hunk header was read.
if (match($0, "^@@ -([0-9]*),([0-9]*) \\+([0-9]*),([0-9]*) @@(.*)$"))
@@ -430,13 +464,7 @@ BEGIN {
}
else if (delete_next_blank_line && match($0, "^+$"))
{
if (blank_deleted_code)
for (i = 0; i < input_line_count; i++)
line[lines++] = "+"
else
{
lines_deleted += input_line_count
}
discard = 1
delete_next_blank_line = 0
}
else
@@ -457,18 +485,31 @@ BEGIN {
}
else
{
# Discard the last read lines.
if (blank_deleted_code)
{
for (i = 0; i < input_line_count; i++)
line[lines++] = "+"
}
else
lines_deleted += input_line_count
discard = 1
if (lines >= 1 && line[lines-1] == "+")
delete_next_blank_line = 1
}
}
if (discard)
{
for (i = 0; i < input_line_count; i++)
{
if (blank_deleted_code)
{
if (input_line[i] ~ "^+")
line[lines++] = "+"
else
line[lines++] = input_line[i]
}
else
{
if (input_line[i] ~ "^+")
lines_less_added++
else if (input_line[i] ~ "^-")
lines_less_deleted++
}
}
}
}
END {