From 51e4ded159fd28941416f194ed88d906e37177e0 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Mar 2018 19:34:18 +0000 Subject: [PATCH 01/13] scst.spec, scstadmin.spec: Add support for Fedora git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7374 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst.spec.in | 12 +++++++++++- scstadmin/scstadmin.spec.in | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/scst.spec.in b/scst.spec.in index aeab505a0..8cb7e9295 100644 --- a/scst.spec.in +++ b/scst.spec.in @@ -48,7 +48,17 @@ %{echo:krpmver=%{krpmver} }} # kernel_devel_rpm: Name of the kernel development RPM. -%{?kernel_rpm:%define kernel_devel_rpm %{kernel_rpm}-devel} +%if 0%{?kernel_rpm:1} +%if %([ %{kernel_rpm} = kernel-core ]; echo $((1-$?))) +# Fedora +%define kernel_devel_rpm kernel-devel +%else +# Other Linux distros +%define kernel_devel_rpm %{kernel_rpm}-devel +%endif +%{echo:kernel_devel_rpm=%{kernel_devel_rpm} +} +%endif # Version of the RPM that is being built. %define rpm_version @rpm_version@ # Make command with or without flags. diff --git a/scstadmin/scstadmin.spec.in b/scstadmin/scstadmin.spec.in index 4c084d6dd..37a99eb6b 100644 --- a/scstadmin/scstadmin.spec.in +++ b/scstadmin/scstadmin.spec.in @@ -40,6 +40,8 @@ if test -n "$RPM_BUILD_ROOT" -a -d $RPM_BUILD_ROOT%perl_vendorarch/auto; then \ fi; \ rm -f $RPM_BUILD_ROOT%{perl_archlib}/perllocal.pod; set +x +%global debug_package %{nil} + %prep %setup -q From 2d9858d894b76168c9804f09f375f01d172709a6 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Mar 2018 19:34:55 +0000 Subject: [PATCH 02/13] scstadmin: Remove 'use Test' Since scstadmin doesn't use the Perl module 'Test', remove 'use Test'. See also trunk r6736. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7375 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scstadmin/scstadmin.sysfs/scstadmin | 1 - 1 file changed, 1 deletion(-) diff --git a/scstadmin/scstadmin.sysfs/scstadmin b/scstadmin/scstadmin.sysfs/scstadmin index 609021ca8..eb6c89347 100755 --- a/scstadmin/scstadmin.sysfs/scstadmin +++ b/scstadmin/scstadmin.sysfs/scstadmin @@ -246,7 +246,6 @@ use strict; use Cwd qw(abs_path); use File::Basename; use File::Spec; -use Test; BEGIN { my $site_lib = '%INSTALLSITELIB%'; From 5f1fd232aed775909720ce33c51c802256ca6766 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Mar 2018 19:35:13 +0000 Subject: [PATCH 03/13] scst*.spec: Set default attributes for directories git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7376 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst-dkms.spec.in | 4 ++-- scst.spec.in | 6 +++--- scstadmin/scstadmin.spec.in | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scst-dkms.spec.in b/scst-dkms.spec.in index 61b54f9a4..0230e30ab 100644 --- a/scst-dkms.spec.in +++ b/scst-dkms.spec.in @@ -218,7 +218,7 @@ dkms remove -m %{kmod_name} -v %{dkms_version} --rpm_safe_upgrade --all true %files -%defattr(-,root,root) +%defattr(-,root,root,0755) /usr/src/%{kmod_name}-%{dkms_version}/ %files userspace @@ -231,7 +231,7 @@ true %dir /var/lib/scst/vdev_mode_pages %files devel -%defattr(-,root,root) +%defattr(-,root,root,0755) %dir /usr/include/scst /usr/include/scst/Module.symvers /usr/include/scst/scst.h diff --git a/scst.spec.in b/scst.spec.in index 8cb7e9295..19b2cc624 100644 --- a/scst.spec.in +++ b/scst.spec.in @@ -173,7 +173,7 @@ rm -rf /usr/local/include/scst /sbin/depmod -a %{kversion} %files -%defattr(0644,root,root) +%defattr(0644,root,root,0755) /lib/modules/%{kversion}/extra/fcst.ko /lib/modules/%{kversion}/extra/ib_srpt.ko /lib/modules/%{kversion}/extra/iscsi-scst.ko @@ -192,7 +192,7 @@ rm -rf /usr/local/include/scst /lib/modules/%{kversion}/extra/dev_handlers/scst_tape.ko /lib/modules/%{kversion}/extra/dev_handlers/scst_user.ko /lib/modules/%{kversion}/extra/dev_handlers/scst_vdisk.ko -%defattr(-,root,root) +%defattr(-,root,root,0755) %{_mandir}/man5/iscsi-scstd.conf.5.gz %{_mandir}/man8/iscsi-scst-adm.8.gz %{_mandir}/man8/iscsi-scstd.8.gz @@ -202,7 +202,7 @@ rm -rf /usr/local/include/scst %dir /var/lib/scst/vdev_mode_pages %files devel -%defattr(-,root,root) +%defattr(-,root,root,0755) %dir /usr/include/scst /usr/include/scst/Module.symvers /usr/include/scst/backport.h diff --git a/scstadmin/scstadmin.spec.in b/scstadmin/scstadmin.spec.in index 37a99eb6b..a3c8afa67 100644 --- a/scstadmin/scstadmin.spec.in +++ b/scstadmin/scstadmin.spec.in @@ -67,7 +67,7 @@ rm -f /usr/local/man/man5/scst.5* rm -f /usr/local/man/man5/scst.conf.5* %files -%defattr(-,root,root) +%defattr(-,root,root,0755) %config(noreplace) /etc/default/scst /etc/init.d/scst %{_sbindir}/scstadmin From 1f7fdf5cbcdd33f985b30875f4b4de9a78e62039 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Mar 2018 19:35:38 +0000 Subject: [PATCH 04/13] Makefile, rpm: Pass ${KDIR} to scst.spec git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7377 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 9f664620d..7b6627354 100644 --- a/Makefile +++ b/Makefile @@ -452,6 +452,7 @@ scst-rpm: <$${name}.spec.in >$${name}.spec && \ MAKE="$(MAKE)" rpmbuild --define="%_topdir $${rpmtopdir}" \ $(if $(KVER),--define="%kversion $(KVER)") \ + $(if $(KDIR),--define="%kdir $(KDIR)") \ -ba $${name}.spec && \ rm -f $${name}-$(VERSION).tar.bz2 From 5e82471a69bbe5908471653e6635b54d0aabf371 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Mar 2018 19:36:01 +0000 Subject: [PATCH 05/13] scst.spec, scst-dkms.spec: Use version of running kernel if %{kdir} has not been set git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7378 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst-dkms.spec.in | 12 +----------- scst.spec.in | 12 +----------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/scst-dkms.spec.in b/scst-dkms.spec.in index 0230e30ab..e8d89372e 100644 --- a/scst-dkms.spec.in +++ b/scst-dkms.spec.in @@ -2,18 +2,8 @@ # kversion: Kernel version as it appears under /lib/modules. # The algorithm for setting the variable kversion is as follows: # - If the variable kversion has been set, use its value. -# - If an RPM with the name kernel-headers exists (RHEL / CentOS), use the -# version number of the kernel that package is based on. This provides the -# version number when building on a koji build server. # - Otherwise use the version number of the running kernel. -%{!?kversion:%define kversion %{expand:%%( - if rpm --quiet -q kernel-headers; then - rpm -q --qf '%%%%{version}-%%%%{release}.%%%%{arch}\\n' \\ - kernel-headers | head -n1; - else - uname -r; - fi - )}} +%{!?kversion:%define kversion %{expand:%%(uname -r)}} %{echo:kversion=%{kversion} } # kernel_rpm: Name of the kernel RPM if the kernel is available as an RPM. diff --git a/scst.spec.in b/scst.spec.in index 19b2cc624..4aec82b90 100644 --- a/scst.spec.in +++ b/scst.spec.in @@ -3,22 +3,12 @@ # The algorithm for setting the variable kversion is as follows: # - If the variable kversion has been set, use its value. # - If the variable kdir has been set, derive the kernel version from kdir. -# - If an RPM with the name kernel-headers exists (RHEL / CentOS), use the -# version number of the kernel that package is based on. This provides the -# version number when building on a koji build server. # - Otherwise use the version number of the running kernel. %{!?kversion: %{?kdir:%define kversion %{expand:%%( make -sC "%{kdir}" kernelversion | grep -v ^make)}} %{!?kdir: - %define kversion %{expand:%%( - if rpm --quiet -q kernel-headers; then - rpm -q --qf '%%%%{BUILDTIME} %%%%{version}-%%%%{release}.%%%%{arch}\\n' \\ - kernel-headers | sort | tail -n1 | { read a b; echo $b; }; - else - uname -r; - fi - )}}} + %define kversion %{expand:%%(uname -r)}}} %{echo:kversion=%{kversion} } # kernel_rpm: Name of the kernel RPM if the kernel is available as an RPM. From e5b215d0dc7178710cdb49efb8ff216ac5857747 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Mar 2018 19:36:15 +0000 Subject: [PATCH 06/13] scst-dkms.spec: Add /usr/include/scst/backport.h git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7379 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst-dkms.spec.in | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/scst-dkms.spec.in b/scst-dkms.spec.in index e8d89372e..63091cf15 100644 --- a/scst-dkms.spec.in +++ b/scst-dkms.spec.in @@ -223,13 +223,7 @@ true %files devel %defattr(-,root,root,0755) %dir /usr/include/scst -/usr/include/scst/Module.symvers -/usr/include/scst/scst.h -/usr/include/scst/scst_const.h -/usr/include/scst/scst_debug.h -/usr/include/scst/scst_itf_ver.h -/usr/include/scst/scst_sgv.h -/usr/include/scst/scst_user.h +/usr/include/scst/ %changelog * Wed May 6 2015 Bart Van Assche From fa5c8963f2967ba5e0fd595d917f655945d53977 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Mar 2018 19:36:31 +0000 Subject: [PATCH 07/13] scst.spec: Simplify this spec file git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7380 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst.spec.in | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/scst.spec.in b/scst.spec.in index 4aec82b90..e9289e773 100644 --- a/scst.spec.in +++ b/scst.spec.in @@ -194,14 +194,7 @@ rm -rf /usr/local/include/scst %files devel %defattr(-,root,root,0755) %dir /usr/include/scst -/usr/include/scst/Module.symvers -/usr/include/scst/backport.h -/usr/include/scst/scst.h -/usr/include/scst/scst_const.h -/usr/include/scst/scst_debug.h -/usr/include/scst/scst_itf_ver.h -/usr/include/scst/scst_sgv.h -/usr/include/scst/scst_user.h +/usr/include/scst/ %changelog * Wed May 6 2015 Bart Van Assche From d0e5b123ebecf2dbc2193c99c078c8c608052ee3 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Mar 2018 19:36:46 +0000 Subject: [PATCH 08/13] scripts/run-regression-tests: Also build scst-dkms-rpm git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7381 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/run-regression-tests | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/run-regression-tests b/scripts/run-regression-tests index 4deabe196..92e9eaaf1 100755 --- a/scripts/run-regression-tests +++ b/scripts/run-regression-tests @@ -97,14 +97,17 @@ function duplicate_scst_source_tree { } function make_rpm { - local outputfile="${outputdir}/make-rpm-output.txt" + local outputfile t - echo "Testing whether 'make rpm' works fine ..." - if make rpm > "${outputfile}" 2>&1; then - echo "OK" - else - echo "FAILED" - fi + for t in rpm scst-dkms-rpm; do + outputfile="${outputdir}/make-${t}-output.txt" + echo "Testing whether 'make ${t}' works fine ..." + if make ${t} > "${outputfile}" 2>&1; then + echo "OK" + else + echo "FAILED" + fi + done } function compile_scst { From 7201b2de5f8b80c06a64f9dadd9f258b3cd14fc1 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Mar 2018 19:37:03 +0000 Subject: [PATCH 09/13] scripts/run-regression-tests: Add "make dpkg" test git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7382 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/run-regression-tests | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/run-regression-tests b/scripts/run-regression-tests index 92e9eaaf1..43dc916c8 100755 --- a/scripts/run-regression-tests +++ b/scripts/run-regression-tests @@ -110,6 +110,18 @@ function make_rpm { done } +function make_dpkg { + local outputfile="${outputdir}/make-dpkg-output.txt" + + outputfile="${outputdir}/make-${t}-output.txt" + echo "Testing whether 'make dpkg' works fine ..." + if make dpkg > "${outputfile}" 2>&1; then + echo "OK" + else + echo "FAILED" + fi +} + function compile_scst { ( export KCFLAGS=-DCONFIG_SCST_MEASURE_LATENCY @@ -580,6 +592,9 @@ if [ "${run_local_compilation}" = "true" ]; then if type rpmbuild >/dev/null 2>&1; then make_rpm || exit $? fi + if type debuild >/dev/null 2>&1; then + make_dpkg || exit $? + fi fi first_iteration="true" From 258d4d67957b3ad6a2dffc47e54f579d7b6ad40d Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Mar 2018 19:37:21 +0000 Subject: [PATCH 10/13] scripts/run-regression-tests: Suppress shellcheck warnings git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7383 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/run-regression-tests | 163 +++++++++++++++++++---------------- 1 file changed, 89 insertions(+), 74 deletions(-) diff --git a/scripts/run-regression-tests b/scripts/run-regression-tests index 43dc916c8..53fe20e4f 100755 --- a/scripts/run-regression-tests +++ b/scripts/run-regression-tests @@ -54,6 +54,7 @@ # Function definitions # ######################## +# shellcheck source=./kernel-functions source $(dirname $0)/kernel-functions function usage { @@ -74,7 +75,7 @@ function test_scst_tree_patches { echo "Testing whether the SCST patches apply cleanly to the SCST tree ..." for p in *.patch srpt/patches/scst*.patch do - if [ -e "$p" ] && ! patch -p0 -f --dry-run -s <$p &>/dev/null; then + if [ -e "$p" ] && ! patch -p0 -f --dry-run -s <"$p" &>/dev/null; then echo "ERROR: patch $p does not apply cleanly." rc=1 fi @@ -128,9 +129,9 @@ function compile_scst { for p in scst scst_local iscsi-scst srpt qla2x00t $(if [ "${mpt_scst}" = "true" ]; then echo mpt; fi); do if [ "${p%qla2x00t}" != "$p" ]; then BUILD_2X_MODULE=y CONFIG_SCSI_QLA_FC=y CONFIG_SCSI_QLA2XXX_TARGET=y \ - make -C $p/qla2x00-target || return $? + make -C "$p/qla2x00-target" || return $? else - make -C $p || return $? + make -C "$p" || return $? fi done ) @@ -201,32 +202,33 @@ function compile_scst_patched { # Generate a kernel patch from the SCST source tree for kernel version $1 # and with generate-kernel-patch options $2. function generate_kernel_patch { - local scst_dir="${PWD}" - local kver="$(kernel_version $1)" + local kver local patchfile="${outputdir}/scst-$1-kernel.patch" local patchfile_m="${outputdir}/scst-$1-kernel-matching-line-numbers.patch" local driver_options="" - driver_options="-l \ - $([ "${mpt_scst}" = "true" ] && echo "-m") \ - $([ "${qla2x00t}" = "true" ] && echo "-q")" + kver="$(kernel_version "$1")" + driver_options=(-l) + [ "${mpt_scst}" = "true" ] && driver_options+=("-m") + [ "${qla2x00t}" = "true" ] && driver_options+=("-q") - "${scriptsdir}"/generate-kernel-patch ${driver_options} $2 $1 > "${patchfile}" + "${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" "$2" "$1" > "${patchfile}" - "${scriptsdir}"/generate-kernel-patch ${driver_options} -n $2 $1 > "${patchfile_m}" + "${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" -n "$2" "$1" > "${patchfile_m}" - "${scriptsdir}"/generate-kernel-patch ${driver_options} -p "${outputdir}/${patchdir}" $2 $1 + "${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" -p "${outputdir}/${patchdir}" "$2" "$1" } # Run checkpatch on the generated kernel patch. Assumes that there is a # vanilla kernel tree present in directory "${outputdir}/linux-$1", and leaves # this kernel tree clean. function run_checkpatch { - local kver="$(kernel_version $1)" - local plevel="$(patchlevel $1)" + local kver plevel errors warnings local outputfile="${outputdir}/checkpatch-$1-output.txt" local patchfile="${outputdir}/scst-$1-kernel.patch" + kver="$(kernel_version "$1")" + plevel="$(patchlevel "$1")" if [ -e "${outputdir}/linux-$1/scripts/checkpatch.pl" ]; then if [ "${multiple_patches}" = "false" ]; then echo "Running checkpatch on the SCST kernel patch ..." @@ -243,8 +245,8 @@ function run_checkpatch { done ) fi - local errors=$(grep -c '^ERROR' "${outputfile}") - local warnings=$(grep -c '^WARNING' "${outputfile}") + errors=$(grep -c '^ERROR' "${outputfile}") + warnings=$(grep -c '^WARNING' "${outputfile}") echo "${errors} errors / ${warnings} warnings." grep -E '^WARNING|^ERROR' "${outputfile}" | sort | @@ -258,7 +260,8 @@ function run_checkpatch { } function patch_and_configure_kernel { - local kver="$(kernel_version $1)" + local kver + kver="$(kernel_version "$1")" local patchfile="${outputdir}/scst-$1-kernel-matching-line-numbers.patch" local patchoutput="${outputdir}/patch-command-output-$1.txt" local disable=" \ @@ -305,7 +308,6 @@ CONFIG_X86_X32 \ disable="$disable CONFIG_IPV6" fi ( - local srcdir="$PWD" cd "${outputdir}/linux-$1" && if [ "${multiple_patches}" = "false" ]; then patch -p1 -f -s <"${patchfile}" >"${patchoutput}" @@ -325,8 +327,9 @@ CONFIG_X86_X32 \ # Patches and compiles a kernel tree. Assumes that there is a vanilla kernel # tree present in directory "${outputdir}/linux-$1". function compile_patched_kernel { - local kver="$(kernel_version $1)" - local plevel="$(patchlevel $1)" + local kver plevel + kver="$(kernel_version "$1")" + plevel="$(patchlevel "$1")" local outputfile="${outputdir}/kernel-$1-compilation-output.txt" echo "Compiling kernel $1 ..." @@ -342,8 +345,9 @@ function compile_patched_kernel { # Compile subdirectory $2 of the patched kernel tree linux-$1. function compile_kernel { - local kver="$(kernel_version $1)" - local plevel="$(patchlevel $1)" + local kver plevel + kver="$(kernel_version "$1")" + plevel="$(patchlevel "$1")" local outputfile="${outputdir}/compilation-$1-output.txt" local subdir="$2" @@ -354,13 +358,14 @@ function compile_kernel { && LC_ALL=C make -k M="${subdir}" ) &> "${outputfile}" then - local errors=$(grep -c ' error:' "${outputfile}") - local warnings=$(grep -c ' warning:' "${outputfile}") + local errors warnings + errors=$(grep -c ' error:' "${outputfile}") + warnings=$(grep -c ' warning:' "${outputfile}") echo "${errors} errors / ${warnings} warnings." else echo FAILED fi - cat "${outputfile}" | grep -E 'warning:|error:' | sort | uniq -c + grep -E 'warning:|error:' < "${outputfile}" | sort | uniq -c return 0 } @@ -370,14 +375,15 @@ function compile_kernel { # http://lwn.net/Articles/205624/. function run_sparse { local k="$1" - local kver="$(kernel_version $1)" - local plevel="$(patchlevel $1)" + local kver plevel + kver="$(kernel_version "$1")" + plevel="$(patchlevel "$1")" local outputfile="${outputdir}/sparse-$1-output.txt" local subdir="$2" shift shift - echo "Running sparse on the patched kernel in ${subdir} $@ ..." + echo "Running sparse on the patched kernel in ${subdir} $* ..." if (cd "${outputdir}/linux-$k" \ && make -s prepare \ && make -s scripts \ @@ -385,11 +391,11 @@ function run_sparse { && LC_ALL=C make -k C=2 CF="-D__CHECK_ENDIAN__ -DCONFIG_SPARSE_RCU_POINTER" M="${subdir}" "$@" ) &> "${outputfile}" then - local errors=$(grep -c ' error:' "${outputfile}") - local warnings=$(grep -c ' warning:' "${outputfile}") + local errors warnings + errors=$(grep -c ' error:' "${outputfile}") + warnings=$(grep -c ' warning:' "${outputfile}") echo "${errors} errors / ${warnings} warnings." - cat "${outputfile}" \ - | grep -E ' warning:| error:' \ + grep -E ' warning:| error:' < "${outputfile}" \ | sed -e 's/^[^:]*:[0-9:]* //' \ -e "s/context imbalance in '[^']*':/context imbalance in :/g" \ -e "s/context problem in '[^']*': '[^']*'/context problem in : /g" \ @@ -406,15 +412,16 @@ function run_sparse { function run_smatch { local k="$1" - local kver="$(kernel_version $1)" - local plevel="$(patchlevel $1)" + local kver plevel + kver="$(kernel_version "$1")" + plevel="$(patchlevel "$1")" local outputfile="${outputdir}/smatch-$1-output.txt" local subdir="$2" local disable="CONFIG_DYNAMIC_DEBUG" shift shift - echo "Running smatch on the patched kernel in ${subdir} $@ ..." + echo "Running smatch on the patched kernel in ${subdir} $* ..." if (cd "${outputdir}/linux-$k" && for c in $disable; do sed -i.tmp "s/^$c=y\$/$c=n/" .config; done && make -s oldconfig "${outputfile}" then - local errors=$(grep -c ' error:' "${outputfile}") - local warnings=$(grep -c ' warning:' "${outputfile}") + local errors warnings + errors=$(grep -c ' error:' "${outputfile}") + warnings=$(grep -c ' warning:' "${outputfile}") echo "${errors} errors / ${warnings} warnings." - cat "${outputfile}" | - grep -E ' info:| warning:| error:' | + grep -E ' info:| warning:| error:' < "${outputfile}" | sed 's/^\([^:]*\):[0-9:]* /\1: /;s/\((see line \)[0-9]*\()\)/\1...\2/' | sort | uniq -c @@ -440,8 +447,9 @@ function run_smatch { } function run_checkstack { - local kver="$(kernel_version $1)" - local plevel="$(patchlevel $1)" + local kver plevel + kver="$(kernel_version "$1")" + plevel="$(patchlevel "$1")" local outputfile="${outputdir}/checkstack-$1-output.txt" echo "Running checkstack on the patched $1 kernel ..." @@ -456,8 +464,9 @@ function run_checkstack { } function run_namespacecheck { - local kver="$(kernel_version $1)" - local plevel="$(patchlevel $1)" + local kver plevel + kver="$(kernel_version "$1")" + plevel="$(patchlevel "$1")" local outputfile="${outputdir}/namespacecheck-$1-output.txt" echo "Running namespacecheck on the patched $1 kernel ..." @@ -472,8 +481,9 @@ function run_namespacecheck { } function run_headers_check { - local kver="$(kernel_version $1)" - local plevel="$(patchlevel $1)" + local kver plevel + kver="$(kernel_version "$1")" + plevel="$(patchlevel "$1")" local outputfile="${outputdir}/headers_check-$1-output.txt" echo "Running headers check on the patched $1 kernel ..." @@ -483,15 +493,17 @@ function run_headers_check { && make -s scripts \ && LC_ALL=C make -k headers_check ) &> "${outputfile}" - local errors=$(grep -c '^[^ ]' "${outputfile}") + local errors + errors=$(grep -c '^[^ ]' "${outputfile}") echo "${errors} errors." grep '^[^ ]' "${outputfile}" | sed 's/.*: //' | sort | uniq -c return 0 } function run_make_htmldocs { - local kver="$(kernel_version $1)" - local plevel="$(patchlevel $1)" + local kver plevel + kver="$(kernel_version "$1")" + plevel="$(patchlevel "$1")" local outputfile="${outputdir}/htmldocs-$1-output.txt" echo "Generating HTML documentation for the patched $1 kernel ..." @@ -512,12 +524,12 @@ function run_make_htmldocs { export LC_ALL=C -if [ ! -e scst -o ! -e iscsi-scst -o ! -e srpt ]; then +if [ ! -e scst ] || [ ! -e iscsi-scst ] || [ ! -e srpt ]; then echo "Please run this script from inside the SCST subversion source tree." exit 1 fi -scriptsdir="$(dirname $0)" +scriptsdir="$(dirname "$0")" if [ "${scriptsdir:0:1}" != "/" ]; then scriptsdir="$PWD/${scriptsdir}" fi @@ -535,7 +547,10 @@ remove_temporary_files_at_end="false" run_local_compilation="true" quiet_download="false" -set -- $(/usr/bin/getopt "c:d:j:hklpq" "$@") +{ + # shellcheck disable=SC2046 + set -- $(/usr/bin/getopt "c:d:j:hklpq" "$@") +} while [ "$1" != "${1#-}" ] do case "$1" in @@ -597,7 +612,6 @@ if [ "${run_local_compilation}" = "true" ]; then fi fi -first_iteration="true" for kv in ${kernel_versions} do echo "==========================" @@ -612,7 +626,7 @@ do run_smatch="true" ipv6="true" global_multiple_patches="${multiple_patches}" - while [ "${kv%-?}" != "${kv}" -o "${kv%-??}" != "${kv}" ]; do + while [ "${kv%-?}" != "${kv}" ] || [ "${kv%-??}" != "${kv}" ]; do kv_without_opt="${kv%-?}" if [ "${kv_without_opt}" = "${kv}" ]; then kv_without_opt="${kv%-??}" @@ -634,12 +648,12 @@ do patchdir="patchdir-${kv}" k="${kv}" - download_kernel $k || continue - generate_kernel_patch $k "${generate_kernel_patch_options}" || continue + download_kernel "$k" || continue + generate_kernel_patch "$k" "${generate_kernel_patch_options}" || continue ( cd "${outputdir}" && - extract_kernel_tree $k && - cd linux-$k/include/linux && + extract_kernel_tree "$k" && + cd "linux-$k/include/linux" && if [ ! -e compiler-gcc6.h ]; then for f in compiler-gcc5.h compiler-gcc4.h; do if [ -e "$f" ]; then @@ -651,34 +665,35 @@ do ) || continue if [ "${run_checkpatch}" = "true" ]; then - run_checkpatch $k + run_checkpatch "$k" fi - patch_and_configure_kernel $k + 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 + 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 \ + 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 + mv "${outputdir}/sparse-$k-output.txt" \ + "${outputdir}/sparse-$k-scsi-output.txt" + if [ "$(uname -m)" = "ppc32" ] || [ "$(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 if [ "${run_smatch}" = "true" ]; then - run_smatch $k drivers/scst + run_smatch "$k" drivers/scst fi - compile_kernel $k drivers/scst + compile_kernel "$k" drivers/scst if [ "${full_check}" = "true" ]; then - run_headers_check $k - compile_patched_kernel $k - run_checkstack $k - run_namespacecheck $k - run_make_htmldocs $k + run_headers_check "$k" + compile_patched_kernel "$k" + run_checkstack "$k" + run_namespacecheck "$k" + run_make_htmldocs "$k" fi if [ "${remove_temporary_files_at_end}" = "true" ]; then rm -rf "${outputdir}" From 0c5875eac5ef7efd67652af9b67b1e180a5fcde4 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Mar 2018 19:37:36 +0000 Subject: [PATCH 11/13] scripts/specialize-patch: Add support for HAVE_STRUCT_SRP_LOGIN_REQ_RDMA git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7384 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/specialize-patch | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/specialize-patch b/scripts/specialize-patch index bf4945a43..1c03ec181 100755 --- a/scripts/specialize-patch +++ b/scripts/specialize-patch @@ -93,6 +93,9 @@ function evaluate(stmnt, pattern, arg, op, result) { gsub("HAVE_RDMA_DESTROY_AH", "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0))", stmnt) + gsub("HAVE_STRUCT_SRP_LOGIN_REQ_RDMA", + "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0))", stmnt) + gsub("defined\\(USE_PRE_440_WR_STRUCTURE\\)", "(LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0))", stmnt) @@ -341,6 +344,7 @@ function handle_if(evaluated) || $0 ~ "HAVE_IB_QUERY_DEVICE" \ || $0 ~ "HAVE_IB_SET_CPI_RESP_TIME" \ || $0 ~ "HAVE_RDMA_DESTROY_AH" \ + || $0 ~ "HAVE_STRUCT_SRP_LOGIN_REQ_RDMA" \ || $0 ~ "IB_CLIENT_REMOVE_TAKES_TWO_ARGS" \ || $0 ~ "IB_CM_LISTEN_TAKES_FOURTH_ARG" \ || $0 ~ "IB_CREATE_CQ_HAS_INIT_ATTR" \ From a1b4c9e2fc839fe5e2f4358ed329b6e3be2efb2f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Mar 2018 19:38:02 +0000 Subject: [PATCH 12/13] scst_lib: Port task management debug code to kernel v4.15 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7385 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 4 +++- scst/src/scst_lib.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index 526976022..0576e0226 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -708,7 +708,9 @@ struct t10_pi_tuple { #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) #undef DEFINE_TIMER #define DEFINE_TIMER(_name, _function) \ - struct timer_list _name = __TIMER_INITIALIZER(_function, 0, 0, 0) + struct timer_list _name = __TIMER_INITIALIZER( \ + (void (*)(unsigned long))(_function), \ + (unsigned long)&(_name), 0, 0) #endif /* */ diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 284195d72..ff241e2b9 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -15368,7 +15368,7 @@ EXPORT_SYMBOL_GPL(scst_random); #define INIT_TM_DBG_STATE TM_DBG_STATE_ABORT -static void tm_dbg_timer_fn(unsigned long arg); +static void tm_dbg_timer_fn(struct timer_list *timer); static DEFINE_SPINLOCK(scst_tm_dbg_lock); /* All serialized by scst_tm_dbg_lock */ @@ -15422,7 +15422,7 @@ static void tm_dbg_deinit_tgt_dev(struct scst_tgt_dev *tgt_dev) return; } -static void tm_dbg_timer_fn(unsigned long arg) +static void tm_dbg_timer_fn(struct timer_list *timer) { TRACE_MGMT_DBG("%s", "delayed cmd timer expired"); tm_dbg_flags.tm_dbg_release = 1; From a22dda0a15473542612052966cc16caa5a8ecae7 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Mar 2018 19:44:44 +0000 Subject: [PATCH 13/13] nightly build: Update kernel versions git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7386 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- nightly/conf/nightly.conf | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nightly/conf/nightly.conf b/nightly/conf/nightly.conf index 3310e2ede..b015a4222 100644 --- a/nightly/conf/nightly.conf +++ b/nightly/conf/nightly.conf @@ -3,26 +3,26 @@ ABT_DETAILS="x86_64" ABT_JOBS=5 ABT_KERNELS=" \ -4.15.1 \ -4.14.18-nc \ +4.15.7 \ +4.14.24-nc \ 4.13.12-nc \ 4.12.14-nc \ 4.11.12-nc \ 4.10.17-nc \ -4.9.80-nc \ +4.9.86-nc \ 4.8.17-nc \ 4.7.10-nc \ 4.6.7-nc \ 4.5.7-nc \ -4.4.115-nc \ +4.4.120-nc \ 4.3.6-nc \ 4.2.8-nc \ 4.1.38-nc \ 4.0.9-nc \ 3.19.8-nc \ -3.18.94-nc \ +3.18.98-nc \ 3.17.8-nc \ -3.16.41-nc \ +3.16.55-nc \ 3.15.10-nc \ 3.14.79-nc \ 3.13.11-nc \ @@ -36,7 +36,7 @@ ABT_KERNELS=" \ 3.5.7-nc \ 3.4.113-nc \ 3.3.8-nc \ -3.2.84-nc \ +3.2.100-nc \ 3.1.10-nc \ 3.0.101-nc \ 2.6.39.4-nc \