summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcelo Góes <vanquirius@gentoo.org>2008-05-20 02:18:53 +0000
committerMarcelo Góes <vanquirius@gentoo.org>2008-05-20 02:18:53 +0000
commitf35f6b87d497492159e15915960ea0df56d35620 (patch)
tree0ecc98304d9d3fdc046b6c8dab48a72fad757498 /sys-fs/vhba
parentAdd libmirage for bug 198672 - userspace cdemu. Thanks to Daniel Lin <ephemie... (diff)
downloadgentoo-2-f35f6b87d497492159e15915960ea0df56d35620.tar.gz
gentoo-2-f35f6b87d497492159e15915960ea0df56d35620.tar.bz2
gentoo-2-f35f6b87d497492159e15915960ea0df56d35620.zip
Add vhba for bug 198672 - userspace cdemu. Thanks to Daniel Lin <ephemient at gmail
dot com>, Daniel Fullmer <cgibreak at gmail dot com>, Sebastian Stammler <stammler at stud.tu-darmstadt.de>, Rafal Muzylo <galtgendo at o2 dot pl>, Jan Bessai <Jan.Bessai at gmx dot de>, Pham Ngoc Hai <pngochai at yahoo dot com>, Petr Sykora <petr.sykora at gmail dot com>, Dirk Best <fatplumber at gmx dot de>, Marcel Schmedes <sm at kleinreich dot de>, Vladi <vladimir.elisseev at gmail dot com>, Ambroz BIzjak <ambro at b4ever dot net> and anyone I missed. (Portage version: 2.1.4.4)
Diffstat (limited to 'sys-fs/vhba')
-rw-r--r--sys-fs/vhba/ChangeLog18
-rw-r--r--sys-fs/vhba/Manifest7
-rw-r--r--sys-fs/vhba/files/vhba-1.0.0-makefile.patch36
-rw-r--r--sys-fs/vhba/files/vhba-1.0.0-scatterlist.patch19
-rw-r--r--sys-fs/vhba/files/vhba-1.0.0-scsicmnd.patch98
-rw-r--r--sys-fs/vhba/metadata.xml8
-rw-r--r--sys-fs/vhba/vhba-1.0.0.ebuild73
7 files changed, 259 insertions, 0 deletions
diff --git a/sys-fs/vhba/ChangeLog b/sys-fs/vhba/ChangeLog
new file mode 100644
index 000000000000..56f0429ec0cc
--- /dev/null
+++ b/sys-fs/vhba/ChangeLog
@@ -0,0 +1,18 @@
+# ChangeLog for sys-fs/vhba
+# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/vhba/ChangeLog,v 1.1 2008/05/20 02:18:52 vanquirius Exp $
+
+*vhba-1.0.0 (19 May 2008)
+
+ 19 May 2008; Marcelo Goes <vanquirius@gentoo.org>
+ +files/vhba-1.0.0-makefile.patch, +files/vhba-1.0.0-scatterlist.patch,
+ +files/vhba-1.0.0-scsicmnd.patch, +metadata.xml, +vhba-1.0.0.ebuild:
+ Add vhba for bug 198672 - userspace cdemu. Thanks to Daniel Lin <ephemient
+ at gmail dot com>, Daniel Fullmer <cgibreak at gmail dot com>, Sebastian
+ Stammler <stammler at stud.tu-darmstadt.de>, Rafal Muzylo <galtgendo at o2
+ dot pl>, Jan Bessai <Jan.Bessai at gmx dot de>, Pham Ngoc Hai <pngochai at
+ yahoo dot com>, Petr Sykora <petr.sykora at gmail dot com>, Dirk Best
+ <fatplumber at gmx dot de>, Marcel Schmedes <sm at kleinreich dot de>, Vladi
+ <vladimir.elisseev at gmail dot com>, Ambroz BIzjak <ambro at b4ever dot
+ net> and anyone I missed.
+
diff --git a/sys-fs/vhba/Manifest b/sys-fs/vhba/Manifest
new file mode 100644
index 000000000000..5cbc8533dfdf
--- /dev/null
+++ b/sys-fs/vhba/Manifest
@@ -0,0 +1,7 @@
+AUX vhba-1.0.0-makefile.patch 778 RMD160 4782607437fd3f55162d3086472933376b574d90 SHA1 61f7b098c654bb83b117c0760e4c8c9d365d8282 SHA256 ff8512f15f13de655c39168a9e000a5a3dfd6ae8b89789bc3ae6c8610ae6725a
+AUX vhba-1.0.0-scatterlist.patch 583 RMD160 7d1af6d447705df0644056258f67a0cb74a43381 SHA1 ba11da0b2c77b3ad47f8185fc134716c20568fb3 SHA256 eae66a805ee1e599f65ff5487ba2e8535a30d5d8a9cc8a8b95d166425e65fc95
+AUX vhba-1.0.0-scsicmnd.patch 2736 RMD160 503eb663d33fa082eceab87d2521b9d2dab469b9 SHA1 4ded720928b7483fe89da43712bf8952acb854e3 SHA256 da335b69398cf92dbd72db4c320939d6fa2530c60c0482eb2d629ce3724100ca
+DIST vhba-module-1.0.0.tar.bz2 5210 RMD160 862d4f3f33589a4546c6bb6eff8eb17c4a86edcf SHA1 978411599ab252b5a0305f73026150ab9269b1b4 SHA256 4a728b0d3d61841ac94007748799e37f48379ee8687eb3181040418d2021f5cc
+EBUILD vhba-1.0.0.ebuild 1974 RMD160 816e3419738a9743a95fae1ea703eb552e37229c SHA1 5d686f8d002cbe23f2408a505e3360cdc677a4a3 SHA256 96a39caa7052cd4becbdf5dc1091839191c507120b40a4e74d848c523fba8556
+MISC ChangeLog 896 RMD160 4096cdcea821d2e63b986faf9c099617bdd8fc5d SHA1 74bb98af90db798d2df40cf5b2def99b6593af42 SHA256 f4d1971169bc1e11a334a5326fa09ce79baa53f8e4aa67caf1e1d4c0903f6a84
+MISC metadata.xml 225 RMD160 461e7786d6f2b4ad0796cdbd8da127d2aa1d9c88 SHA1 7e14b4551dd441a467b812e3b4c4f3fd795e5a58 SHA256 1c4c96d3ac062761d9e938c233751ff32b23e2c21aff1e38df6a37ffa0e97cb1
diff --git a/sys-fs/vhba/files/vhba-1.0.0-makefile.patch b/sys-fs/vhba/files/vhba-1.0.0-makefile.patch
new file mode 100644
index 000000000000..289387005113
--- /dev/null
+++ b/sys-fs/vhba/files/vhba-1.0.0-makefile.patch
@@ -0,0 +1,36 @@
+--- vhba-module-1.0.0/Makefile 2007-12-20 02:56:57.000000000 +0100
++++ vhba-module-new/Makefile 2008-01-10 21:59:56.000000000 +0100
+@@ -1,21 +1,20 @@
+ VHBA_VERSION = 1.0.0
+ PACKAGE = vhba-module-$(VHBA_VERSION)
+
+-CFLAGS += -DVHBA_VERSION=\"$(VHBA_VERSION)\"
++EXTRA_CFLAGS += -DVHBA_VERSION=\"$(VHBA_VERSION)\"
+
+ obj-m += vhba.o
+
+ PWD ?= `pwd`
+ KDIR := /lib/modules/`uname -r`/build
+-KMAKE := $(MAKE) -C $(KDIR) M=$(PWD)
+
+ all: modules
+
+ modules:
+- $(KMAKE) modules
++ $(MAKE) -C $(KDIR) M=$(PWD) modules
+
+ module_install:
+- $(KMAKE) modules_install
++ $(MAKE) -C $(KDIR) M=$(PWD) modules_install
+
+ install: module_install
+
+@@ -24,7 +23,7 @@
+ cp Makefile $(distdir)
+
+ clean:
+- $(KMAKE) clean
++ $(MAKE) -C $(KDIR) M=$(PWD) clean
+ rm -fr $(PACKAGE)
+
+ dist: dist-gzip
diff --git a/sys-fs/vhba/files/vhba-1.0.0-scatterlist.patch b/sys-fs/vhba/files/vhba-1.0.0-scatterlist.patch
new file mode 100644
index 000000000000..5473ac3dd50e
--- /dev/null
+++ b/sys-fs/vhba/files/vhba-1.0.0-scatterlist.patch
@@ -0,0 +1,19 @@
+--- vhba-module-1.0.0/vhba.c 2007-12-20 02:56:57.000000000 +0100
++++ vhba-module-new/vhba.c 2008-01-06 08:49:18.000000000 +0100
+@@ -26,6 +26,7 @@
+ #include <linux/platform_device.h>
+ #include <linux/miscdevice.h>
+ #include <linux/poll.h>
++#include <linux/scatterlist.h>
+ #include <asm/uaccess.h>
+ #include <scsi/scsi.h>
+ #include <scsi/scsi_host.h>
+@@ -520,7 +521,7 @@
+ }
+ uaddr += len;
+
+- kaddr = kmap_atomic(sg[i].page, KM_USER0);
++ kaddr = kmap_atomic(sg_page(&sg[i]), KM_USER0);
+ memcpy(kaddr + sg[i].offset, kbuf, len);
+ kunmap_atomic(kaddr, KM_USER0);
+
diff --git a/sys-fs/vhba/files/vhba-1.0.0-scsicmnd.patch b/sys-fs/vhba/files/vhba-1.0.0-scsicmnd.patch
new file mode 100644
index 000000000000..bc8e64656dd6
--- /dev/null
+++ b/sys-fs/vhba/files/vhba-1.0.0-scsicmnd.patch
@@ -0,0 +1,98 @@
+--- vhba-module-org/vhba.c 2008-03-03 19:31:06.000000000 +0100
++++ vhba-module-1.0.0/vhba.c 2008-03-03 20:04:30.000000000 +0100
+@@ -425,11 +425,11 @@
+ ssize_t ret;
+
+ scmd_dbg(cmd, "request %lu, cdb 0x%x, bufflen %d, use_sg %d\n",
+- cmd->serial_number, cmd->cmnd[0], cmd->request_bufflen, cmd->use_sg);
++ cmd->serial_number, cmd->cmnd[0], cmd->sdb.length, cmd->sdb.table.nents);
+
+ ret = sizeof(vreq);
+ if (DATA_TO_DEVICE(cmd->sc_data_direction))
+- ret += cmd->request_bufflen;
++ ret += cmd->sdb.length;
+
+ if (ret > buf_len)
+ {
+@@ -442,7 +442,7 @@
+ vreq.lun = cmd->device->lun;
+ memcpy(vreq.cdb, cmd->cmnd, MAX_COMMAND_SIZE);
+ vreq.cdb_len = cmd->cmd_len;
+- vreq.data_len = cmd->request_bufflen;
++ vreq.data_len = cmd->sdb.length;
+
+ if (copy_to_user(buf, &vreq, sizeof(vreq)))
+ return -EFAULT;
+@@ -452,7 +452,7 @@
+ buf += sizeof(vreq);
+
+ /* XXX use_sg? */
+- if (copy_to_user(buf, cmd->request_buffer, vreq.data_len))
++ if (copy_to_user(buf, cmd->sdb.table.sgl, vreq.data_len))
+ return -EFAULT;
+ }
+
+@@ -464,7 +464,7 @@
+ ssize_t ret = 0;
+
+ scmd_dbg(cmd, "response %lu, status %x, data len %d, use_sg %d\n",
+- cmd->serial_number, res->status, res->data_len, cmd->use_sg);
++ cmd->serial_number, res->status, res->data_len, cmd->sdb.table.nents);
+
+ if (res->status)
+ {
+@@ -481,23 +481,23 @@
+
+ ret += res->data_len;
+ }
+- else if (DATA_FROM_DEVICE(cmd->sc_data_direction) && cmd->request_bufflen)
++ else if (DATA_FROM_DEVICE(cmd->sc_data_direction) && cmd->sdb.length)
+ {
+ size_t to_read;
+
+- if (res->data_len > cmd->request_bufflen)
++ if (res->data_len > cmd->sdb.length)
+ {
+- scmd_warn(cmd, "truncate data (%d < %d)\n", cmd->request_bufflen, res->data_len);
+- res->data_len = cmd->request_bufflen;
++ scmd_warn(cmd, "truncate data (%d < %d)\n", cmd->sdb.length, res->data_len);
++ res->data_len = cmd->sdb.length;
+ }
+
+ to_read = res->data_len;
+
+- if (cmd->use_sg)
++ if (cmd->sdb.table.nents)
+ {
+ unsigned char buf_stack[64];
+ unsigned char *kaddr, *uaddr, *kbuf;
+- struct scatterlist *sg = cmd->request_buffer;
++ struct scatterlist *sg = cmd->sdb.table.sgl;
+ int i;
+
+ uaddr = (unsigned char *) buf;
+@@ -507,7 +507,7 @@
+ else
+ kbuf = buf_stack;
+
+- for (i = 0; i < cmd->use_sg; i++)
++ for (i = 0; i < cmd->sdb.table.nents; i++)
+ {
+ size_t len = (sg[i].length < to_read) ? sg[i].length : to_read;
+
+@@ -534,13 +534,13 @@
+ }
+ else
+ {
+- if (copy_from_user(cmd->request_buffer, buf, res->data_len))
++ if (copy_from_user(cmd->sdb.table.sgl, buf, res->data_len))
+ return -EFAULT;
+
+ to_read -= res->data_len;
+ }
+
+- cmd->resid = to_read;
++ cmd->sdb.resid = to_read;
+
+ ret += res->data_len - to_read;
+ }
diff --git a/sys-fs/vhba/metadata.xml b/sys-fs/vhba/metadata.xml
new file mode 100644
index 000000000000..e4fa40918efa
--- /dev/null
+++ b/sys-fs/vhba/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>no-herd</herd>
+<maintainer>
+ <email>vanquirius@gentoo.org</email>
+</maintainer>
+</pkgmetadata>
diff --git a/sys-fs/vhba/vhba-1.0.0.ebuild b/sys-fs/vhba/vhba-1.0.0.ebuild
new file mode 100644
index 000000000000..52f04d2df3c4
--- /dev/null
+++ b/sys-fs/vhba/vhba-1.0.0.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/vhba/vhba-1.0.0.ebuild,v 1.1 2008/05/20 02:18:52 vanquirius Exp $
+
+inherit linux-info linux-mod eutils
+
+DESCRIPTION="VHBA module provides Virtual (SCSI) Host Bus Adapter for the cdemu suite"
+HOMEPAGE="http://cdemu.org"
+SRC_URI="mirror://sourceforge/cdemu/vhba-module-${PV}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86"
+IUSE=""
+
+DEPEND=">=virtual/linux-sources-2.6.19"
+RDEPEND=""
+
+S="${WORKDIR}/vhba-module-${PV}"
+MODULE_NAMES="vhba(block:${S})"
+BUILD_TARGETS="clean modules"
+
+pkg_setup() {
+ CONFIG_CHECK="~BLK_DEV_SR ~CHR_DEV_SG"
+ linux-info_pkg_setup
+ BUILD_PARAMS="KDIR=${KV_DIR}"
+ linux-mod_pkg_setup
+}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ einfo "Patching Makefile"
+ epatch "${FILESDIR}"/${P}-makefile.patch || die "Failed to patch Makefile"
+ if kernel_is 2 6 24 ; then
+ einfo "Patching scatterlist"
+ epatch "${FILESDIR}"/${P}-scatterlist.patch || die "Failed to patch scatterlist"
+ fi
+ if kernel_is 2 6 25 ; then
+ einfo "Patching scatterlist"
+ epatch "${FILESDIR}"/${P}-scatterlist.patch || die "Failed to patch scatterlist"
+ einfo "Patching scsi_cmnd"
+ epatch "${FILESDIR}"/${P}-scsicmnd.patch || die "Failed to patch scsicmnd"
+ fi
+}
+
+src_compile() {
+ linux-mod_src_compile || die "Error: building module failed!"
+}
+
+src_install() {
+ KV_OBJ="ko"
+ linux-mod_src_install || die "Error: installing module failed!"
+ UDEV_RULES="/etc/udev/rules.d/70-vhba.rules"
+ einfo "Generating UDEV-rules ..."
+ mkdir -p "${D}"/${UDEV_RULES%/*}
+ echo -e "# do not edit this file, it will be overwritten on update\n#" \
+ > "${D}"/${UDEV_RULES}
+ echo -e "KERNEL==\"vhba_ctl\", NAME=\"%k\", MODE=\"0660\", OWNER=\"root\",GROUP=\"cdemu\"" >> "${D}"/${UDEV_RULES}
+}
+
+pkg_postinst() {
+ einfo "Generating cdemu group ..."
+ enewgroup cdemu
+
+ elog "Don't forget to add your user to the cdemu group "
+ elog "if you want to be able to use virtual cdemu devices."
+ linux-mod_pkg_postinst
+}
+
+pkg_postrm() {
+ linux-mod_pkg_postrm
+}