network/iscsitarget: Updated for version 0.4.17

This commit is contained in:
Thales A. Tsailas 2010-05-13 00:36:50 +02:00 committed by Robby Workman
parent 403abc7072
commit f93704664e
8 changed files with 234 additions and 20 deletions

View file

@ -1,4 +1,5 @@
iSCSI Enterprise Target is for building an iSCSI storage system on
Linux.
This package makes all bindings that are supported on the system.
The aim of the project is to develop an open source iSCSI target with
professional features, that works well in enterprise environment under
real workload, and is scalable and versatile enough to meet the challenge
of future storage needs and developments. This package makes all bindings
that are supported on the system.

View file

@ -25,5 +25,5 @@ config etc/initiators.deny.new
config etc/initiators.allow.new
config etc/ietd.conf.new
chroot . depmod -a 2>/dev/null 1>/dev/null
chroot . depmod -a @KERNEL@ 2>/dev/null 1>/dev/null

View file

@ -0,0 +1,79 @@
Fix build with 2.6.29.
Addresses these changes:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=30c40d2c01f68c7eb1a41ab3552bdaf5dbf300d4;hp=9a1c3542768b5a58e45a9216921cd10a3bae1205
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=b189db5d299c6824780af5590564ff608adb3dea;hp=a20fd0a783551831bb6b9b69710e5bbb93dc2730
Lubomir Rintel <lkundrak@v3.sk>
Index: kernel/block-io.c
===================================================================
--- kernel/block-io.c (revision 198)
+++ kernel/block-io.c (working copy)
@@ -13,6 +13,7 @@
#include <linux/blkdev.h>
#include <linux/parser.h>
#include <linux/buffer_head.h>
+#include <linux/version.h>
#include "iscsi.h"
#include "iscsi_dbg.h"
@@ -154,14 +155,22 @@
{
struct blockio_data *bio_data = volume->private;
struct block_device *bdev;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
int flags = LUReadonly(volume) ? MS_RDONLY : 0;
+#else
+ fmode_t flags = LUReadonly(volume) ? FMODE_READ : (FMODE_READ | FMODE_WRITE);
+#endif
int err = 0;
bio_data->path = kstrdup(path, GFP_KERNEL);
if (!bio_data->path)
return -ENOMEM;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
bdev = open_bdev_excl(path, flags, THIS_MODULE);
+#else
+ bdev = open_bdev_exclusive(path, flags, THIS_MODULE);
+#endif
if (IS_ERR(bdev)) {
err = PTR_ERR(bdev);
eprintk("Can't open device %s, error %d\n", path, err);
@@ -324,8 +333,17 @@
{
struct blockio_data *bio_data = volume->private;
- if (bio_data->bdev)
+ if (bio_data->bdev) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
close_bdev_excl(bio_data->bdev);
+#else
+ if (LUReadonly(volume)) {
+ close_bdev_exclusive(bio_data->bdev, FMODE_READ);
+ } else {
+ close_bdev_exclusive(bio_data->bdev, FMODE_READ|FMODE_WRITE);
+ }
+#endif
+ }
kfree(bio_data->path);
kfree(volume->private);
Index: kernel/conn.c
===================================================================
--- kernel/conn.c (revision 198)
+++ kernel/conn.c (working copy)
@@ -46,9 +46,13 @@
"%u.%u.%u.%u", NIPQUAD(inet_sk(sk)->daddr));
break;
case AF_INET6:
+#ifdef NIP6
snprintf(buf, sizeof(buf),
"[%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]",
NIP6(inet6_sk(sk)->daddr));
+#else
+ snprintf(buf, sizeof(buf), "[%p6]", &inet6_sk(sk)->daddr);
+#endif
break;
default:
break;

View file

@ -0,0 +1,9 @@
diff -Nur iscsitarget-0.4.17.orig/usr/Makefile iscsitarget-0.4.17/usr/Makefile
--- iscsitarget-0.4.17.orig/usr/Makefile 2008-06-18 18:10:19.000000000 -0500
+++ iscsitarget-0.4.17/usr/Makefile 2009-10-10 22:09:54.221991340 -0500
@@ -1,4 +1,4 @@
-CFLAGS += -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include
+CFLAGS += $(OPTS) -fno-inline -Wall -Wstrict-prototypes -g -I../include
CFLAGS += -D_GNU_SOURCE # required for glibc >= 2.8
PROGRAMS = ietd ietadm
LIBS = -lcrypto

View file

@ -1,8 +1,30 @@
#!/bin/sh
# Slackware build script for iscsitarget 0.4.16
# Written by Thales A. Tsailas <ttsailas@enforcingit.com>
# Slackware SlackBuild script
# ===========================
# By: Thales A. Tsailas <ttsailas@enforcingit.com>
# For: iSCSI target
# Descr: Provides an open source professional iSCSI target solution for Linux
# URL: http://iscsitarget.sourceforge.net/
#
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=iscsitarget
VERSION=0.4.17
@ -10,7 +32,7 @@ ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
kernel=${kernel:-$(uname -r)}
KERNEL=${KERNEL:-$(uname -r)}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
@ -19,10 +41,13 @@ OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
SRCARCH=x86 # Needed for the kernel module building
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
SRCARCH=x86 # Needed for the kernel module building
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
SRCARCH=x86 # Needed for the kernel module building
fi
set -e
@ -36,14 +61,22 @@ cd $TMP/$PRGNAM-$VERSION
chown -R root:root .
chmod -R a-s,u+w,go+r-w .
# Patch the source to fix compiling issue with 2.6.29 kernels
patch -p0 < $CWD/iscsitarget-0.4.17-2.6.29.patch
# Allow use of our SLKCFLAGS for the non-kernel parts
patch -p1 < $CWD/iscsitarget-0.4.17-add_OPTS_cflags.patch
make \
OPTS="$SLKCFLAGS" \
MANDIR=/usr/man \
DOCDIR=/usr/doc/$PRGNAM-$VERSION \
KSRC=/lib/modules/$kernel/build
KSRC=/lib/modules/$KERNEL/build \
SRCARCH=$SRCARCH
make install \
MANDIR=/usr/man \
DOCDIR=/usr/doc/$PRGNAM-$VERSION \
KSRC=/lib/modules/$kernel/build \
KSRC=/lib/modules/$KERNEL/build \
DISTDIR=$PKG
# Rename init script and don't clobber existing config files on upgrade
@ -56,22 +89,23 @@ mv $PKG/etc/ietd.conf $PKG/etc/ietd.conf.new
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
# Remove some cruft that shouldn't be in the package
# (if I'm wrong, let me know) --rworkman
rm -f $PKG/lib/modules/$kernel/modules*
rm -f $PKG/lib/modules/$KERNEL/modules*
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \
xargs strip --strip-unneeded 2> /dev/null || true
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \
xargs strip --strip-unneeded 2> /dev/null
)
( cd $PKG/usr/man || exit 1
find . -type f -exec gzip -9 {} \;
for i in `find . -type l` ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
)
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
sed "s%@KERNEL@%$KERNEL%" $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View file

