OBS User unknown 2007-04-11 02:44:39 +00:00 committed by Git OBS Bridge
commit 5ae5661048
14 changed files with 1925 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

0
ready Normal file
View File

89
scsi_tgt_if.h Normal file
View File

@ -0,0 +1,89 @@
/*
* SCSI target kernel/user interface
*
* Copyright (C) 2005 FUJITA Tomonori <tomof@acm.org>
* Copyright (C) 2005 Mike Christie <michaelc@cs.wisc.edu>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef __SCSI_TARGET_IF_H
#define __SCSI_TARGET_IF_H
/* user -> kernel */
#define TGT_UEVENT_CMD_RSP 0x0001
#define TGT_UEVENT_TSK_MGMT_RSP 0x0002
/* kernel -> user */
#define TGT_KEVENT_CMD_REQ 0x1001
#define TGT_KEVENT_CMD_DONE 0x1002
#define TGT_KEVENT_TSK_MGMT_REQ 0x1003
struct tgt_event_hdr {
uint16_t version;
uint16_t status;
uint16_t type;
uint16_t len;
} __attribute__ ((aligned (sizeof(uint64_t))));
struct tgt_event {
struct tgt_event_hdr hdr;
union {
/* user-> kernel */
struct {
int host_no;
int result;
aligned_u64 tag;
aligned_u64 uaddr;
aligned_u64 sense_uaddr;
uint32_t len;
uint32_t sense_len;
uint8_t rw;
} cmd_rsp;
struct {
int host_no;
aligned_u64 mid;
int result;
} tsk_mgmt_rsp;
/* kernel -> user */
struct {
int host_no;
uint32_t data_len;
uint8_t scb[16];
uint8_t lun[8];
int attribute;
aligned_u64 tag;
} cmd_req;
struct {
int host_no;
aligned_u64 tag;
int result;
} cmd_done;
struct {
int host_no;
int function;
aligned_u64 tag;
uint8_t lun[8];
aligned_u64 mid;
} tsk_mgmt_req;
} p;
} __attribute__ ((aligned (sizeof(uint64_t))));
#define TGT_RING_SIZE (1UL << 16)
#endif

71
tgt-fix-build Normal file
View File

