diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-04-15 20:35:48 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-04-15 20:35:48 +0000 |
commit | d15b852ede90e3ff8cdbf08f096db07a720b7224 (patch) | |
tree | 2bdc06ae51feef67f615146c5725a807f68a5d26 /core/iscsitarget | |
parent | 105b5dbe90f1c8619d5514e9c9f1598faf405df8 (diff) | |
download | aports-d15b852ede90e3ff8cdbf08f096db07a720b7224.tar.bz2 aports-d15b852ede90e3ff8cdbf08f096db07a720b7224.tar.xz |
core/iscsitarget: new aport
Open Source iSCSI target with professional features
http://iscsitarget.sourceforge.net/
Diffstat (limited to 'core/iscsitarget')
-rw-r--r-- | core/iscsitarget/APKBUILD | 66 | ||||
-rw-r--r-- | core/iscsitarget/ietd.confd | 30 | ||||
-rw-r--r-- | core/iscsitarget/ietd.initd | 106 | ||||
-rw-r--r-- | core/iscsitarget/iscsitarget-0.4.15-isns-set-scn-flag.patch | 20 | ||||
-rw-r--r-- | core/iscsitarget/iscsitarget-0.4.17+linux-2.6.28.patch | 78 | ||||
-rw-r--r-- | core/iscsitarget/iscsitarget-0.4.17-build.patch | 23 |
6 files changed, 323 insertions, 0 deletions
diff --git a/core/iscsitarget/APKBUILD b/core/iscsitarget/APKBUILD new file mode 100644 index 0000000000..09a88b4b4f --- /dev/null +++ b/core/iscsitarget/APKBUILD @@ -0,0 +1,66 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=iscsitarget +pkgver=0.4.17 +pkgrel=0 +pkgdesc="Open Source iSCSI target with professional features" +url="http://iscsitarget.sourceforge.net/" +license="GPL-2" +depends="uclibc openssl" +makedepends="openssl-dev" +subpackages="$pkgname-doc $pkgname-grsec-mod:mod" +_kernels="grsec" +source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz + $pkgname-0.4.15-isns-set-scn-flag.patch + $pkgname-0.4.17-build.patch + $pkgname-0.4.17+linux-2.6.28.patch + ietd.initd + ietd.confd + " + +for _i in $_kernels; do + makedepends="$makedepends linux-${_i}-sources linux-${_i}-dev" +done + +build() { + cd "$srcdir"/$pkgname-$pkgver + for i in ../*.patch; do + msg "Applying $i" + patch -p1 < $i || return 1 + done + + unset ARCH + local k + for k in $_kernels; do + msg "Building kernel modules for $k" + local kout="$srcdir"/$k + mkdir -p "$kout" + local ver=$(awk -F': ' '$1 ~ /Linux kernel version/ {print $2}' /boot/config-$k) + + cd "$kout" + cp /boot/config-$k .config + cp /boot/Module.symvers-$k Module.symvers + make -C /usr/src/linux-$ver-$k O=$PWD silentoldconfig \ + || return 1 + make modules_prepare + + cd "$srcdir"/$pkgname-$pkgver + make KSRC="$kout" kernel || return 1 + make KSRC="$kout" DISTDIR="$pkgdir" install-kernel || return 1 + done + + msg "Building userspace" + make KSRC="$kout" usr || return 1 + make KSRC="$kout" DISTDIR="$pkgdir" install-usr install-doc + + for i in etc/ietd.conf etc/initiators.*; do + install -Dm640 $i "$pkgdir"/$i || return 1 + done + install -Dm755 ../ietd.initd "$pkgdir"/etc/init.d/ietd + install -Dm755 ../ietd.confd "$pkgdir"/etc/conf.d/ietd +} +md5sums="e79b437695fc50e7d054631855a16b1b iscsitarget-0.4.17.tar.gz +22512c5cf4cb62127730ce53d74ff28f iscsitarget-0.4.15-isns-set-scn-flag.patch +c9a9b839b3afcdecd1601511ee48a171 iscsitarget-0.4.17-build.patch +f58dde50f72b04b7737b33e517e56208 iscsitarget-0.4.17+linux-2.6.28.patch +641513492f58a6cb13247d0028a50906 ietd.initd +06ba479d3533d557b8582abe6f182410 ietd.confd" diff --git a/core/iscsitarget/ietd.confd b/core/iscsitarget/ietd.confd new file mode 100644 index 0000000000..3621326b1a --- /dev/null +++ b/core/iscsitarget/ietd.confd @@ -0,0 +1,30 @@ +# Copyright 1999-2006 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# $Header: /var/cvsroot/gentoo-x86/sys-block/iscsitarget/files/ietd-conf.d,v 1.1 2006/02/20 08:33:40 robbat2 Exp $ + +# Address and port to listen on for connections. +#ADDRESS="" # set this to non-empty to listen somewhere specific +PORT=3260 + +# Address of your SNS server +# if available +#ISNS="" + +# User and group to run as +# You must ensure that the UID/GID have access to the files/devices you +# have provided in your configuration. +USER="root" +GROUP="root" + +# Debug level - see ietd(8) for the levels +#DEBUGLEVEL= + +# This setting disables the memory configuration warnings. +# Upstream takes the general policy of forcing all of the memory settings that +# they want, but that doesn't mesh with users that have it set higher. +# Gentoo by default ignores the settings that are higher, but issues warnings +# on those that are lower. +# Uncomment the next line to disable those warnings. +#DISABLE_MEMORY_WARNINGS=1 + +# vim: filetype=gentoo-conf-d tw=72: diff --git a/core/iscsitarget/ietd.initd b/core/iscsitarget/ietd.initd new file mode 100644 index 0000000000..6ea9a4b51e --- /dev/null +++ b/core/iscsitarget/ietd.initd @@ -0,0 +1,106 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# $Header: /var/cvsroot/gentoo-x86/sys-block/iscsitarget/files/ietd-init.d-2,v 1.1 2008/07/18 16:03:38 flameeyes Exp $ + +MEM_SIZE=1048576 +DAEMON=/usr/sbin/ietd +CONFIG_FILE=/etc/ietd.conf +PID_FILE=/var/run/iscsi_trgt.pid +NAME="iSCSI Enterprise Target" + +ARGS="" +[ -n "$USER" ] && ARGS="${ARGS} --uid=${USER}" +[ -n "$GROUP" ] && ARGS="${ARGS} --gid=${GROUP}" +[ -n "$ISNS" ] && ARGS="${ARGS} --isns=${ISNS}" +[ -n "$PORT" ] && ARGS="${ARGS} --port=${PORT}" +[ -n "$ADDRESS" ] && ARGS="${ARGS} --address=${ADDRESS}" +[ -n "$DEBUGLEVEL" ] && ARGS="${ARGS} --debug=${DEBUGLEVEL}" + +depend() { + use net + after modules +} +checkconfig() { + if [ ! -f $CONFIG_FILE ]; then + eerror "Config file $CONFIG_FILE does not exist!" + return 1 + fi + if [ -z "$DISABLE_MEMORY_WARNINGS" ]; then + check_memsize + fi +} + +check_memsize() { + local wr md sysctl_key v k + for wr in r w; do + for md in max default; do + sysctl_key="net.core.${wr}mem_${md}" + v="$(sysctl -n ${sysctl_key})" + if [ "${v}" -lt "${MEM_SIZE}" ]; then + ewarn "$sysctl_key ($v) is lower than recommended ${MEM_SIZE}" + fi + done + done + for wr in "" r w; do + sysctl_key="net.ipv4.tcp_${wr}mem" + set -- $(sysctl -n ${sysctl_key}) + for k in min default max ; do + if [ "${1}" -lt "${MEM_SIZE}" ]; then + ewarn "$sysctl_key:$k (${1}) is lower than recommended ${MEM_SIZE}" + fi + shift + done + done +} + +do_modules() { + msg="$1" + shift + modules="$1" + shift + opts="$@" + for m in ${modules}; do + ebegin "${msg} - ${m}" + modprobe ${opts} $m + ret=$? + eend $ret + [ $ret -ne 0 ] && return $ret + done + return 0 +} + +start() { + checkconfig || return 1 + do_modules 'Loading iSCSI-Target modules' 'iscsi_trgt' + ebegin "Starting ${NAME}" + start-stop-daemon --start --exec $DAEMON --quiet -- ${ARGS} + eend $? +} + +stop() { + ebegin "Removing ${NAME} devices" + # ugly, but ietadm does not allways provides correct exit values + RETURN="$(ietadm --op delete 2>&1)" + RETVAL=$? + if [ $RETVAL -eq 0 ] && [ "$RETURN" != "something wrong" ] ; then + eend 0 + else + eend 1 + eerror "ietadm failed - $RETURN" + return 1 + fi + + ebegin "Stopping ${NAME}" + start-stop-daemon --stop --quiet --exec $DAEMON --pidfile $PID_FILE + ret=$? + eend $ret + [ $ret -ne 0 ] && return 1 + + # ugly, but pid file is not removed by ietd + rm -f $PID_FILE + do_modules 'Removing iSCSI-Target modules' 'iscsi_trgt' '-r' + return $? +} + +# vim: tw=72: diff --git a/core/iscsitarget/iscsitarget-0.4.15-isns-set-scn-flag.patch b/core/iscsitarget/iscsitarget-0.4.15-isns-set-scn-flag.patch new file mode 100644 index 0000000000..4db90793d7 --- /dev/null +++ b/core/iscsitarget/iscsitarget-0.4.15-isns-set-scn-flag.patch @@ -0,0 +1,20 @@ +http://bugs.gentoo.org/180619 + +--- a/usr/isns.c ++++ b/usr/isns.c +@@ -215,13 +215,13 @@ + + #if __BYTE_ORDER == __LITTLE_ENDIAN + #define set_scn_flag(x) \ +-{ \ ++({ \ + x = (x & 0x55555555) << 1 | (x & 0xaaaaaaaa) >> 1; \ + x = (x & 0x33333333) << 2 | (x & 0xcccccccc) >> 2; \ + x = (x & 0x0f0f0f0f) << 4 | (x & 0xf0f0f0f0) >> 4; \ + x = (x & 0x00ff00ff) << 8 | (x & 0xff00ff00) >> 8; \ + x = (x & 0x0000ffff) << 16 | (x & 0xffff0000) >> 16; \ +-} ++}) + #else + #define set_scn_flag(x) (x) + #endif diff --git a/core/iscsitarget/iscsitarget-0.4.17+linux-2.6.28.patch b/core/iscsitarget/iscsitarget-0.4.17+linux-2.6.28.patch new file mode 100644 index 0000000000..ec35cd526f --- /dev/null +++ b/core/iscsitarget/iscsitarget-0.4.17+linux-2.6.28.patch @@ -0,0 +1,78 @@ +From c5e70fc826aad5efb786c47d294e3c0c76246d63 Mon Sep 17 00:00:00 2001 +From: =?utf-8?q?Diego=20E.=20'Flameeyes'=20Petten=C3=B2?= <flameeyes@gmail.com> +Date: Sat, 3 Jan 2009 00:09:43 +0100 +Subject: [PATCH] Fix building with Linux kernel 2.6.28 and later. + +With changeset 30c40d2c01f68c7eb1a41ab3552bdaf5dbf300d4 of the Linux +kernel, the functions open_bdev_excl and close_bdev_excl were replaced with +functionally-equivalent open_bdev_exclusive and close_bdev_exclusive. + +The new interface uses fmode_t instead of integer flags to carry on the +opening mode for a block device, thus require some minor changes in the +calls. +--- + kernel/block-io.c | 21 +++++++++++++++++++++ + 1 files changed, 21 insertions(+), 0 deletions(-) + +diff --git a/kernel/block-io.c b/kernel/block-io.c +index e4a25f7..2c5f6f6 100644 +--- a/kernel/block-io.c ++++ b/kernel/block-io.c +@@ -18,6 +18,14 @@ + #include "iscsi_dbg.h" + #include "iotype.h" + ++#include <linux/version.h> ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) ++# define HAVE_OPEN_BDEV_EXCLUSIVE 1 ++#else ++# define HAVE_OPEN_BDEV_EXCLUSIVE 0 ++#endif ++ + struct blockio_data { + char *path; + struct block_device *bdev; +@@ -154,14 +160,22 @@ blockio_open_path(struct iet_volume *volume, const char *path) + { + struct blockio_data *bio_data = volume->private; + struct block_device *bdev; ++#if HAVE_OPEN_BDEV_EXCLUSIVE ++ fmode_t mode = FMODE_READ | ( LUReadonly(volume) ? 0 : FMODE_WRITE ); ++#else + int flags = LUReadonly(volume) ? MS_RDONLY : 0; ++#endif + int err = 0; + + bio_data->path = kstrdup(path, GFP_KERNEL); + if (!bio_data->path) + return -ENOMEM; + ++#if HAVE_OPEN_BDEV_EXCLUSIVE ++ bdev = open_bdev_exclusive(path, mode, THIS_MODULE); ++#else + bdev = open_bdev_excl(path, flags, THIS_MODULE); ++#endif + if (IS_ERR(bdev)) { + err = PTR_ERR(bdev); + eprintk("Can't open device %s, error %d\n", path, err); +@@ -323,9 +337,16 @@ static void + blockio_detach(struct iet_volume *volume) + { + struct blockio_data *bio_data = volume->private; ++#if HAVE_OPEN_BDEV_EXCLUSIVE ++ fmode_t mode = FMODE_READ | ( LUReadonly(volume) ? 0 : FMODE_WRITE ); ++#endif + + if (bio_data->bdev) ++#if HAVE_OPEN_BDEV_EXCLUSIVE ++ close_bdev_exclusive(bio_data->bdev, mode); ++#else + close_bdev_excl(bio_data->bdev); ++#endif + kfree(bio_data->path); + + kfree(volume->private); +-- +1.6.0.6 + diff --git a/core/iscsitarget/iscsitarget-0.4.17-build.patch b/core/iscsitarget/iscsitarget-0.4.17-build.patch new file mode 100644 index 0000000000..ee676a9608 --- /dev/null +++ b/core/iscsitarget/iscsitarget-0.4.17-build.patch @@ -0,0 +1,23 @@ +--- a/usr/Makefile ++++ b/usr/Makefile +@@ -1,16 +1,15 @@ +-CFLAGS += -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include ++CFLAGS ?= -O2 -fno-inline -g + CFLAGS += -D_GNU_SOURCE # required for glibc >= 2.8 ++WARNFLAGS = -Wall -Wstrict-prototypes ++CFLAGS += $(WARNFLAGS) -I../include + PROGRAMS = ietd ietadm +-LIBS = -lcrypto ++LDLIBS = -lcrypto + + all: $(PROGRAMS) + + ietd: ietd.o iscsid.o conn.o session.o target.o message.o ctldev.o log.o chap.o event.o param.o plain.o isns.o + +- $(CC) $^ -o $@ $(LIBS) +- + ietadm: ietadm.o param.o +- $(CC) $^ -o $@ + + clean: + rm -f *.o $(PROGRAMS) |