@ -3,6 +3,8 @@ VERSION="0.4.17"
HOMEPAGE="http://iscsitarget.sourceforge.net/"
DOWNLOAD="http://downloads.sourceforge.net/iscsitarget/iscsitarget-0.4.17.tar.gz"
MD5SUM="e79b437695fc50e7d054631855a16b1b"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
MAINTAINER="Thales A. Tsailas"
EMAIL="ttsailas@enforcingit.com"
APPROVED="rworkman"

View file

@ -0,0 +1,91 @@
#!/bin/bash
# Init script for the iSCSI Enterprise Target.
# http://iscsitarget.sourceforge.net/
# Written by Thales A. Tsailas For Slackware Linux
PATH=/sbin:/bin:/usr/sbin:/usr/bin
CONF=/etc/ietd.conf
PID=$(pidof ietd)
RETVAL=0
start()
{
# Load necessary modules
if [ ! "$PID" = '' ]; then
echo -en "iSCSI enterprise target is already running\n"
else
echo -en "Loading iSCSI enterprise target modules\n"
modprobe -q crc32c
modprobe iscsi_trgt
echo -en "Starting iSCSI enterprise target..."
/usr/sbin/ietd -c $CONF
sleep 1
if [ $RETVAL = "0" ]; then
echo -en "done.\n"
else
echo -en "failed.\n"
exit $RETVAL
fi
fi
}
stop()
{
if [ "$PID" = '' ]; then
echo -en "iSCSI enterprise target is not running\n"
else
echo -en "Stoping iSCSI enterprise target...\n"
ietadm --op delete
kill -9 $PID
echo -en "Unloading iSCSI enterprise target modules"
modprobe -r iscsi_trgt
sleep 1
if [ $RETVAL = "0" ]; then
echo -en "done.\n"
else
echo -en "failed.\n"
exit $RETVAL
fi
fi
}
status()
{
if [ "$PID" = '' ]; then
echo -en "iSCSI enterprise target is not running\n"
else
echo -en "iSCSI enterprise target is running with pid: \033[1m$PID\e[0m\n"
echo -en "Available targets:\n"
cat /proc/net/iet/session
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: {start|stop|restart|status}" >&2
exit 1
;;
esac
exit 0

View file

@ -15,5 +15,3 @@ iscsitarget:
iscsitarget: http://iscsitarget.sourceforge.net/
iscsitarget:
iscsitarget:
iscsitarget:
iscsitarget: