Series of patches from Bart Van Assche <bart.vanassche@gmail.com>:
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Tue, 13 May 2008 09:27:16 +0000 (09:27 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Tue, 13 May 2008 09:27:16 +0000 (09:27 +0000)
 - Added Makefile.scsi.Linux-2.6.24.patch and Kconfig.scsi.Linux-2.6.24.patch
 - Updated Makefile.scsi_tgt to reflect move of the SCST device handlers from scst/src/ to scst/src/dev_handlers/
 - Added Makefile.dev_handlers
 - SCST include path fixed in srpt/ Makefile.in_kernel
 - Added script for converting the SCST source tree to a kernel patch. More comment on it:

The SCST source tree as it exists in the current Subversion repository will
have to be maintained for some time. And if SCST is submitted for inclusion
in the mainline kernel, this tree will have to be converted to a kernel
patch, reviewer comments will have to be processed, and the patch will have
to be resubmitted. So it's convenient to have a script available that
converts the Subversion source tree into a kernel patch. The patch below does
just that: convert the scst and srpt directories into a kernel patch
(iscsi-scst support will be added later on). I have tested the script
contained in the patch below as follows:

rm -rf linux-2.6.24
rm -rf /lib/modules/2.6.24-scst
tar xjf ~vanasscb/software/downloads/linux-2.6.24.tar.bz2
cd linux-2.6.24
cp ../.config .
(cd ~vanasscb/software/scst
&& ~vanasscb/software/scst/scripts/generate-kernel-patch \
2.6.24) | patch -p1
make -j5 bzImage modules && make modules_install install
cp -r /lib/firmware/$(uname -r) /lib/firmware/2.6.24-scst
update-initramfs -k 2.6.24-scst -c
reboot

git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@366 d57e44dd-8a1f-0410-8b47-8ef2f437770f

scripts/generate-kernel-patch [new file with mode: 0755]
scst/kernel/in-tree/Kconfig.scsi.Linux-2.6.24.patch [new file with mode: 0644]
scst/kernel/in-tree/Makefile.dev_handlers [new file with mode: 0644]
scst/kernel/in-tree/Makefile.scsi.Linux-2.6.24.patch [new file with mode: 0644]
scst/kernel/in-tree/Makefile.scsi_tgt
srpt/src/Makefile.in_kernel

diff --git a/scripts/generate-kernel-patch b/scripts/generate-kernel-patch
new file mode 100755 (executable)
index 0000000..af4dc5a
--- /dev/null
@@ -0,0 +1,181 @@
+#!/bin/bash
+
+############################################################################
+#
+# Script for converting the SCST source tree as it exists in the Subversion
+# repository to a Linux kernel patch.
+#
+# Copyright (C) 2008 Bart Van Assche <bart.vanassche@gmail.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, version 2
+# of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+############################################################################
+
+########################
+# Function definitions #
+########################
+
+# Convert an existing patch.
+# $1: path of patch to be added.
+# $2: path in kernel tree of file to be patched.
+function add_patch {
+  if [ ! -e "$1" ]; then
+    echo "Error: could not find $1."
+    exit 1
+  fi
+
+  sed -e "s:^--- [^ ]*:--- orig/$2:" -e "s:^+++ [^ ]*:+++ $2:" < "$1"
+}
+
+# Generate a patch for a file to be added to the kernel source tree.
+# $1: path of file to be added.
+# $2: path in kernel tree where file should be added.
+function add_file {
+  local a b
+
+  if [ ! -e "$1" ]; then
+    echo "Error: could not find $1."
+    exit 1
+  fi
+
+  cat <<EOF
+diff -uprN orig/$2 $2
+--- orig/$2
++++ $2
+@@ -0,0 +1,$(wc -l "$1" | { read a b; echo $a; }) @@
+EOF
+  sed "s/^/+/" <"$1"
+}
+
+
+#########################
+# Argument verification #
+#########################
+
+if [ ! -e scst -o ! -e iscsi-scst -o ! -e srpt ]; then
+  echo "Please run this script from inside the SCST subversion source tree."
+  exit 1
+fi
+
+if [ $# != 1 ]; then
+  echo "Usage: $0 <kernel version>."
+  exit 1
+fi
+
+####################
+# Patch Generation #
+####################
+
+kernel_version="$1"
+kpatch=(                                                                \
+  "scst/kernel/scst_exec_req_fifo-${kernel_version}.patch"              \
+  "iscsi-scst/kernel/patches/put_page_callback-${kernel_version}.patch" \
+)
+
+for p in "${kpatch[@]}"
+do
+  if [ ! -e "$p" ]; then
+    echo "Error: kernel version ${kernel_version} is not supported by SCST."
+    echo "(could not find file $p)."
+    exit 1
+  fi
+done
+
+
+# Kernel patches for other directories than drivers/scsi/scsi_tgt/.
+
+for p in "${kpatch[@]}"
+do
+  cat "$p"
+  echo ''
+  echo ''
+done
+
+add_patch "scst/kernel/in-tree/Kconfig.scsi.Linux-${kernel_version}.patch" \
+          "linux-${kernel_version}/drivers/scsi/Kconfig"
+
+add_patch "scst/kernel/in-tree/Makefile.scsi.Linux-${kernel_version}.patch" \
+          "linux-${kernel_version}/drivers/scsi/Makefile"
+
+
+# Directory include/scsi_tgt/
+
+for f in scst/include/*h
+do
+  add_file "${f}" "linux-${kernel_version}/include/scsi_tgt/${f#scst/include/}"
+done
+
+
+# Directory drivers/scsi/scsi_tgt/
+
+add_file "scst/kernel/in-tree/Kconfig.scsi_tgt" \
+         "drivers/scsi/scsi_tgt/Kconfig"
+add_file "scst/kernel/in-tree/Makefile.scsi_tgt" \
+         "drivers/scsi/scsi_tgt/Makefile"
+
+
+for f in scst/src/*[ch]
+do
+  add_file ${f} linux-${kernel_version}/drivers/scsi/scsi_tgt/${f#scst/src/}
+  echo ''
+  echo ''
+done
+
+
+# Directory drivers/scsi/scsi_tgt/dev_handlers/
+
+add_file "scst/kernel/in-tree/Makefile.dev_handlers" \
+         "linux-${kernel_version}/drivers/scsi/scsi_tgt/dev_handlers/Makefile"
+
+for f in scst/src/dev_handlers/*.[ch]
+do
+  add_file ${f} linux-${kernel_version}/drivers/scsi/scsi_tgt/dev_handlers/${f#scst/src/dev_handlers/}
+  echo ''
+  echo ''
+done
+
+
+# Directory drivers/infiniband/ulp/srpt/
+
+cat <<'EOF'
+diff -uprN orig/linux-2.6.24/drivers/infiniband/Kconfig linux-2.6.24/drivers/infiniband/Kconfig
+--- orig/linux-2.6.24/drivers/infiniband/Kconfig        2008-01-24 23:58:37.000000000 +0100
++++ linux-2.6.24/drivers/infiniband/Kconfig     2008-05-09 13:55:27.000000000 +0200
+@@ -51,6 +51,8 @@
+
+ source "drivers/infiniband/ulp/srp/Kconfig"
+
++source "drivers/infiniband/ulp/srpt/Kconfig"
++
+ source "drivers/infiniband/ulp/iser/Kconfig"
+
+ endif # INFINIBAND
+diff -uprN orig/linux-2.6.24/drivers/infiniband/Makefile linux-2.6.24/drivers/infiniband/Makefile
+--- orig/linux-2.6.24/drivers/infiniband/Makefile      2008-01-24 23:58:37.000000000 +0100
++++ linux-2.6.24/drivers/infiniband/Makefile   2008-05-09 13:57:00.000000000 +0200
+@@ -7,4 +7,5 @@
+ obj-$(CONFIG_MLX4_INFINIBAND)         += hw/mlx4/
+ obj-$(CONFIG_INFINIBAND_IPOIB)                += ulp/ipoib/
+ obj-$(CONFIG_INFINIBAND_SRP)          += ulp/srp/
++obj-$(CONFIG_INFINIBAND_SRPT)         += ulp/srpt/
+ obj-$(CONFIG_INFINIBAND_ISER)         += ulp/iser/
+EOF
+
+add_file "srpt/src/Kconfig" "drivers/infiniband/ulp/srpt/Kconfig"
+
+add_file "srpt/src/Makefile.in_kernel" "drivers/infiniband/ulp/srpt/Makefile"
+
+for f in srpt/src/*[ch]
+do
+  add_file ${f} linux-${kernel_version}/drivers/infiniband/ulp/srpt/${f#srpt/src/}
+  echo ''
+  echo ''
+done
diff --git a/scst/kernel/in-tree/Kconfig.scsi.Linux-2.6.24.patch b/scst/kernel/in-tree/Kconfig.scsi.Linux-2.6.24.patch
new file mode 100644 (file)
index 0000000..0a3fee3
--- /dev/null
@@ -0,0 +1,11 @@
+--- orig/linux-2.6.24/drivers/scsi/Kconfig     2008-01-24 23:58:37.000000000 +0100
++++ linux-2.6.24/drivers/scsi/Kconfig  2008-05-09 13:25:39.000000000 +0200
+@@ -1351,6 +1351,8 @@ config SCSI_QLOGICPTI
+ source "drivers/scsi/qla2xxx/Kconfig"
+ source "drivers/scsi/qla4xxx/Kconfig"
++source "drivers/scsi/scsi_tgt/Kconfig"
++
+ config SCSI_LPFC
+       tristate "Emulex LightPulse Fibre Channel Support"
+       depends on PCI && SCSI
diff --git a/scst/kernel/in-tree/Makefile.dev_handlers b/scst/kernel/in-tree/Makefile.dev_handlers
new file mode 100644 (file)
index 0000000..cac4917
--- /dev/null
@@ -0,0 +1,14 @@
+EXTRA_CFLAGS += -Iinclude/scsi_tgt -Wextra -Wno-unused-parameter
+
+obj-m := scst_cdrom.o scst_changer.o scst_disk.o scst_modisk.o scst_tape.o \
+       scst_vdisk.o scst_raid.o scst_processor.o scst_user.o
+
+obj-$(CONFIG_SCSI_TARGET_DISK)         += scst_disk.o
+obj-$(CONFIG_SCSI_TARGET_TAPE)         += scst_tape.o
+obj-$(CONFIG_SCSI_TARGET_CDROM)                += scst_cdrom.o
+obj-$(CONFIG_SCSI_TARGET_MODISK)       += scst_modisk.o
+obj-$(CONFIG_SCSI_TARGET_CHANGER)      += scst_changer.o
+obj-$(CONFIG_SCSI_TARGET_RAID)         += scst_raid.o
+obj-$(CONFIG_SCSI_TARGET_PROCESSOR)    += scst_processor.o
+obj-$(CONFIG_SCSI_TARGET_VDISK)                += scst_vdisk.o
+obj-$(CONFIG_SCSI_TARGET_USER)         += scst_user.o
diff --git a/scst/kernel/in-tree/Makefile.scsi.Linux-2.6.24.patch b/scst/kernel/in-tree/Makefile.scsi.Linux-2.6.24.patch
new file mode 100644 (file)
index 0000000..6f39946
--- /dev/null
@@ -0,0 +1,11 @@
+diff -uprN orig/linux-2.6.24/drivers/scsi/Makefile linux-2.6.24/drivers/scsi/Makefile
+--- orig/linux-2.6.24/drivers/scsi/Makefile    2008-01-24 23:58:37.000000000 +0100
++++ linux-2.6.24/drivers/scsi/Makefile 2008-05-09 13:05:36.000000000 +0200
+@@ -88,6 +88,7 @@ obj-$(CONFIG_PCMCIA_QLOGIC)  += qlogicfas
+ obj-$(CONFIG_SCSI_QLOGIC_1280)        += qla1280.o 
+ obj-$(CONFIG_SCSI_QLA_FC)     += qla2xxx/
+ obj-$(CONFIG_SCSI_QLA_ISCSI)  += qla4xxx/
++obj-$(CONFIG_SCSI_TARGET)     += scsi_tgt/
+ obj-$(CONFIG_SCSI_LPFC)               += lpfc/
+ obj-$(CONFIG_SCSI_PAS16)      += pas16.o
+ obj-$(CONFIG_SCSI_SEAGATE)    += seagate.o
index dc45c29..6ec64e2 100644 (file)
@@ -1,19 +1,11 @@
+EXTRA_CFLAGS += -Iinclude/scsi_tgt -Wextra -Wno-unused-parameter
 
-EXTRA_CFLAGS           += -Iinclude/scsi
+scst-y        += scst_main.o
+scst-y        += scst_targ.o
+scst-y        += scst_lib.o
+scst-y        += scst_proc.o
+scst-y        += scst_mem.o
+scst-y        += scst_debug.o
 
-scsi_tgt-y                             += scst.o
-scsi_tgt-y                             += scst_targ.o
-scsi_tgt-y                             += scst_lib.o
-scsi_tgt-y                             += scst_proc.o
-scsi_tgt-y                             += scst_mem.o
+obj-$(CONFIG_SCSI_TARGET)   += scst.o dev_handlers/
 
-obj-$(CONFIG_SCSI_TARGET)              += scsi_tgt.o
-obj-$(CONFIG_SCSI_TARGET_DISK)         += scst_disk.o
-obj-$(CONFIG_SCSI_TARGET_TAPE)         += scst_tape.o
-obj-$(CONFIG_SCSI_TARGET_CDROM)                += scst_cdrom.o
-obj-$(CONFIG_SCSI_TARGET_MODISK)       += scst_modisk.o
-obj-$(CONFIG_SCSI_TARGET_CHANGER)      += scst_changer.o
-obj-$(CONFIG_SCSI_TARGET_RAID)         += scst_raid.o
-obj-$(CONFIG_SCSI_TARGET_PROCESSOR)    += scst_processor.o
-obj-$(CONFIG_SCSI_TARGET_VDISK)                += scst_vdisk.o
-obj-$(CONFIG_SCSI_TARGET_USER)         += scst_user.o
index 34bdc5b..597f1c5 100644 (file)
@@ -1,4 +1,4 @@
 EXTRA_CFLAGS += -Idrivers/infiniband/include
-EXTRA_CFLAGS += -I/usr/local/include/scst
+EXTRA_CFLAGS += -Iinclude/scsi_tgt
 
 obj-$(CONFIG_INFINIBAND_SRPT)                  += ib_srpt.o