summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /sys-block/iscsitarget
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sys-block/iscsitarget')
-rw-r--r--sys-block/iscsitarget/Manifest5
-rw-r--r--sys-block/iscsitarget/files/ietd-conf.d30
-rw-r--r--sys-block/iscsitarget/files/ietd-init.d-2106
-rw-r--r--sys-block/iscsitarget/files/iscsitarget-0.4.15-isns-set-scn-flag.patch20
-rw-r--r--sys-block/iscsitarget/files/iscsitarget-0.4.17+linux-2.6.28.patch82
-rw-r--r--sys-block/iscsitarget/files/iscsitarget-0.4.17+linux-2.6.29.patch40
-rw-r--r--sys-block/iscsitarget/files/iscsitarget-0.4.17+linux-2.6.30.patch37
-rw-r--r--sys-block/iscsitarget/files/iscsitarget-0.4.17-build.patch23
-rw-r--r--sys-block/iscsitarget/files/iscsitarget-1.4.18+linux-2.6.32.patch42
-rw-r--r--sys-block/iscsitarget/files/iscsitarget-1.4.19+linux-2.6.33.patch12
-rw-r--r--sys-block/iscsitarget/files/iscsitarget-1.4.20.2-respect-flags-v2.patch10
-rw-r--r--sys-block/iscsitarget/files/iscsitarget-1.4.20.2-respect-flags.patch32
-rw-r--r--sys-block/iscsitarget/files/iscsitarget-1.4.20.2_kernel-2.6.36.patch12
-rw-r--r--sys-block/iscsitarget/files/iscsitarget-1.4.20.2_p20130103-fix-3.2-support.patch135
-rw-r--r--sys-block/iscsitarget/files/iscsitarget-1.4.20.2_p20130103-restore-linux-2.6.32-support.patch96
-rw-r--r--sys-block/iscsitarget/iscsitarget-0.4.17.ebuild62
-rw-r--r--sys-block/iscsitarget/iscsitarget-1.4.19.ebuild70
-rw-r--r--sys-block/iscsitarget/iscsitarget-1.4.20.2.ebuild71
-rw-r--r--sys-block/iscsitarget/iscsitarget-1.4.20.2_p20130103.ebuild94
-rw-r--r--sys-block/iscsitarget/iscsitarget-1.4.20.2_p20130821.ebuild94
-rw-r--r--sys-block/iscsitarget/iscsitarget-9999.ebuild94
-rw-r--r--sys-block/iscsitarget/metadata.xml10
22 files changed, 1177 insertions, 0 deletions
diff --git a/sys-block/iscsitarget/Manifest b/sys-block/iscsitarget/Manifest
new file mode 100644
index 000000000000..9ed01954f52e
--- /dev/null
+++ b/sys-block/iscsitarget/Manifest
@@ -0,0 +1,5 @@
+DIST iscsitarget-0.4.17.tar.gz 107884 SHA256 bc554508174f2657c93ddb0501adad0256d1c6801a3c1ee54ff721bc92ff8778
+DIST iscsitarget-1.4.19.tar.gz 124288 SHA256 a9fc5e43a2806b8aa95513b2af06d97bb9181ef5fedc906d69144d93a86e664a
+DIST iscsitarget-1.4.20.2.tar.gz 138464 SHA256 0f3c8e2c2038fbbd7059d1efdd428260013212daca75c1d56abbeec33cb8d388 SHA512 e9853eb5b954f5cbb43f4ed568ac896616a845f3f9ae57841045f4ef6f6487704d94364cdf48da2c0171aef27aeffa7ca8a4653bfe956486d63578a0d4c32dc6 WHIRLPOOL a24148101fc0abbd19e762ae46b84838027180559e96168efeca2e6fbf355e43cf57219701c58dcab0cdc9b3423601bd066f2a91dae477ab7ff67110c6a63a41
+DIST iscsitarget-1.4.20.2_p20130103.tar.gz 147073 SHA256 ff86e0fc18e8a33b299c8438729613345a50b91f988383fc9cad240cd3f7c1c1 SHA512 7ed706c38a63b696ff344725308a5d476f8fc4ebee71456615274470afed4d9cb2985d0960a9e77d185e267771e6c7ece8707232d42affd11f7de76e0eaf7371 WHIRLPOOL d13a869e14d716558bf15b7291b0987c5561067faafc3af5e0fd0db0126add7fbc0621e53394ca912c55fb6a3aa9ff6d402aca52d18d7087b5c3d594e15021f4
+DIST iscsitarget-1.4.20.2_p20130821.tar.xz 115664 SHA256 e1f5ce48b9c51da98564addc76cd5ae512744d5899991892b7578325ec3f149c SHA512 7dcc0b0f670954f06a0018f4969122b4b264523c82dea25145fdbe25054b18909c5a4cd8b6945cc29dfd7ce8704f3d9df3f4ae23ec334e79da065158ae291fd1 WHIRLPOOL 897f181f9f18dec5ef85c644516200426b09ee5c4c45d0822e831ad7835d294b1af3e7da17544200b56a68c4e800cca6c803a60b4f422a4a61791a6a4cdfe4d5
diff --git a/sys-block/iscsitarget/files/ietd-conf.d b/sys-block/iscsitarget/files/ietd-conf.d
new file mode 100644
index 000000000000..bac2a3f426db
--- /dev/null
+++ b/sys-block/iscsitarget/files/ietd-conf.d
@@ -0,0 +1,30 @@
+# Copyright 1999-2006 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Id$
+
+# 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/sys-block/iscsitarget/files/ietd-init.d-2 b/sys-block/iscsitarget/files/ietd-init.d-2
new file mode 100644
index 000000000000..39b9f8914737
--- /dev/null
+++ b/sys-block/iscsitarget/files/ietd-init.d-2
@@ -0,0 +1,106 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Id$
+
+MEM_SIZE=1048576
+DAEMON=/usr/sbin/ietd
+CONFIG_FILE=/etc/ietd.conf
+PID_FILE=/var/run/ietd.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/sys-block/iscsitarget/files/iscsitarget-0.4.15-isns-set-scn-flag.patch b/sys-block/iscsitarget/files/iscsitarget-0.4.15-isns-set-scn-flag.patch
new file mode 100644
index 000000000000..47ca031a7469
--- /dev/null
+++ b/sys-block/iscsitarget/files/iscsitarget-0.4.15-isns-set-scn-flag.patch
@@ -0,0 +1,20 @@
+http://bugs.gentoo.org/180619
+
+--- usr/isns.c
++++ 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/sys-block/iscsitarget/files/iscsitarget-0.4.17+linux-2.6.28.patch b/sys-block/iscsitarget/files/iscsitarget-0.4.17+linux-2.6.28.patch
new file mode 100644
index 000000000000..1f57afdba42c
--- /dev/null
+++ b/sys-block/iscsitarget/files/iscsitarget-0.4.17+linux-2.6.28.patch
@@ -0,0 +1,82 @@
+From 57551cb0529b48411f8f63a002882b7e1cf792f8 Mon Sep 17 00:00:00 2001
+From: =?utf-8?q?Diego=20E.=20'Flameeyes'=20Petten=C3=B2?= <flameeyes@gmail.com>
+Date: Wed, 25 Mar 2009 16:14:26 +0100
+Subject: [PATCH 1/2] 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 | 22 ++++++++++++++++++++++
+ 1 files changed, 22 insertions(+), 0 deletions(-)
+
+diff --git a/kernel/block-io.c b/kernel/block-io.c
+index e4a25f7..af10c7e 100644
+--- a/kernel/block-io.c
++++ b/kernel/block-io.c
+@@ -13,11 +13,18 @@
+ #include <linux/blkdev.h>
+ #include <linux/parser.h>
+ #include <linux/buffer_head.h>
++#include <linux/version.h>
+
+ #include "iscsi.h"
+ #include "iscsi_dbg.h"
+ #include "iotype.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 +161,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 +338,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.2
+
diff --git a/sys-block/iscsitarget/files/iscsitarget-0.4.17+linux-2.6.29.patch b/sys-block/iscsitarget/files/iscsitarget-0.4.17+linux-2.6.29.patch
new file mode 100644
index 000000000000..092fdc3fd9c4
--- /dev/null
+++ b/sys-block/iscsitarget/files/iscsitarget-0.4.17+linux-2.6.29.patch
@@ -0,0 +1,40 @@
+From 81373580a641732a7e4610c3d39af0c68007b892 Mon Sep 17 00:00:00 2001
+From: =?utf-8?q?Diego=20Elio=20'Flameeyes'=20Petten=C3=B2?= <flameeyes@gmail.com>
+Date: Wed, 25 Mar 2009 16:14:46 +0100
+Subject: [PATCH 2/2] Fix building with Linux kernel 2.6.29 and later.
+
+When building for Linux 2.6.29 or later, instead of using the NIP6
+macro (that has been removed) use the new %p6 format specifier.
+---
+ kernel/conn.c | 6 ++++++
+ 1 files changed, 6 insertions(+), 0 deletions(-)
+
+diff --git a/kernel/conn.c b/kernel/conn.c
+index f96e2b6..ab561f9 100644
+--- a/kernel/conn.c
++++ b/kernel/conn.c
+@@ -6,6 +6,7 @@
+
+ #include <linux/file.h>
+ #include <linux/ip.h>
++#include <linux/version.h>
+ #include <net/tcp.h>
+
+ #include "iscsi.h"
+@@ -47,8 +48,13 @@ void conn_info_show(struct seq_file *seq, struct iscsi_session *session)
+ break;
+ case AF_INET6:
+ snprintf(buf, sizeof(buf),
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
++ "[%p6]",
++ &(inet6_sk(sk)->daddr));
++#else
+ "[%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]",
+ NIP6(inet6_sk(sk)->daddr));
++#endif
+ break;
+ default:
+ break;
+--
+1.6.2
+
diff --git a/sys-block/iscsitarget/files/iscsitarget-0.4.17+linux-2.6.30.patch b/sys-block/iscsitarget/files/iscsitarget-0.4.17+linux-2.6.30.patch
new file mode 100644
index 000000000000..fa420e97b375
--- /dev/null
+++ b/sys-block/iscsitarget/files/iscsitarget-0.4.17+linux-2.6.30.patch
@@ -0,0 +1,37 @@
+From cb1b94ffa91d71aba8e07ed018e9f43064e05a49 Mon Sep 17 00:00:00 2001
+From: =?utf-8?q?Diego=20Elio=20'Flameeyes'=20Petten=C3=B2?= <flameeyes@gmail.com>
+Date: Wed, 10 Jun 2009 17:24:02 +0200
+Subject: [PATCH 3/3] Fix building with Linux kernel 2.6.30 and later.
+
+With commit 99b76233803beab302123d243eea9e41149804f3 the proc_dir_entry
+structure does not have an owner any longer, this just removes the
+assignment to make the code build with the newer kernel.
+---
+ kernel/config.c | 3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+diff --git a/kernel/config.c b/kernel/config.c
+index d6c4b5e..34681f5 100644
+--- a/kernel/config.c
++++ b/kernel/config.c
+@@ -5,6 +5,7 @@
+ */
+
+ #include <linux/proc_fs.h>
++#include <linux/version.h>
+
+ #include "iscsi.h"
+ #include "iscsi_dbg.h"
+@@ -43,7 +44,9 @@ int iet_procfs_init(void)
+ if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
+ goto err;
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
+ proc_iet_dir->owner = THIS_MODULE;
++#endif
+
+ for (i = 0; i < ARRAY_SIZE(iet_proc_entries); i++) {
+ ent = create_proc_entry(iet_proc_entries[i].name, 0, proc_iet_dir);
+--
+1.6.3.1
+
diff --git a/sys-block/iscsitarget/files/iscsitarget-0.4.17-build.patch b/sys-block/iscsitarget/files/iscsitarget-0.4.17-build.patch
new file mode 100644
index 000000000000..e984bd3ec374
--- /dev/null
+++ b/sys-block/iscsitarget/files/iscsitarget-0.4.17-build.patch
@@ -0,0 +1,23 @@
+--- usr/Makefile
++++ 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)
diff --git a/sys-block/iscsitarget/files/iscsitarget-1.4.18+linux-2.6.32.patch b/sys-block/iscsitarget/files/iscsitarget-1.4.18+linux-2.6.32.patch
new file mode 100644
index 000000000000..f139e732e7de
--- /dev/null
+++ b/sys-block/iscsitarget/files/iscsitarget-1.4.18+linux-2.6.32.patch
@@ -0,0 +1,42 @@
+From 43227c1624e919efcd0cd035516c1776be55ac08 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Diego=20Elio=20'Flameeyes'=20Petten=C3=B2?= <flameeyes@gmail.com>
+Date: Sun, 18 Oct 2009 12:41:28 +0200
+Subject: [PATCH] Fix building with Linux kernel 2.6.32 and later.
+
+With commit 18f2ee705d98034b0f229a3202d827468d4bffd9 of the Linux kernel,
+the sync_page_range() function has been removed.
+
+This patch changes it to filemap_write_and_wait_range() as done for the XFS
+driver in the kernel (commit af0f4414f343429971d33b0dd8dccc85c1f3dcd2).
+---
+ kernel/file-io.c | 6 ++++++
+ 1 files changed, 6 insertions(+), 0 deletions(-)
+
+diff --git a/kernel/file-io.c b/kernel/file-io.c
+index dbf7b1c..e4c3fea 100644
+--- a/kernel/file-io.c
++++ b/kernel/file-io.c
+@@ -8,6 +8,7 @@
+ #include <linux/blkdev.h>
+ #include <linux/parser.h>
+ #include <linux/writeback.h>
++#include <linux/version.h>
+
+ #include "iscsi.h"
+ #include "iscsi_dbg.h"
+@@ -88,7 +89,12 @@ static int fileio_sync(struct iet_volume *lu, struct tio *tio)
+ count = lu->blk_cnt << lu->blk_shift;
+ }
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 32)
+ res = sync_page_range(inode, mapping, ppos, count);
++#else
++ res = filemap_write_and_wait_range(mapping, ppos,
++ ppos + count -1);
++#endif
+ if (res) {
+ eprintk("I/O error: syncing pages failed: %d\n", res);
+ return -EIO;
+--
+1.6.5
+
diff --git a/sys-block/iscsitarget/files/iscsitarget-1.4.19+linux-2.6.33.patch b/sys-block/iscsitarget/files/iscsitarget-1.4.19+linux-2.6.33.patch
new file mode 100644
index 000000000000..3c2e4e426282
--- /dev/null
+++ b/sys-block/iscsitarget/files/iscsitarget-1.4.19+linux-2.6.33.patch
@@ -0,0 +1,12 @@
+diff -p -up iscsitarget-1.4.19-1mdv2010.1/kernel/conn.c.2.6.33 iscsitarget-1.4.19-1mdv2010.1/kernel/conn.c
+--- iscsitarget-1.4.19-1mdv2010.1/kernel/conn.c.2.6.33 2010-02-21 13:07:29.000000000 +0100
++++ iscsitarget-1.4.19-1mdv2010.1/kernel/conn.c 2010-02-21 13:41:38.641365087 +0100
+@@ -43,7 +43,7 @@ void conn_info_show(struct seq_file *seq
+ switch (sk->sk_family) {
+ case AF_INET:
+ snprintf(buf, sizeof(buf),
+- "%u.%u.%u.%u", NIPQUAD(inet_sk(sk)->daddr));
++ "%u.%u.%u.%u", NIPQUAD(inet_sk(sk)->inet_daddr));
+ break;
+ case AF_INET6:
+ snprintf(buf, sizeof(buf), "[%pI6]",
diff --git a/sys-block/iscsitarget/files/iscsitarget-1.4.20.2-respect-flags-v2.patch b/sys-block/iscsitarget/files/iscsitarget-1.4.20.2-respect-flags-v2.patch
new file mode 100644
index 000000000000..b675afff08ae
--- /dev/null
+++ b/sys-block/iscsitarget/files/iscsitarget-1.4.20.2-respect-flags-v2.patch
@@ -0,0 +1,10 @@
+Index: usr/Makefile
+===================================================================
+--- usr/Makefile (revision 446)
++++ usr/Makefile (working copy)
+@@ -1,4 +1,4 @@
+-CFLAGS += -O2 -fno-inline -Wall -Wstrict-prototypes -I../include
++CFLAGS += -fno-inline -Wall -Wstrict-prototypes -I../include
+ CFLAGS += -D_GNU_SOURCE # required for glibc >= 2.8
+ PROGRAMS = ietd ietadm
+ LIBS =
diff --git a/sys-block/iscsitarget/files/iscsitarget-1.4.20.2-respect-flags.patch b/sys-block/iscsitarget/files/iscsitarget-1.4.20.2-respect-flags.patch
new file mode 100644
index 000000000000..347650ab9407
--- /dev/null
+++ b/sys-block/iscsitarget/files/iscsitarget-1.4.20.2-respect-flags.patch
@@ -0,0 +1,32 @@
+--- a/Makefile
++++ b/Makefile
+@@ -26,7 +26,7 @@
+ endif
+ endif
+
+-KVER := $(shell $(CC) $(CFLAGS) -E -dM $(VERSION_FILE) | \
++KVER := $(shell $(CC) $(CFLAGS) $(LDFLAGS) -E -dM $(VERSION_FILE) | \
+ grep UTS_RELEASE | awk '{ print $$3 }' | sed 's/\"//g')
+
+ KMOD := /lib/modules/$(KVER)/extra
+--- a/usr/Makefile
++++ b/usr/Makefile
+@@ -1,4 +1,4 @@
+-CFLAGS += -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include
++CFLAGS += -fno-inline -Wall -Wstrict-prototypes -I../include
+ CFLAGS += -D_GNU_SOURCE # required for glibc >= 2.8
+ PROGRAMS = ietd ietadm
+ LIBS =
+@@ -7,10 +7,10 @@
+
+ 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 md5.o sha1.o
+
+- $(CC) $^ -o $@ $(LIBS)
++ $(CC) $(LDFLAGS) $^ -o $@ $(LIBS)
+
+ ietadm: ietadm.o param.o
+- $(CC) $^ -o $@
++ $(CC) $(LDFLAGS) $^ -o $@
+
+ clean:
+ rm -f *.o $(PROGRAMS)
diff --git a/sys-block/iscsitarget/files/iscsitarget-1.4.20.2_kernel-2.6.36.patch b/sys-block/iscsitarget/files/iscsitarget-1.4.20.2_kernel-2.6.36.patch
new file mode 100644
index 000000000000..63c50b093368
--- /dev/null
+++ b/sys-block/iscsitarget/files/iscsitarget-1.4.20.2_kernel-2.6.36.patch
@@ -0,0 +1,12 @@
+--- trunk/kernel/conn.c (revision 372)
++++ trunk/kernel/conn.c (working copy)
+@@ -44,7 +44,7 @@
+ switch (sk->sk_family) {
+ case AF_INET:
+ snprintf(buf, sizeof(buf),
+- "%u.%u.%u.%u", NIPQUAD(inet_sk(sk)->inet_daddr));
++ "%pI4", inet_sk(sk)->inet_daddr);
+ break;
+ case AF_INET6:
+ snprintf(buf, sizeof(buf), "[%pI6]",
+
diff --git a/sys-block/iscsitarget/files/iscsitarget-1.4.20.2_p20130103-fix-3.2-support.patch b/sys-block/iscsitarget/files/iscsitarget-1.4.20.2_p20130103-fix-3.2-support.patch
new file mode 100644
index 000000000000..d41751535d31
--- /dev/null
+++ b/sys-block/iscsitarget/files/iscsitarget-1.4.20.2_p20130103-fix-3.2-support.patch
@@ -0,0 +1,135 @@
+diff --git a/Makefile b/Makefile
+index df41642..f2f17c8 100644
+--- a/Makefile
++++ b/Makefile
+@@ -46,18 +46,10 @@ kver_lt = $(shell [ $(KMAJ) -lt $(1) -o \
+ $(KMAJ) -eq $(1) -a $(KMIN) -lt $(2) -o \
+ $(KMAJ) -eq $(1) -a $(KMIN) -eq $(2) -a $(KREV) -lt $(3) ] && \
+ echo 1 || echo 0)
+-kver_le = $(shell [ $(KMAJ) -lt $(1) -o \
+- $(KMAJ) -eq $(1) -a $(KMIN) -lt $(2) -o \
+- $(KMAJ) -eq $(1) -a $(KMIN) -eq $(2) -a $(KREV) -le $(3) ] && \
+- echo 1 || echo 0)
+-kver_gt = $(shell [ ( $(KMAJ) -gt $(1) ) -o \
++kver_gt = $(shell [ $(KMAJ) -gt $(1) -o \
+ $(KMAJ) -eq $(1) -a $(KMIN) -gt $(2) -o \
+ $(KMAJ) -eq $(1) -a $(KMIN) -eq $(2) -a $(KREV) -gt $(3) ] && \
+ echo 1 || echo 0)
+-kver_ge = $(shell [ ( $(KMAJ) -gt $(1) ) -o \
+- $(KMAJ) -eq $(1) -a $(KMIN) -gt $(2) -o \
+- $(KMAJ) -eq $(1) -a $(KMIN) -eq $(2) -a $(KREV) -ge $(3) ] && \
+- echo 1 || echo 0)
+ kver_lk = $(shell [ `echo $(KVER) | egrep $(1)` ] && echo 1 || echo 0)
+
+ #
+@@ -66,85 +58,93 @@ kver_lk = $(shell [ `echo $(KVER) | egrep $(1)` ] && echo 1 || echo 0)
+ # base first the earlier patch sets will not need to be modified.
+ #
+
+-ifeq ($(call kver_le,3,5,0),1)
++ifeq ($(call kver_lt,3,6,0),1)
+ PATCHES := $(PATCHES) compat-3.5.patch
+ endif
+
+-ifeq ($(call kver_le,3,4,0),1)
++ifeq ($(call kver_lt,3,5,0),1)
+ PATCHES := $(PATCHES) compat-3.2-3.4.patch
+ endif
+
+-ifeq ($(call kver_le,3,2,0),1)
++ifeq ($(call kver_lt,3,3,0),1)
+ PATCHES := $(PATCHES) compat-2.6.39-3.2.patch
+ endif
+
+-ifeq ($(call kver_le,2,6,38),1)
++ifeq ($(call kver_lt,2,6,39),1)
+ PATCHES := $(PATCHES) compat-2.6.38.patch
+ endif
+
+-ifeq ($(call kver_le,2,6,37),1)
++ifeq ($(call kver_lt,2,6,38),1)
+ PATCHES := $(PATCHES) compat-2.6.36-2.6.37.patch
+ endif
+
+ # Compatibility patch for kernels > 2.6.32 <= 2.6.35
+-ifeq ($(call kver_le,2,6,35),1)
++ifeq ($(call kver_lt,2,6,36),1)
++ifeq ($(call kver_gt,2,6,32),1)
+ PATCHES := $(PATCHES) compat-2.6.33-2.6.35.patch
+ endif
++endif
+
+ # Compatibility patch for kernels <= 2.6.32
+-ifeq ($(call kver_le,2,6,32),1)
++ifeq ($(call kver_lt,2,6,33),1)
+ PATCHES := $(PATCHES) compat-2.6.32.patch
+ endif
+
+ # Compatibility patch for kernels <= 2.6.31
+-ifeq ($(call kver_le,2,6,31),1)
++ifeq ($(call kver_lt,2,6,32),1)
+ PATCHES := $(PATCHES) compat-2.6.31.patch
+ endif
+
+ # Compatibility patch for kernels <= 2.6.30
+-ifeq ($(call kver_le,2,6,30),1)
++ifeq ($(call kver_lt,2,6,31),1)
+ PATCHES := $(PATCHES) compat-2.6.30.patch
+ endif
+
+ # Compatibility patch for kernels <= 2.6.29
+-ifeq ($(call kver_le,2,6,29),1)
++ifeq ($(call kver_lt,2,6,30),1)
+ PATCHES := $(PATCHES) compat-2.6.29.patch
+ endif
+
+ # Compatibility patch for kernels <= 2.6.28
+-ifeq ($(call kver_le,2,6,28),1)
++ifeq ($(call kver_lt,2,6,29),1)
+ PATCHES := $(PATCHES) compat-2.6.28.patch
+ endif
+
+ # Compatibility patch for kernels >= 2.6.25 and <= 2.6.27
+-ifeq ($(call kver_le,2,6,27),1)
++ifeq ($(call kver_lt,2,6,28),1)
++ifeq ($(call kver_gt,2,6,24),1)
+ PATCHES := $(PATCHES) compat-2.6.25-2.6.27.patch
+ endif
++endif
+
+ # Compatibility patch for kernels <= 2.6.24
+-ifeq ($(call kver_le,2,6,24),1)
++ifeq ($(call kver_lt,2,6,25),1)
+ PATCHES := $(PATCHES) compat-2.6.24.patch
+ endif
+
+ # Compatibility patch for kernels <= 2.6.23
+-ifeq ($(call kver_le,2,6,23),1)
++ifeq ($(call kver_lt,2,6,24),1)
+ PATCHES := $(PATCHES) compat-2.6.23.patch
+ endif
+
+ # Compatibility patch for kernels <= 2.6.22
+-ifeq ($(call kver_le,2,6,22),1)
++ifeq ($(call kver_lt,2,6,23),1)
+ PATCHES := $(PATCHES) compat-2.6.22.patch
+ endif
+
+ # Compatibility patch for kernels >= 2.6.19 and <= 2.6.21
+-ifeq ($(call kver_le,2,6,21),1)
++ifeq ($(call kver_lt,2,6,22),1)
++ifeq ($(call kver_gt,2,6,18),1)
+ PATCHES := $(PATCHES) compat-2.6.19-2.6.21.patch
+ endif
++endif
+
+ # Compatibility patch for kernels >= 2.6.14 and <= 2.6.18
+-ifeq ($(call kver_le,2,6,18),1)
++ifeq ($(call kver_lt,2,6,19),1)
++ifeq ($(call kver_gt,2,6,13),1)
+ PATCHES := $(PATCHES) compat-2.6.14-2.6.18.patch
+ endif
++endif
+
+ # We don't support kernels < 2.6.14 except for explicit distros
+ ifeq ($(call kver_lt,2,6,14),1)
diff --git a/sys-block/iscsitarget/files/iscsitarget-1.4.20.2_p20130103-restore-linux-2.6.32-support.patch b/sys-block/iscsitarget/files/iscsitarget-1.4.20.2_p20130103-restore-linux-2.6.32-support.patch
new file mode 100644
index 000000000000..cc6a0b8c7e3c
--- /dev/null
+++ b/sys-block/iscsitarget/files/iscsitarget-1.4.20.2_p20130103-restore-linux-2.6.32-support.patch
@@ -0,0 +1,96 @@
+diff --git a/kernel/iscsi.c b/kernel/iscsi.c
+index 9ad3047..37d7753 100644
+--- a/kernel/iscsi.c
++++ b/kernel/iscsi.c
+@@ -773,6 +773,7 @@ static void set_offset_and_length(const struct iet_volume *lu,
+ break;
+ case READ_16:
+ case WRITE_16:
++#ifdef WRITE_SAME_16
+ case WRITE_SAME_16:
+ *off = (u64)cmd[2] << 56 | (u64)cmd[3] << 48 |
+ (u64)cmd[4] << 40 | (u64)cmd[5] << 32 |
+@@ -781,6 +782,7 @@ static void set_offset_and_length(const struct iet_volume *lu,
+ *len = (u32)cmd[10] << 24 | (u32)cmd[11] << 16 |
+ (u32)cmd[12] << 8 | (u32)cmd[13];
+ break;
++#endif
+ case PERSISTENT_RESERVE_OUT:
+ {
+ const struct persistent_reserve_out *pr_out =
+@@ -1036,6 +1038,7 @@ static void scsi_cmnd_start(struct iscsi_conn *conn, struct iscsi_cmnd *req)
+ case WRITE_10:
+ case WRITE_16:
+ case WRITE_VERIFY:
++#ifdef WRITE_SAME_16
+ case WRITE_SAME_16:
+ {
+ struct iscsi_sess_param *param = &conn->session->param;
+@@ -1104,6 +1107,7 @@ static void scsi_cmnd_start(struct iscsi_conn *conn, struct iscsi_cmnd *req)
+ }
+ break;
+ }
++#endif
+ error:
+ default:
+ eprintk("Unsupported %x\n", req_hdr->scb[0]);
+diff --git a/kernel/iscsi_dbg.h b/kernel/iscsi_dbg.h
+index 8c9b928..ad5c6d4 100644
+--- a/kernel/iscsi_dbg.h
++++ b/kernel/iscsi_dbg.h
+@@ -12,7 +12,9 @@
+ #define D_IOMODE (1UL << 8)
+ #define D_UAC (1UL << 9)
+ #define D_PR (1UL << 10)
++#ifdef WRITE_SAME_16
+ #define D_VAAI (1UL << 11)
++#endif
+
+ #define D_DATA (D_READ | D_WRITE)
+
+diff --git a/kernel/target_disk.c b/kernel/target_disk.c
+index 6b1de2c..ca28e4e 100644
+--- a/kernel/target_disk.c
++++ b/kernel/target_disk.c
+@@ -408,6 +408,7 @@ static void build_write_response(struct iscsi_cmnd *cmnd)
+ iscsi_cmnd_set_sense(cmnd, MEDIUM_ERROR, 0x03, 0x0);
+ }
+
++#ifdef WRITE_SAME_16
+ static void build_write_same_response(struct iscsi_cmnd *cmnd) {
+ int err;
+ struct tio *target_tio;
+@@ -475,6 +476,7 @@ static void build_write_same_response(struct iscsi_cmnd *cmnd) {
+
+ tio_put(target_tio);
+ }
++#endif
+
+ static void build_sync_cache_response(struct iscsi_cmnd *cmnd)
+ {
+@@ -618,9 +620,11 @@ static int disk_execute_cmnd(struct iscsi_cmnd *cmnd)
+ case WRITE_VERIFY:
+ send_scsi_rsp(cmnd, build_write_response);
+ break;
++#ifdef WRITE_SAME_16
+ case WRITE_SAME_16:
+ send_scsi_rsp(cmnd, build_write_same_response);
+ break;
++#endif
+ case SYNCHRONIZE_CACHE:
+ send_scsi_rsp(cmnd, build_sync_cache_response);
+ break;
+diff --git a/kernel/volume.c b/kernel/volume.c
+index 8beeb1e..6ad2a3d 100644
+--- a/kernel/volume.c
++++ b/kernel/volume.c
+@@ -446,7 +446,9 @@ int is_volume_reserved(struct iet_volume *volume, u64 sid, u8 *scb)
+ case WRITE_10:
+ case WRITE_12:
+ case WRITE_16:
++#ifdef WRITE_SAME_16
+ case WRITE_SAME_16:
++#endif
+ case WRITE_VERIFY:
+ case SYNCHRONIZE_CACHE:
+ if (write_excl || excl_access)
diff --git a/sys-block/iscsitarget/iscsitarget-0.4.17.ebuild b/sys-block/iscsitarget/iscsitarget-0.4.17.ebuild
new file mode 100644
index 000000000000..1eb351bdd7c6
--- /dev/null
+++ b/sys-block/iscsitarget/iscsitarget-0.4.17.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit linux-mod eutils flag-o-matic
+
+DESCRIPTION="Open Source iSCSI target with professional features"
+HOMEPAGE="http://iscsitarget.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE=""
+
+DEPEND="dev-libs/openssl"
+RDEPEND="${DEPEND}"
+
+MODULE_NAMES="iscsi_trgt(misc:${S}/kernel)"
+CONFIG_CHECK="CRYPTO_CRC32C"
+ERROR_CFG="iscsitarget needs support for CRC32C in your kernel."
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${PN}-0.4.15-isns-set-scn-flag.patch #180619
+ epatch "${FILESDIR}"/${PN}-0.4.17-build.patch
+ epatch "${FILESDIR}"/${PN}-0.4.17+linux-2.6.28.patch #252608
+ epatch "${FILESDIR}"/${PN}-0.4.17+linux-2.6.29.patch
+ epatch "${FILESDIR}"/${PN}-0.4.17+linux-2.6.30.patch
+ convert_to_m "${S}"/Makefile
+}
+
+src_compile() {
+ emake usr || die "failed to build userspace"
+
+ unset ARCH
+ filter-ldflags -Wl,*
+ emake KSRC="${KERNEL_DIR}" kernel || die "failed to build module"
+}
+
+src_install() {
+ einfo "Installing userspace"
+ dosbin usr/ietd usr/ietadm || die "dosbin failed"
+ insinto /etc
+ doins etc/ietd.conf etc/initiators.{allow,deny} || die "doins failed"
+ # Upstream's provided Gentoo init script is out of date compared to
+ # their Debian init script. And isn't that nice.
+ #newinitd etc/initd/initd.gentoo ietd || die
+ newinitd "${FILESDIR}"/ietd-init.d-2 ietd || die "newinitd failed"
+ newconfd "${FILESDIR}"/ietd-conf.d ietd || die "newconfd failed"
+
+ # Lock down perms, per bug 198209
+ fperms 0640 /etc/ietd.conf /etc/initiators.{allow,deny}
+
+ doman doc/manpages/*.[1-9] || die "manpages failed"
+ dodoc ChangeLog README || die "docs failed"
+
+ einfo "Installing kernel module"
+ unset ARCH
+ linux-mod_src_install || die "modules failed"
+}
diff --git a/sys-block/iscsitarget/iscsitarget-1.4.19.ebuild b/sys-block/iscsitarget/iscsitarget-1.4.19.ebuild
new file mode 100644
index 000000000000..fb1b1a6b2a73
--- /dev/null
+++ b/sys-block/iscsitarget/iscsitarget-1.4.19.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit linux-mod eutils flag-o-matic
+
+DESCRIPTION="Open Source iSCSI target with professional features"
+HOMEPAGE="http://iscsitarget.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE=""
+
+DEPEND="dev-libs/openssl"
+RDEPEND="${DEPEND}"
+
+MODULE_NAMES="iscsi_trgt(misc:${S}/kernel)"
+CONFIG_CHECK="CRYPTO_CRC32C"
+ERROR_CFG="iscsitarget needs support for CRC32C in your kernel."
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${PN}-0.4.15-isns-set-scn-flag.patch #180619
+ epatch "${FILESDIR}"/${PN}-0.4.17-build.patch
+ epatch "${FILESDIR}"/${PN}-1.4.18+linux-2.6.32.patch
+ if kernel_is ge 2 6 33; then
+ epatch "${FILESDIR}"/${PN}-1.4.19+linux-2.6.33.patch
+ fi
+ convert_to_m "${S}"/Makefile
+}
+
+src_compile() {
+ emake KSRC="${KERNEL_DIR}" usr || die "failed to build userspace"
+
+ unset ARCH
+ filter-ldflags -Wl,*
+ emake KSRC="${KERNEL_DIR}" kernel || die "failed to build module"
+}
+
+src_install() {
+ einfo "Installing userspace"
+
+ # Install ietd into libexec; we don't need ietd to be in the path
+ # for ROOT, since it's just a service.
+ exeinto /usr/libexec
+ doexe usr/ietd || die "doexe ietd failed"
+
+ dosbin usr/ietadm || die "dosbin failed"
+
+ insinto /etc
+ doins etc/ietd.conf etc/initiators.allow || die "doins failed"
+
+ # We moved ietd in /usr/libexec, so update the init script accordingly.
+ sed -e 's:/usr/sbin/ietd:/usr/libexec/ietd:' "${FILESDIR}"/ietd-init.d-2 > "${T}"/ietd-init.d
+ newinitd "${T}"/ietd-init.d ietd || die "newinitd failed"
+ newconfd "${FILESDIR}"/ietd-conf.d ietd || die "newconfd failed"
+
+ # Lock down perms, per bug 198209
+ fperms 0640 /etc/ietd.conf /etc/initiators.{allow,deny}
+
+ doman doc/manpages/*.[1-9] || die "manpages failed"
+ dodoc ChangeLog README RELEASE_NOTES README.initiators README.vmware || die "docs failed"
+
+ einfo "Installing kernel module"
+ unset ARCH
+ linux-mod_src_install || die "modules failed"
+}
diff --git a/sys-block/iscsitarget/iscsitarget-1.4.20.2.ebuild b/sys-block/iscsitarget/iscsitarget-1.4.20.2.ebuild
new file mode 100644
index 000000000000..fcfa6e15b4d6
--- /dev/null
+++ b/sys-block/iscsitarget/iscsitarget-1.4.20.2.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit linux-mod eutils flag-o-matic
+
+DESCRIPTION="Open Source iSCSI target with professional features"
+HOMEPAGE="http://iscsitarget.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE=""
+
+DEPEND="dev-libs/openssl"
+RDEPEND="${DEPEND}"
+
+MODULE_NAMES="iscsi_trgt(misc:${S}/kernel)"
+CONFIG_CHECK="CRYPTO_CRC32C"
+ERROR_CFG="iscsitarget needs support for CRC32C in your kernel."
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${PN}-0.4.15-isns-set-scn-flag.patch #180619
+ # Respect LDFLAGS. Bug #350742
+ epatch "${FILESDIR}"/${P}-respect-flags.patch
+ # NIPQUAD removed in 2.6.36, #340449
+ if kernel_is ge 2 6 36; then
+ epatch "${FILESDIR}"/iscsitarget-1.4.20.2_kernel-2.6.36.patch
+ fi
+ convert_to_m "${S}"/Makefile
+}
+
+src_compile() {
+ emake KSRC="${KERNEL_DIR}" usr || die
+
+ unset ARCH
+ filter-ldflags -Wl,*
+ emake KSRC="${KERNEL_DIR}" kernel || die
+}
+
+src_install() {
+ einfo "Installing userspace"
+
+ # Install ietd into libexec; we don't need ietd to be in the path
+ # for ROOT, since it's just a service.
+ exeinto /usr/libexec
+ doexe usr/ietd || die
+
+ dosbin usr/ietadm || die
+
+ insinto /etc
+ doins etc/ietd.conf etc/initiators.allow || die
+
+ # We moved ietd in /usr/libexec, so update the init script accordingly.
+ sed -e 's:/usr/sbin/ietd:/usr/libexec/ietd:' "${FILESDIR}"/ietd-init.d-2 > "${T}"/ietd-init.d
+ newinitd "${T}"/ietd-init.d ietd || die
+ newconfd "${FILESDIR}"/ietd-conf.d ietd || die
+
+ # Lock down perms, per bug 198209
+ fperms 0640 /etc/ietd.conf /etc/initiators.allow
+
+ doman doc/manpages/*.[1-9] || die
+ dodoc ChangeLog README RELEASE_NOTES README.initiators README.vmware || die
+
+ einfo "Installing kernel module"
+ unset ARCH
+ linux-mod_src_install || die
+}
diff --git a/sys-block/iscsitarget/iscsitarget-1.4.20.2_p20130103.ebuild b/sys-block/iscsitarget/iscsitarget-1.4.20.2_p20130103.ebuild
new file mode 100644
index 000000000000..75c1bae0e40d
--- /dev/null
+++ b/sys-block/iscsitarget/iscsitarget-1.4.20.2_p20130103.ebuild
@@ -0,0 +1,94 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit linux-mod eutils flag-o-matic
+
+if [ ${PV} == "9999" ] ; then
+ inherit subversion
+ ESVN_REPO_URI="http://svn.code.sf.net/p/iscsitarget/code/trunk"
+else
+ SRC_URI="http://dev.gentoo.org/~ryao/dist/${P}.tar.gz"
+ KEYWORDS="amd64 ~ppc x86"
+fi
+
+DESCRIPTION="Open Source iSCSI target with professional features"
+HOMEPAGE="http://iscsitarget.sourceforge.net/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+DEPEND="dev-libs/openssl"
+RDEPEND="${DEPEND}"
+
+MODULE_NAMES="iscsi_trgt(misc:${S}/kernel)"
+
+pkg_setup() {
+ CONFIG_CHECK="CRYPTO_CRC32C"
+ ERROR_CFG="iscsitarget needs support for CRC32C in your kernel."
+
+ kernel_is ge 2 6 14 || die "Linux 2.6.14 or newer required"
+
+ [ ${PV} != "9999" ] && \
+ { kernel_is le 3 6 || die "Linux 3.6 is the latest supported version."; }
+
+ linux-mod_pkg_setup
+}
+src_prepare() {
+ if [ ${PV} != "9999" ]
+ then
+ # Fix build system to apply proper patches
+ epatch "${FILESDIR}/${PN}-1.4.20.2_p20130103-fix-3.2-support.patch"
+
+ # Respect LDFLAGS. Bug #365735
+ epatch "${FILESDIR}/${PN}-1.4.20.2-respect-flags-v2.patch"
+
+ # Avoid use of WRITE_SAME_16 in Linux 2.6.32 and earlier
+ epatch "${FILESDIR}/${PN}-1.4.20.2_p20130103-restore-linux-2.6.32-support.patch"
+ fi
+
+ # Apply kernel-specific patches
+ emake KSRC="${KERNEL_DIR}" patch || die
+
+ epatch_user
+}
+
+src_compile() {
+ emake KSRC="${KERNEL_DIR}" usr || die
+
+ unset ARCH
+ filter-ldflags -Wl,*
+ emake KSRC="${KERNEL_DIR}" kernel || die
+}
+
+src_install() {
+ einfo "Installing userspace"
+
+ # Install ietd into libexec; we don't need ietd to be in the path
+ # for ROOT, since it's just a service.
+ exeinto /usr/libexec
+ doexe usr/ietd || die
+
+ dosbin usr/ietadm || die
+
+ insinto /etc
+ doins etc/ietd.conf etc/initiators.allow || die
+
+ # We moved ietd in /usr/libexec, so update the init script accordingly.
+ sed -e 's:/usr/sbin/ietd:/usr/libexec/ietd:' "${FILESDIR}"/ietd-init.d-2 > "${T}"/ietd-init.d
+ newinitd "${T}"/ietd-init.d ietd || die
+ newconfd "${FILESDIR}"/ietd-conf.d ietd || die
+
+ # Lock down perms, per bug 198209
+ fperms 0640 /etc/ietd.conf /etc/initiators.allow
+
+ doman doc/manpages/*.[1-9] || die
+ dodoc ChangeLog README RELEASE_NOTES README.initiators README.mcs README.vmware || die
+
+ einfo "Installing kernel module"
+ unset ARCH
+ linux-mod_src_install || die
+}
diff --git a/sys-block/iscsitarget/iscsitarget-1.4.20.2_p20130821.ebuild b/sys-block/iscsitarget/iscsitarget-1.4.20.2_p20130821.ebuild
new file mode 100644
index 000000000000..47386548e4dd
--- /dev/null
+++ b/sys-block/iscsitarget/iscsitarget-1.4.20.2_p20130821.ebuild
@@ -0,0 +1,94 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit linux-mod eutils flag-o-matic
+
+if [ ${PV} == "9999" ] ; then
+ inherit subversion
+ ESVN_REPO_URI="http://svn.code.sf.net/p/iscsitarget/code/trunk"
+else
+ SRC_URI="http://dev.gentoo.org/~ryao/dist/${P}.tar.xz"
+ KEYWORDS="amd64 ~ppc x86"
+fi
+
+DESCRIPTION="Open Source iSCSI target with professional features"
+HOMEPAGE="http://iscsitarget.sourceforge.net/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+DEPEND="dev-libs/openssl"
+RDEPEND="${DEPEND}"
+
+MODULE_NAMES="iscsi_trgt(misc:${S}/kernel)"
+
+pkg_setup() {
+ CONFIG_CHECK="CRYPTO_CRC32C"
+ ERROR_CFG="iscsitarget needs support for CRC32C in your kernel."
+
+ kernel_is ge 2 6 14 || die "Linux 2.6.14 or newer required"
+
+ [ ${PV} != "9999" ] && \
+ { kernel_is le 3 11 || die "Linux 3.11 is the latest supported version."; }
+
+ linux-mod_pkg_setup
+}
+src_prepare() {
+ if [ ${PV} != "9999" ]
+ then
+ # Fix build system to apply proper patches
+ epatch "${FILESDIR}/${PN}-1.4.20.2_p20130103-fix-3.2-support.patch"
+
+ # Respect LDFLAGS. Bug #365735
+ epatch "${FILESDIR}/${PN}-1.4.20.2-respect-flags-v2.patch"
+
+ # Avoid use of WRITE_SAME_16 in Linux 2.6.32 and earlier
+ epatch "${FILESDIR}/${PN}-1.4.20.2_p20130103-restore-linux-2.6.32-support.patch"
+ fi
+
+ # Apply kernel-specific patches
+ emake KSRC="${KERNEL_DIR}" patch || die
+
+ epatch_user
+}
+
+src_compile() {
+ emake KSRC="${KERNEL_DIR}" usr || die
+
+ unset ARCH
+ filter-ldflags -Wl,*
+ emake KSRC="${KERNEL_DIR}" kernel || die
+}
+
+src_install() {
+ einfo "Installing userspace"
+
+ # Install ietd into libexec; we don't need ietd to be in the path
+ # for ROOT, since it's just a service.
+ exeinto /usr/libexec
+ doexe usr/ietd || die
+
+ dosbin usr/ietadm || die
+
+ insinto /etc
+ doins etc/ietd.conf etc/initiators.allow || die
+
+ # We moved ietd in /usr/libexec, so update the init script accordingly.
+ sed -e 's:/usr/sbin/ietd:/usr/libexec/ietd:' "${FILESDIR}"/ietd-init.d-2 > "${T}"/ietd-init.d
+ newinitd "${T}"/ietd-init.d ietd || die
+ newconfd "${FILESDIR}"/ietd-conf.d ietd || die
+
+ # Lock down perms, per bug 198209
+ fperms 0640 /etc/ietd.conf /etc/initiators.allow
+
+ doman doc/manpages/*.[1-9] || die
+ dodoc ChangeLog README RELEASE_NOTES README.initiators README.mcs README.vmware || die
+
+ einfo "Installing kernel module"
+ unset ARCH
+ linux-mod_src_install || die
+}
diff --git a/sys-block/iscsitarget/iscsitarget-9999.ebuild b/sys-block/iscsitarget/iscsitarget-9999.ebuild
new file mode 100644
index 000000000000..fe90194e9fdf
--- /dev/null
+++ b/sys-block/iscsitarget/iscsitarget-9999.ebuild
@@ -0,0 +1,94 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit linux-mod eutils flag-o-matic
+
+if [ ${PV} == "9999" ] ; then
+ inherit subversion
+ ESVN_REPO_URI="http://svn.code.sf.net/p/iscsitarget/code/trunk"
+else
+ SRC_URI="http://dev.gentoo.org/~ryao/dist/${P}.tar.xz"
+ KEYWORDS="~amd64 ~ppc ~x86"
+fi
+
+DESCRIPTION="Open Source iSCSI target with professional features"
+HOMEPAGE="http://iscsitarget.sourceforge.net/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+DEPEND="dev-libs/openssl"
+RDEPEND="${DEPEND}"
+
+MODULE_NAMES="iscsi_trgt(misc:${S}/kernel)"
+
+pkg_setup() {
+ CONFIG_CHECK="CRYPTO_CRC32C"
+ ERROR_CFG="iscsitarget needs support for CRC32C in your kernel."
+
+ kernel_is ge 2 6 14 || die "Linux 2.6.14 or newer required"
+
+ [ ${PV} != "9999" ] && \
+ { kernel_is le 3 11 || die "Linux 3.11 is the latest supported version."; }
+
+ linux-mod_pkg_setup
+}
+src_prepare() {
+ if [ ${PV} != "9999" ]
+ then
+ # Fix build system to apply proper patches
+ epatch "${FILESDIR}/${PN}-1.4.20.2_p20130103-fix-3.2-support.patch"
+
+ # Respect LDFLAGS. Bug #365735
+ epatch "${FILESDIR}/${PN}-1.4.20.2-respect-flags-v2.patch"
+
+ # Avoid use of WRITE_SAME_16 in Linux 2.6.32 and earlier
+ epatch "${FILESDIR}/${PN}-1.4.20.2_p20130103-restore-linux-2.6.32-support.patch"
+ fi
+
+ # Apply kernel-specific patches
+ emake KSRC="${KERNEL_DIR}" patch || die
+
+ epatch_user
+}
+
+src_compile() {
+ emake KSRC="${KERNEL_DIR}" usr || die
+
+ unset ARCH
+ filter-ldflags -Wl,*
+ emake KSRC="${KERNEL_DIR}" kernel || die
+}
+
+src_install() {
+ einfo "Installing userspace"
+
+ # Install ietd into libexec; we don't need ietd to be in the path
+ # for ROOT, since it's just a service.
+ exeinto /usr/libexec
+ doexe usr/ietd || die
+
+ dosbin usr/ietadm || die
+
+ insinto /etc
+ doins etc/ietd.conf etc/initiators.allow || die
+
+ # We moved ietd in /usr/libexec, so update the init script accordingly.
+ sed -e 's:/usr/sbin/ietd:/usr/libexec/ietd:' "${FILESDIR}"/ietd-init.d-2 > "${T}"/ietd-init.d
+ newinitd "${T}"/ietd-init.d ietd || die
+ newconfd "${FILESDIR}"/ietd-conf.d ietd || die
+
+ # Lock down perms, per bug 198209
+ fperms 0640 /etc/ietd.conf /etc/initiators.allow
+
+ doman doc/manpages/*.[1-9] || die
+ dodoc ChangeLog README RELEASE_NOTES README.initiators README.mcs README.vmware || die
+
+ einfo "Installing kernel module"
+ unset ARCH
+ linux-mod_src_install || die
+}
diff --git a/sys-block/iscsitarget/metadata.xml b/sys-block/iscsitarget/metadata.xml
new file mode 100644
index 000000000000..630808c221b3
--- /dev/null
+++ b/sys-block/iscsitarget/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>base-system</herd>
+ <maintainer>
+ <email>ryao@gentoo.org</email>
+ <name>Richard Yao</name>
+ <description>Primary maintainer</description>
+ </maintainer>
+</pkgmetadata>