@ -0,0 +1,71 @@
diff --git a/usr/Makefile b/usr/Makefile
index 30cd34a..125274b 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -1,3 +1,7 @@
+#
+# Makefile for tgt userspace tools
+#
+
ifneq ($(XEN),)
XEN_ROOT = ../..
include $(XEN_ROOT)/tools/Rules.mk
@@ -6,9 +10,9 @@ INCLUDES += -I$(XEN_LIBXC) -I$(XEN_XENST
INCLUDES += -I$(LINUX_ROOT)/include -I.
LIBAIO_DIR = ../libaio/src
AIOLIBS := $(LIBAIO_DIR)/libaio.a
-CFLAGS += -I$(XEN_LIBXC) -I$(LIBAIO_DIR)
-CFLAGS += $(INCLUDES) -I. -I../../xenstore
-CFLAGS += -DXEN -DUSE_KERNEL
+INCLUDES += -I$(XEN_LIBXC) -I$(LIBAIO_DIR)
+INCLUDES += -I. -I../../xenstore
+DEFINES += -DXEN -DUSE_KERNEL
LIBS := -L. -L.. -L../lib
LIBS += -L$(XEN_LIBXC)
LIBS += -lxenctrl
@@ -16,7 +20,7 @@ LIBS += -L$(XEN_XENSTORE) -lxenstore $(A
TGTD_OBJS += $(addprefix xen/, xen.o xs_api.o xenbus.o)
TGTD_OBJS += tgtif.o bs_xen.o
else
-INCLUDES += -I../include -I$(KERNELSRC)/include
+INCLUDES += -I../include
LIBS += -laio
endif
@@ -26,14 +30,14 @@ else
TGTD_OBJS += spt_sgv3.o
endif
-ifneq ($(IBMVIO),)
-CFLAGS += -DIBMVIO -DUSE_KERNEL
+ifeq ($(IBMVIO),1)
+DEFINES += -DIBMVIO -DUSE_KERNEL
TGTD_OBJS += $(addprefix ibmvio/, ibmvio.o)
TGTD_OBJS += bs_mmap.o tgtif.o
endif
-ifneq ($(ISCSI),)
-CFLAGS += -DISCSI
+ifeq ($(ISCSI),1)
+DEFINES += -DISCSI
TGTD_OBJS += $(addprefix iscsi/, conn.o param.o session.o iscsid.o target.o \
chap.o transport.o iscsi_tcp.o)
TGTD_OBJS += bs_aio.o
@@ -41,7 +45,8 @@ LIBS += -lcrypto -lpthread
endif
INCLUDES += -I.
-CFLAGS += -Wall -g -O2 -Wstrict-prototypes -fPIC -D_LARGEFILE64_SOURCE $(INCLUDES)
+DEFINES += -D_LARGEFILE64_SOURCE
+CFLAGS += -Wall -g -O2 -Wstrict-prototypes -fPIC
PROGRAMS += tgtd tgtadm
TGTD_OBJS += tgtd.o mgmt.o target.o spc.o sbc.o mmc.o osd.o spt.o scsi.o log.o \
@@ -62,3 +67,7 @@ endif
clean:
rm -f *.o $(PROGRAMS) iscsi/*.o ibmvio/*.o xen/*.o
+
+%.o: %.c
+ $(CC) $(CFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
+

1361
tgt-git-update Normal file

File diff suppressed because it is too large Load Diff

18
tgt-ibmvio-build-local Normal file
View File

@ -0,0 +1,18 @@
diff --git a/usr/Makefile b/usr/Makefile
diff --git a/usr/ibmvio/ibmvio.c b/usr/ibmvio/ibmvio.c
diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
diff --git a/usr/scsi.h b/usr/scsi.h
diff --git a/usr/target.c b/usr/target.c
diff --git a/usr/tgtif.c b/usr/tgtif.c
index 5ee6fe5..960d31d 100644
--- a/usr/tgtif.c
+++ b/usr/tgtif.c
@@ -35,7 +35,7 @@ #include <sys/stat.h>
#include <sys/sysmacros.h>
#define aligned_u64 unsigned long long __attribute__((aligned(8)))
-#include <scsi/scsi_tgt_if.h>
+#include "scsi_tgt_if.h"
#include "list.h"
#include "util.h"

View File

@ -0,0 +1,20 @@
--- tgt-r819/usr/mmc.c.orig 2007-04-03 16:00:16.306368493 +0200
+++ tgt-r819/usr/mmc.c 2007-04-03 16:03:40.974528047 +0200
@@ -155,7 +155,7 @@ static int mmc_read_toc(int host_no, str
sense_data_build(cmd, HARDWARE_ERROR, 0, 0);
return SAM_STAT_CHECK_CONDITION;
}
- memset(data, pagesize, 0);
+ memset(data, 0, pagesize);
cmd->uaddr = (unsigned long) data;
/* forged for single session data cd only. all iso file fall into this */
@@ -191,7 +191,7 @@ static int mmc_read_capacity(int host_no
sense_data_build(cmd, HARDWARE_ERROR, 0, 0);
return SAM_STAT_CHECK_CONDITION;
}
- memset(data, pagesize, 0);
+ memset(data, 0, pagesize);
cmd->uaddr = (unsigned long) data;
size = cmd->dev->size >> MMC_BLK_SHIFT;

3
tgt-r849.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9b3b7f24616a2fd65c616307df3dcdfb1605136696f2da6e45154325d874b15b
size 63635

147
tgt-update-scsi-header-file Normal file
View File

@ -0,0 +1,147 @@
diff --git a/usr/ibmvio/ibmvio.c b/usr/ibmvio/ibmvio.c
index ff91f14..c21b8e1 100644
--- a/usr/ibmvio/ibmvio.c
+++ b/usr/ibmvio/ibmvio.c
@@ -35,9 +35,9 @@ #include <stdint.h>
#include <syscall.h>
#include <unistd.h>
#include <linux/fs.h>
-#include <scsi/scsi.h>
#include <sys/mman.h>
+#include "scsi.h"
#include "list.h"
#include "util.h"
#include "tgtd.h"
diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index 0a2578a..4d5afb4 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -17,9 +17,9 @@ #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <scsi/scsi.h>
#include <sys/epoll.h>
+#include "scsi.h"
#include "iscsid.h"
#include "tgtd.h"
#include "util.h"
diff --git a/usr/scsi.h b/usr/scsi.h
index f70dfd7..d8a607a 100644
--- a/usr/scsi.h
+++ b/usr/scsi.h
@@ -100,6 +100,9 @@ #define SAM_STAT_TASK_SET_FULL 0x28
#define SAM_STAT_ACA_ACTIVE 0x30
#define SAM_STAT_TASK_ABORTED 0x40
+/* This looks wrong */
+#define TASK_ABORTED 0x20
+
#define NO_SENSE 0x00
#define RECOVERED_ERROR 0x01
#define NOT_READY 0x02
@@ -133,16 +136,36 @@ #define TYPE_NO_LUN 0x7f
#define TYPE_SPT 0xff
-#define MSG_SIMPLE_TAG 0x20
-#define MSG_HEAD_TAG 0x21
-#define MSG_ORDERED_TAG 0x22
-
-#define ABORT_TASK 0x0d
+#define COMMAND_COMPLETE 0x00
+#define EXTENDED_MESSAGE 0x01
+#define EXTENDED_MODIFY_DATA_POINTER 0x00
+#define EXTENDED_SDTR 0x01
+#define EXTENDED_EXTENDED_IDENTIFY 0x02 /* SCSI-I only */
+#define EXTENDED_WDTR 0x03
+#define EXTENDED_PPR 0x04
+#define EXTENDED_MODIFY_BIDI_DATA_PTR 0x05
+#define SAVE_POINTERS 0x02
+#define RESTORE_POINTERS 0x03
+#define DISCONNECT 0x04
+#define INITIATOR_ERROR 0x05
#define ABORT_TASK_SET 0x06
-#define CLEAR_ACA 0x16
+#define MESSAGE_REJECT 0x07
+#define NOP 0x08
+#define MSG_PARITY_ERROR 0x09
+#define LINKED_CMD_COMPLETE 0x0a
+#define LINKED_FLG_CMD_COMPLETE 0x0b
+#define TARGET_RESET 0x0c
+#define ABORT_TASK 0x0d
#define CLEAR_TASK_SET 0x0e
+#define INITIATE_RECOVERY 0x0f /* SCSI-II only */
+#define RELEASE_RECOVERY 0x10 /* SCSI-II only */
+#define CLEAR_ACA 0x16
#define LOGICAL_UNIT_RESET 0x17
-#define TASK_ABORTED 0x20
-#define SAM_STAT_TASK_ABORTED 0x40
+#define SIMPLE_QUEUE_TAG 0x20
+#define HEAD_OF_QUEUE_TAG 0x21
+#define ORDERED_QUEUE_TAG 0x22
+#define IGNORE_WIDE_RESIDUE 0x23
+#define ACA 0x24
+#define QAS_REQUEST 0x55
#endif
diff --git a/usr/target.c b/usr/target.c
index f48839e..7539daa 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -357,26 +357,26 @@ static int cmd_enabled(struct tgt_cmd_qu
{
int enabled = 0;
- if (cmd->attribute != MSG_SIMPLE_TAG)
+ if (cmd->attribute != SIMPLE_QUEUE_TAG)
dprintf("non simple attribute %" PRIx64 " %x %" PRIu64 " %d\n",
cmd->tag, cmd->attribute, cmd->dev ? cmd->dev->lun : UINT64_MAX,
q->active_cmd);
switch (cmd->attribute) {
- case MSG_SIMPLE_TAG:
+ case SIMPLE_QUEUE_TAG:
if (!queue_blocked(q))
enabled = 1;
break;
- case MSG_ORDERED_TAG:
+ case ORDERED_QUEUE_TAG:
if (!queue_blocked(q) && !queue_active(q))
enabled = 1;
break;
- case MSG_HEAD_TAG:
+ case HEAD_OF_QUEUE_TAG:
enabled = 1;
break;
default:
eprintf("unknown command attribute %x\n", cmd->attribute);
- cmd->attribute = MSG_ORDERED_TAG;
+ cmd->attribute = ORDERED_QUEUE_TAG;
if (!queue_blocked(q) && !queue_active(q))
enabled = 1;
}
@@ -388,8 +388,8 @@ static void cmd_post_perform(struct tgt_
{
q->active_cmd++;
switch (cmd->attribute) {
- case MSG_ORDERED_TAG:
- case MSG_HEAD_TAG:
+ case ORDERED_QUEUE_TAG:
+ case HEAD_OF_QUEUE_TAG:
set_queue_blocked(q);
break;
}
@@ -522,8 +522,8 @@ static void __cmd_done(struct target *ta
q->active_cmd--;
switch (cmd->attribute) {
- case MSG_ORDERED_TAG:
- case MSG_HEAD_TAG:
+ case ORDERED_QUEUE_TAG:
+ case HEAD_OF_QUEUE_TAG:
clear_queue_blocked(q);
break;
}

12
tgt.changes Normal file
View File

@ -0,0 +1,12 @@
-------------------------------------------------------------------
Wed Apr 4 11:21:52 CEST 2007 - hare@suse.de
- Added service definition for SUSEFirewall2 (#251679)
-------------------------------------------------------------------
Wed Apr 4 10:26:41 CEST 2007 - hare@suse.de
- Initial version svn r849
- Update to latest git version
- Fixes for build on openSUSE

64
tgt.init Normal file
View File

@ -0,0 +1,64 @@
#!/bin/sh
#
# /etc/init.d/tgtd
#
### BEGIN INIT INFO
# Provides: tgtd
# Required-Start: $network
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: 3 5
# Default-Stop:
# Short-Description: Starts and stops the generic storage target daemon
#
### END INIT INFO
#
#
# pidfile: /var/run/tgtd.pid
DAEMON=/usr/sbin/tgtd
PIDFILE=/var/run/tgtd.pid
# Source LSB init functions
. /etc/rc.status
rc_reset
PATH=/sbin:/bin:/usr/sbin:/usr/bin
case "$1" in
start)
echo -n "Starting SCSI target service: "
modprobe crc32c
modprobe scsi_tgt
startproc -p $PIDFILE $DAEMON
rc_status -v
;;
stop)
echo -n "Stopping SCSI target service: "
tgtadm --op delete >/dev/null 2>/dev/null
killproc -p $PIDFILE -TERM $DAEMON
modprobe -r scsi_tgt 2>/dev/null
RETVAL=$?
modprobe -r crc32c 2>/dev/null
if [ $RETVAL != "0" ]; then
rc_failed
fi
rc_status -v
;;
restart)
$0 stop
$0 start
;;
status)
echo -n "Checking for SCSI target service"
checkproc -p $PIDFILE $DAEMON
rc_status -v
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
exit 1
esac
rc_exit

18
tgt.services Normal file
View File

@ -0,0 +1,18 @@
## Name: iSCSI Target Daemon
## Description: Opens ports for iSCSI Target Daemon with broadcast allowed.
# space separated list of allowed TCP ports
TCP="iscsi-target"
# space separated list of allowed UDP ports
UDP="iscsi-target"
# space separated list of allowed RPC services
RPC=""
# space separated list of allowed IP protocols
IP=""
# space separated list of allowed UDP broadcast ports
BROADCAST="iscsi-target"

98
tgt.spec Normal file
View File

@ -0,0 +1,98 @@
#
# spec file for package tgt (Version 0.1)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: tgt
BuildRequires: libaio-devel openssl-devel
Obsoletes: iscsitarget
URL: http://stgt.berlios.de
License: GNU General Public License (GPL)
Group: System/Daemons
Prereq: %fillup_prereq %insserv_prereq
Autoreqprov: on
Version: 0.1
Release: 1
Requires: kernel
Summary: Generic Linux target framework (tgt)
Source: %{name}-r849.tar.bz2
Source1: %{name}.init
Source2: scsi_tgt_if.h
Source3: %{name}.services
Patch1: %{name}-git-update
Patch2: %{name}-mmc-read-toc-swapped-args
Patch10: %{name}-update-scsi-header-file
Patch11: %{name}-fix-build
Patch12: %{name}-ibmvio-build-local
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Linux target framework (tgt) aims to simplify various SCSI target
driver (iSCSI, Fibre Channel, SRP, etc) creation and maintenance.
Tgt consists of kernel modules, user-space daemon, and user-space
tools. Some target drivers uses all of them and some use only
user-space daemon and tools (i.e. they completely runs in user space).
Authors:
--------
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Mike Christie <michaelc@cs.wisc.edu>
%prep
%setup -n %{name}-r849
%patch1 -p1
%patch2 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
cp %{S:2} usr/scsi_tgt_if.h
%build
cd usr
%ifarch ppc ppc64
IBMVIO=1
%else
IBMVIO=0
%endif
%{__make} CFLAGS="${RPM_OPT_FLAGS}" ISCSI=1 IBMVIO=$IBMVIO
%install
install -vD usr/tgtd ${RPM_BUILD_ROOT}/usr/sbin/tgtd
install -vD usr/tgtadm ${RPM_BUILD_ROOT}/usr/sbin/tgtadm
install -vD -m 755 %{S:1} ${RPM_BUILD_ROOT}/etc/init.d/tgtd
install -vD %{S:3} ${RPM_BUILD_ROOT}/etc/sysconfig/SuSEfirewall2.d/services/iscsitarget
%clean
[ "${RPM_BUILD_ROOT}" != "/" -a -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT}
rm -f filelist
%post
%{fillup_and_insserv tgtd}
%postun
%{insserv_cleanup}
%files
%attr(755,root,root)/usr/sbin/*
%attr(755,root,root)/etc/init.d/tgtd
%attr(644,root,root)/etc/sysconfig/SuSEfirewall2.d/services/iscsitarget
%defattr(-,root,root)
%doc README doc/README.iscsi doc/TODO
%changelog
* Wed Apr 04 2007 - hare@suse.de
- Added service definition for SUSEFirewall2 (#251679)
* Wed Apr 04 2007 - hare@suse.de
- Initial version svn r849
- Update to latest git version
- Fixes for build on openSUSE