This commit is contained in:
parent
24eecf9c40
commit
918e57eb04
@ -24,12 +24,14 @@
|
|||||||
|
|
||||||
/* user -> kernel */
|
/* user -> kernel */
|
||||||
#define TGT_UEVENT_CMD_RSP 0x0001
|
#define TGT_UEVENT_CMD_RSP 0x0001
|
||||||
#define TGT_UEVENT_TSK_MGMT_RSP 0x0002
|
#define TGT_UEVENT_IT_NEXUS_RSP 0x0002
|
||||||
|
#define TGT_UEVENT_TSK_MGMT_RSP 0x0003
|
||||||
|
|
||||||
/* kernel -> user */
|
/* kernel -> user */
|
||||||
#define TGT_KEVENT_CMD_REQ 0x1001
|
#define TGT_KEVENT_CMD_REQ 0x1001
|
||||||
#define TGT_KEVENT_CMD_DONE 0x1002
|
#define TGT_KEVENT_CMD_DONE 0x1002
|
||||||
#define TGT_KEVENT_TSK_MGMT_REQ 0x1003
|
#define TGT_KEVENT_IT_NEXUS_REQ 0x1003
|
||||||
|
#define TGT_KEVENT_TSK_MGMT_REQ 0x1004
|
||||||
|
|
||||||
struct tgt_event_hdr {
|
struct tgt_event_hdr {
|
||||||
uint16_t version;
|
uint16_t version;
|
||||||
@ -46,6 +48,7 @@ struct tgt_event {
|
|||||||
struct {
|
struct {
|
||||||
int host_no;
|
int host_no;
|
||||||
int result;
|
int result;
|
||||||
|
aligned_u64 itn_id;
|
||||||
aligned_u64 tag;
|
aligned_u64 tag;
|
||||||
aligned_u64 uaddr;
|
aligned_u64 uaddr;
|
||||||
aligned_u64 sense_uaddr;
|
aligned_u64 sense_uaddr;
|
||||||
@ -55,15 +58,22 @@ struct tgt_event {
|
|||||||
} cmd_rsp;
|
} cmd_rsp;
|
||||||
struct {
|
struct {
|
||||||
int host_no;
|
int host_no;
|
||||||
aligned_u64 mid;
|
|
||||||
int result;
|
int result;
|
||||||
|
aligned_u64 itn_id;
|
||||||
|
aligned_u64 mid;
|
||||||
} tsk_mgmt_rsp;
|
} tsk_mgmt_rsp;
|
||||||
|
struct {
|
||||||
|
__s32 host_no;
|
||||||
|
__s32 result;
|
||||||
|
aligned_u64 itn_id;
|
||||||
|
__u32 function;
|
||||||
|
} it_nexus_rsp;
|
||||||
|
|
||||||
/* kernel -> user */
|
/* kernel -> user */
|
||||||
struct {
|
struct {
|
||||||
int host_no;
|
int host_no;
|
||||||
uint32_t data_len;
|
uint32_t data_len;
|
||||||
|
aligned_u64 itn_id;
|
||||||
uint8_t scb[16];
|
uint8_t scb[16];
|
||||||
uint8_t lun[8];
|
uint8_t lun[8];
|
||||||
int attribute;
|
int attribute;
|
||||||
@ -71,16 +81,25 @@ struct tgt_event {
|
|||||||
} cmd_req;
|
} cmd_req;
|
||||||
struct {
|
struct {
|
||||||
int host_no;
|
int host_no;
|
||||||
aligned_u64 tag;
|
|
||||||
int result;
|
int result;
|
||||||
|
aligned_u64 itn_id;
|
||||||
|
aligned_u64 tag;
|
||||||
} cmd_done;
|
} cmd_done;
|
||||||
struct {
|
struct {
|
||||||
int host_no;
|
int host_no;
|
||||||
int function;
|
int function;
|
||||||
|
aligned_u64 itn_id;
|
||||||
aligned_u64 tag;
|
aligned_u64 tag;
|
||||||
uint8_t lun[8];
|
uint8_t lun[8];
|
||||||
aligned_u64 mid;
|
aligned_u64 mid;
|
||||||
} tsk_mgmt_req;
|
} tsk_mgmt_req;
|
||||||
|
struct {
|
||||||
|
__s32 host_no;
|
||||||
|
__u32 function;
|
||||||
|
aligned_u64 itn_id;
|
||||||
|
__u32 max_cmds;
|
||||||
|
__u8 initiator_id[16];
|
||||||
|
} it_nexus_req;
|
||||||
} p;
|
} p;
|
||||||
} __attribute__ ((aligned (sizeof(uint64_t))));
|
} __attribute__ ((aligned (sizeof(uint64_t))));
|
||||||
|
|
||||||
|
3
tgt-20080805.tar.bz2
Normal file
3
tgt-20080805.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:98fdd166cd0af2b944ab53df0d1f4290aacc833e3b49ee926e213339f31ca216
|
||||||
|
size 223414
|
113
tgt-fix-build
113
tgt-fix-build
@ -1,71 +1,58 @@
|
|||||||
|
diff --git a/scripts/tgt-setup-lun b/scripts/tgt-setup-lun
|
||||||
|
index 1e214ee..2ae9193 100755
|
||||||
|
--- a/scripts/tgt-setup-lun
|
||||||
|
+++ b/scripts/tgt-setup-lun
|
||||||
|
@@ -1,3 +1,5 @@
|
||||||
|
+#!/bin/bash
|
||||||
|
+
|
||||||
|
# LUN assignment script
|
||||||
|
#
|
||||||
|
# Copyright (C) 2007 Erez Zilber <erezz@voltaire.com>
|
||||||
|
@@ -17,8 +19,6 @@
|
||||||
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||||
|
# 02110-1301 USA
|
||||||
|
|
||||||
|
-#!/bin/bash
|
||||||
|
-
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
name=$(basename $0)
|
||||||
diff --git a/usr/Makefile b/usr/Makefile
|
diff --git a/usr/Makefile b/usr/Makefile
|
||||||
index 30cd34a..125274b 100644
|
index 4245709..1720d89 100644
|
||||||
--- a/usr/Makefile
|
--- a/usr/Makefile
|
||||||
+++ b/usr/Makefile
|
+++ b/usr/Makefile
|
||||||
@@ -1,3 +1,7 @@
|
@@ -50,7 +50,7 @@ INCLUDES += -I. -I../include -I$(KERNELSRC)/include
|
||||||
+#
|
|
||||||
+# 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
|
CFLAGS += -D_GNU_SOURCE
|
||||||
TGTD_OBJS += spt_sgv3.o
|
CFLAGS += $(INCLUDES)
|
||||||
endif
|
-CFLAGS += -g -O2 -Wall -Wstrict-prototypes -fPIC
|
||||||
|
+CFLAGS += $(OPTFLAGS)
|
||||||
|
|
||||||
-ifneq ($(IBMVIO),)
|
LIBS += -lpthread
|
||||||
-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),)
|
diff --git a/usr/fc/fc.c b/usr/fc/fc.c
|
||||||
-CFLAGS += -DISCSI
|
index febb1e9..59f7573 100644
|
||||||
+ifeq ($(ISCSI),1)
|
--- a/usr/fc/fc.c
|
||||||
+DEFINES += -DISCSI
|
+++ b/usr/fc/fc.c
|
||||||
TGTD_OBJS += $(addprefix iscsi/, conn.o param.o session.o iscsid.o target.o \
|
@@ -29,6 +29,8 @@
|
||||||
chap.o transport.o iscsi_tcp.o)
|
#include <syscall.h>
|
||||||
TGTD_OBJS += bs_aio.o
|
#include <unistd.h>
|
||||||
@@ -41,7 +45,8 @@ LIBS += -lcrypto -lpthread
|
#include <linux/fs.h>
|
||||||
endif
|
+#include <linux/types.h>
|
||||||
|
+typedef __u8 u8;
|
||||||
|
#include <scsi/scsi.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
|
||||||
INCLUDES += -I.
|
diff --git a/usr/tgtif.c b/usr/tgtif.c
|
||||||
-CFLAGS += -Wall -g -O2 -Wstrict-prototypes -fPIC -D_LARGEFILE64_SOURCE $(INCLUDES)
|
index fd5ad5b..9b87b13 100644
|
||||||
+DEFINES += -D_LARGEFILE64_SOURCE
|
--- a/usr/tgtif.c
|
||||||
+CFLAGS += -Wall -g -O2 -Wstrict-prototypes -fPIC
|
+++ b/usr/tgtif.c
|
||||||
|
@@ -36,7 +36,7 @@
|
||||||
|
#ifndef aligned_u64
|
||||||
|
#define aligned_u64 unsigned long long __attribute__((aligned(8)))
|
||||||
|
#endif
|
||||||
|
-#include <scsi/scsi_tgt_if.h>
|
||||||
|
+#include "scsi_tgt_if.h"
|
||||||
|
|
||||||
PROGRAMS += tgtd tgtadm
|
#include "list.h"
|
||||||
TGTD_OBJS += tgtd.o mgmt.o target.o spc.o sbc.o mmc.o osd.o spt.o scsi.o log.o \
|
#include "util.h"
|
||||||
@@ -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
1361
tgt-git-update
File diff suppressed because it is too large
Load Diff
@ -1,18 +0,0 @@
|
|||||||
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"
|
|
@ -1,20 +0,0 @@
|
|||||||
--- 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;
|
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:9b3b7f24616a2fd65c616307df3dcdfb1605136696f2da6e45154325d874b15b
|
|
||||||
size 63635
|
|
@ -1,147 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Aug 8 15:01:22 CEST 2008 - hare@suse.de
|
||||||
|
|
||||||
|
- Update to latest released version 20080805
|
||||||
|
* Include FCP backend
|
||||||
|
* Include FCoE backend
|
||||||
|
* Bugfixes
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Aug 9 19:12:28 CEST 2007 - olh@suse.de
|
Thu Aug 9 19:12:28 CEST 2007 - olh@suse.de
|
||||||
|
|
||||||
|
@ -1,73 +0,0 @@
|
|||||||
---
|
|
||||||
usr/target.h | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
|
|
||||||
1 file changed, 58 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
--- a/usr/target.h
|
|
||||||
+++ b/usr/target.h
|
|
||||||
@@ -3,8 +3,65 @@
|
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
#define BITS_PER_LONG (ULONG_MAX == 0xFFFFFFFFUL ? 32 : 64)
|
|
||||||
-#include <linux/hash.h>
|
|
||||||
|
|
||||||
+#ifndef _LINUX_HASH_H
|
|
||||||
+#define _LINUX_HASH_H
|
|
||||||
+/* Fast hashing routine for a long.
|
|
||||||
+ (C) 2002 William Lee Irwin III, IBM */
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * Knuth recommends primes in approximately golden ratio to the maximum
|
|
||||||
+ * integer representable by a machine word for multiplicative hashing.
|
|
||||||
+ * Chuck Lever verified the effectiveness of this technique:
|
|
||||||
+ * http://www.citi.umich.edu/techreports/reports/citi-tr-00-1.pdf
|
|
||||||
+ *
|
|
||||||
+ * These primes are chosen to be bit-sparse, that is operations on
|
|
||||||
+ * them can use shifts and additions instead of multiplications for
|
|
||||||
+ * machines where multiplications are slow.
|
|
||||||
+ */
|
|
||||||
+#if BITS_PER_LONG == 32
|
|
||||||
+/* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */
|
|
||||||
+#define GOLDEN_RATIO_PRIME 0x9e370001UL
|
|
||||||
+#elif BITS_PER_LONG == 64
|
|
||||||
+/* 2^63 + 2^61 - 2^57 + 2^54 - 2^51 - 2^18 + 1 */
|
|
||||||
+#define GOLDEN_RATIO_PRIME 0x9e37fffffffc0001UL
|
|
||||||
+#else
|
|
||||||
+#error Define GOLDEN_RATIO_PRIME for your wordsize.
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+static inline unsigned long hash_long(unsigned long val, unsigned int bits)
|
|
||||||
+{
|
|
||||||
+ unsigned long hash = val;
|
|
||||||
+
|
|
||||||
+#if BITS_PER_LONG == 64
|
|
||||||
+ /* Sigh, gcc can't optimise this alone like it does for 32 bits. */
|
|
||||||
+ unsigned long n = hash;
|
|
||||||
+ n <<= 18;
|
|
||||||
+ hash -= n;
|
|
||||||
+ n <<= 33;
|
|
||||||
+ hash -= n;
|
|
||||||
+ n <<= 3;
|
|
||||||
+ hash += n;
|
|
||||||
+ n <<= 3;
|
|
||||||
+ hash -= n;
|
|
||||||
+ n <<= 4;
|
|
||||||
+ hash += n;
|
|
||||||
+ n <<= 2;
|
|
||||||
+ hash += n;
|
|
||||||
+#else
|
|
||||||
+ /* On some cpus multiply is faster, on others gcc will do shifts */
|
|
||||||
+ hash *= GOLDEN_RATIO_PRIME;
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+ /* High bits are more random, so use them. */
|
|
||||||
+ return hash >> (BITS_PER_LONG - bits);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static inline unsigned long hash_ptr(void *ptr, unsigned int bits)
|
|
||||||
+{
|
|
||||||
+ return hash_long((unsigned long)ptr, bits);
|
|
||||||
+}
|
|
||||||
+#endif /* _LINUX_HASH_H */
|
|
||||||
#define HASH_ORDER 4
|
|
||||||
#define hashfn(val) hash_long((unsigned long) (val), HASH_ORDER)
|
|
||||||
|
|
8
tgt.init
8
tgt.init
@ -4,14 +4,14 @@
|
|||||||
#
|
#
|
||||||
### BEGIN INIT INFO
|
### BEGIN INIT INFO
|
||||||
# Provides: tgtd
|
# Provides: tgtd
|
||||||
# Required-Start: $network
|
# Required-Start: $remote_fs $network
|
||||||
# Should-Start:
|
# Should-Start:
|
||||||
# Required-Stop:
|
# Required-Stop:
|
||||||
# Should-Stop:
|
# Should-Stop:
|
||||||
# Default-Start: 3 5
|
# Default-Start: 3 5
|
||||||
# Default-Stop:
|
# Default-Stop:
|
||||||
# Short-Description: Starts and stops the generic storage target daemon
|
# Short-Description: generic storage target daemon
|
||||||
#
|
# Description: Starts and stops the generic storage target subsystem
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -48,7 +48,7 @@ case "$1" in
|
|||||||
fi
|
fi
|
||||||
rc_status -v
|
rc_status -v
|
||||||
;;
|
;;
|
||||||
restart)
|
restart|reload)
|
||||||
$0 stop
|
$0 stop
|
||||||
$0 start
|
$0 start
|
||||||
;;
|
;;
|
||||||
|
76
tgt.spec
76
tgt.spec
@ -1,37 +1,39 @@
|
|||||||
#
|
#
|
||||||
# spec file for package tgt (Version 0.1)
|
# spec file for package tgt (Version 20080805)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2008 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.
|
|
||||||
#
|
#
|
||||||
|
# All modifications and additions to the file contributed by third parties
|
||||||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
# upon. The license for this file, and modifications and additions to the
|
||||||
|
# file, is the same license as for the pristine package itself (unless the
|
||||||
|
# license for the pristine package is not an Open Source License, in which
|
||||||
|
# case the license is the MIT License). An "Open Source License" is a
|
||||||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||||
#
|
#
|
||||||
|
|
||||||
# norootforbuild
|
# norootforbuild
|
||||||
|
|
||||||
|
|
||||||
Name: tgt
|
Name: tgt
|
||||||
BuildRequires: libaio-devel openssl-devel
|
BuildRequires: libaio-devel openssl-devel
|
||||||
Obsoletes: iscsitarget
|
Obsoletes: iscsitarget
|
||||||
URL: http://stgt.berlios.de
|
Url: http://stgt.berlios.de
|
||||||
License: GPL v2 or later
|
License: GPL v2 or later
|
||||||
Group: System/Daemons
|
Group: System/Daemons
|
||||||
Prereq: %fillup_prereq %insserv_prereq
|
PreReq: %fillup_prereq %insserv_prereq
|
||||||
Autoreqprov: on
|
AutoReqProv: on
|
||||||
Version: 0.1
|
Version: 20080805
|
||||||
Release: 23
|
Release: 1
|
||||||
Requires: kernel
|
|
||||||
Summary: Generic Linux target framework (tgt)
|
Summary: Generic Linux target framework (tgt)
|
||||||
Source: %{name}-r849.tar.bz2
|
Source: %{name}-%{version}.tar.bz2
|
||||||
Source1: %{name}.init
|
Source1: %{name}.init
|
||||||
Source2: scsi_tgt_if.h
|
Source2: scsi_tgt_if.h
|
||||||
Source3: %{name}.services
|
Source3: %{name}.services
|
||||||
Patch1: %{name}-git-update
|
|
||||||
Patch2: %{name}-mmc-read-toc-swapped-args
|
|
||||||
Patch10: %{name}-update-scsi-header-file
|
|
||||||
Patch11: %{name}-fix-build
|
Patch11: %{name}-fix-build
|
||||||
Patch12: %{name}-ibmvio-build-local
|
|
||||||
Patch13: tgt.hash.patch
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -50,27 +52,24 @@ Authors:
|
|||||||
Mike Christie <michaelc@cs.wisc.edu>
|
Mike Christie <michaelc@cs.wisc.edu>
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -n %{name}-r849
|
%setup -n %{name}-%{version}
|
||||||
%patch1 -p1
|
|
||||||
%patch2 -p1
|
|
||||||
%patch10 -p1
|
|
||||||
%patch11 -p1
|
%patch11 -p1
|
||||||
%patch12 -p1
|
cp %{S:2} usr
|
||||||
%patch13 -p1
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
cp %{S:2} usr/scsi_tgt_if.h
|
|
||||||
cd usr
|
cd usr
|
||||||
%ifarch ppc ppc64
|
%ifarch ppc ppc64
|
||||||
IBMVIO=1
|
%define backends ISCSI=1 FCP=1 FCOE=1 IBMVIO=1
|
||||||
%else
|
%else
|
||||||
IBMVIO=0
|
%define backends ISCSI=1 FCP=1 FCOE=1
|
||||||
%endif
|
%endif
|
||||||
%{__make} CFLAGS="${RPM_OPT_FLAGS}" ISCSI=1 IBMVIO=$IBMVIO
|
%{__make} OPTFLAGS="${RPM_OPT_FLAGS}" %{backends}
|
||||||
|
|
||||||
%install
|
%install
|
||||||
install -vD usr/tgtd ${RPM_BUILD_ROOT}/usr/sbin/tgtd
|
cd usr
|
||||||
install -vD usr/tgtadm ${RPM_BUILD_ROOT}/usr/sbin/tgtadm
|
%{__make} DESTDIR=${RPM_BUILD_ROOT} install
|
||||||
|
cd ../scripts
|
||||||
|
install -vD -m 755 tgt-admin ${RPM_BUILD_ROOT}/usr/sbin/tgt-admin
|
||||||
install -vD -m 755 %{S:1} ${RPM_BUILD_ROOT}/etc/init.d/tgtd
|
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
|
install -vD %{S:3} ${RPM_BUILD_ROOT}/etc/sysconfig/SuSEfirewall2.d/services/iscsitarget
|
||||||
|
|
||||||
@ -81,22 +80,31 @@ rm -f filelist
|
|||||||
%post
|
%post
|
||||||
%{fillup_and_insserv tgtd}
|
%{fillup_and_insserv tgtd}
|
||||||
|
|
||||||
|
%preun
|
||||||
|
%stop_on_removal
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
%{insserv_cleanup}
|
%{insserv_cleanup}
|
||||||
|
|
||||||
%files
|
%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)
|
%defattr(-,root,root)
|
||||||
|
/usr/sbin/*
|
||||||
|
/etc/init.d/tgtd
|
||||||
|
%config %attr(0644,root,root) /etc/sysconfig/SuSEfirewall2.d/services/iscsitarget
|
||||||
%doc README doc/README.iscsi doc/TODO
|
%doc README doc/README.iscsi doc/TODO
|
||||||
|
%doc %{_mandir}/man8/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Thu Aug 09 2007 - olh@suse.de
|
* Fri Aug 08 2008 hare@suse.de
|
||||||
|
- Update to latest released version 20080805
|
||||||
|
* Include FCP backend
|
||||||
|
* Include FCoE backend
|
||||||
|
* Bugfixes
|
||||||
|
* Thu Aug 09 2007 olh@suse.de
|
||||||
- remove inclusion of linux/hash.h, include it directly
|
- remove inclusion of linux/hash.h, include it directly
|
||||||
* Wed Apr 04 2007 - hare@suse.de
|
* Wed Apr 04 2007 hare@suse.de
|
||||||
- Added service definition for SUSEFirewall2 (#251679)
|
- Added service definition for SUSEFirewall2 (#251679)
|
||||||
* Wed Apr 04 2007 - hare@suse.de
|
* Wed Apr 04 2007 hare@suse.de
|
||||||
- Initial version svn r849
|
- Initial version svn r849
|
||||||
- Update to latest git version
|
- Update to latest git version
|
||||||
- Fixes for build on openSUSE
|
- Fixes for build on openSUSE
|
||||||
|
Loading…
Reference in New Issue
Block a user