From a422536e1ba326bff507ba81859c784a135d1804 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 30 May 2011 22:48:08 +0000 Subject: Mon May 30 22:48:08 UTC 2011 --- community-testing/vhba-module/PKGBUILD | 27 +++++++++++ .../vhba-module/vhba-kernel2.6.37.patch | 56 ++++++++++++++++++++++ community-testing/vhba-module/vhba-module.install | 16 +++++++ 3 files changed, 99 insertions(+) create mode 100644 community-testing/vhba-module/PKGBUILD create mode 100644 community-testing/vhba-module/vhba-kernel2.6.37.patch create mode 100644 community-testing/vhba-module/vhba-module.install (limited to 'community-testing') diff --git a/community-testing/vhba-module/PKGBUILD b/community-testing/vhba-module/PKGBUILD new file mode 100644 index 000000000..43fa2bc67 --- /dev/null +++ b/community-testing/vhba-module/PKGBUILD @@ -0,0 +1,27 @@ +# $Id: PKGBUILD 48166 2011-05-29 11:57:10Z mherych $ +# Maintainer: Mateusz Herych +# Contributor: Charles Lindsay + +pkgname=vhba-module +pkgver=20100822 +_kernver='2.6.39-ARCH' +pkgrel=5 +pkgdesc="Kernel module that emulates SCSI devices" +arch=('i686' 'x86_64') +url="http://cdemu.sourceforge.net/" +license=('GPL2') +depends=('kernel26>=2.6.39' 'kernel26<2.6.40') +makedepends=('kernel26-headers>=2.6.39' 'git') +install=vhba-module.install +source=(http://downloads.sourceforge.net/cdemu/$pkgname-$pkgver.tar.gz + vhba-kernel2.6.37.patch) +md5sums=('1d2f06ae33c5d15b7c29e467e4658aa2' + 'f0499fc54f6ef9b8d6ca0b9e940c5906') + +build() { + cd "$srcdir/$pkgname-$pkgver" + git apply -p2 ../vhba-kernel2.6.37.patch + make -j1 KDIR=/usr/src/linux-${_kernver} || return 1 + install -D vhba.ko "$pkgdir/lib/modules/${_kernver}/extra/vhba.ko" || return 1 + sed -i -e "s/KERNEL_VERSION='.*'/KERNEL_VERSION='${_kernver}'/" "$startdir/vhba-module.install" +} diff --git a/community-testing/vhba-module/vhba-kernel2.6.37.patch b/community-testing/vhba-module/vhba-kernel2.6.37.patch new file mode 100644 index 000000000..e2b619c74 --- /dev/null +++ b/community-testing/vhba-module/vhba-kernel2.6.37.patch @@ -0,0 +1,56 @@ +From 9ad7ec7fae387f05249b9f4e6accb3bc3b0b8b0f Mon Sep 17 00:00:00 2001 +From: Alexandre Rostovtsev +Date: Thu, 6 Jan 2011 03:39:26 -0500 +Subject: [PATCH] Make vhba compatible with kernel 2.6.37 SCSI host API + +Due to the SCSI host lock push-down changes introduced in 2.6.37 (see +http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=f281233d3eba15fb225d21ae2e228fd4553d824a +for more details), trying to use current vhba on 2.6.37 leads to oopses +and kernel panics - e.g. see http://bugs.gentoo.org/show_bug.cgi?id=350753 + +Add some #ifdefs to enable compatibility both with 2.6.37 and older API. +Note that if future kernel versions remove the DEF_SCSI_QCMD macro, this +issue will need to be revisited. + +Signed-off-by: Alexandre Rostovtsev +--- + vhba-module/vhba.c | 9 ++++++++- + 1 files changed, 8 insertions(+), 1 deletions(-) + +diff --git a/vhba-module/vhba.c b/vhba-module/vhba.c +index 059f6ce..9d13016 100644 +--- a/vhba-module/vhba.c ++++ b/vhba-module/vhba.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + #ifdef CONFIG_COMPAT + #include + #endif +@@ -363,7 +364,7 @@ static void vhba_free_command(struct vhba_command *vcmd) + spin_unlock_irqrestore(&vhost->cmd_lock, flags); + } + +-static int vhba_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) ++static int vhba_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) + { + struct vhba_device *vdev; + int retval; +@@ -388,6 +389,12 @@ static int vhba_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmn + return retval; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) ++DEF_SCSI_QCMD(vhba_queuecommand) ++#else ++#define vhba_queuecommand vhba_queuecommand_lck ++#endif ++ + static int vhba_abort(struct scsi_cmnd *cmd) + { + struct vhba_device *vdev; +-- +1.7.3.4 + diff --git a/community-testing/vhba-module/vhba-module.install b/community-testing/vhba-module/vhba-module.install new file mode 100644 index 000000000..c3bcbca3f --- /dev/null +++ b/community-testing/vhba-module/vhba-module.install @@ -0,0 +1,16 @@ +post_install() { + echo ">> Place 'vhba' in MODULES= in /etc/rc.conf to enable vhba on system boot." + echo ">> This module needs to be recompiled for every kernel version upgrade." + KERNEL_VERSION='2.6.37-ARCH' + depmod $KERNEL_VERSION > /dev/null 2>&1 +} + +post_upgrade() { + post_install +} + +post_remove() { + KERNEL_VERSION='2.6.37-ARCH' + depmod $KERNEL_VERSION > /dev/null 2>&1 +} + -- cgit v1.2.3-54-g00ecf