>From ae376d2b9a416abfa554a707e60f56ea8f229355 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Sat, 2 Aug 2008 13:38:33 +1000 Subject: [PATCH] Adding a new backend for opening a /dev/sg device for passthrough mode
Adding a nev device type for passthrough operation
To use this mode use something like this :
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1
--device-type=pt
-b /dev/sg0
Signed-off-by: Ronnie Sahlberg <[EMAIL PROTECTED]>
---
usr/Makefile | 9 +++++----
usr/target.c | 9 ++++-----
usr/tgtd.h | 2 +-
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/usr/Makefile b/usr/Makefile
index 4245709..7081642 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -11,7 +11,7 @@ CFLAGS += -DISCSI
TGTD_OBJS += $(addprefix iscsi/, conn.o param.o session.o \
iscsid.o target.o chap.o transport.o iscsi_tcp.o \
isns.o libcrc32c.o)
-TGTD_OBJS += bs_rdwr.o bs_aio.o
+TGTD_OBJS += bs_rdwr.o bs_aio.o bs_passthrough.o
LIBS += -lcrypto
ifneq ($(ISCSI_RDMA),)
@@ -43,21 +43,22 @@ TGTD_OBJS += $(addprefix fcoe/,\
fcoe_if.o fcoe_dev.o \
sa_event.o sa_timer.o sa_hash_kern.o sa_state.o\
crc32_le.o crc32_le_tab.o)
-TGTD_OBJS += bs_rdwr.o
+TGTD_OBJS += bs_rdwr.o bs_passthrough.o
endif
INCLUDES += -I. -I../include -I$(KERNELSRC)/include
CFLAGS += -D_GNU_SOURCE
CFLAGS += $(INCLUDES)
-CFLAGS += -g -O2 -Wall -Wstrict-prototypes -fPIC
+CFLAGS += -g -O0 -Wall -Wstrict-prototypes -fPIC
LIBS += -lpthread
PROGRAMS += tgtd tgtadm
SCRIPTS += ../scripts/tgt-setup-lun
TGTD_OBJS += tgtd.o mgmt.o target.o scsi.o log.o driver.o util.o work.o \
- parser.o spc.o sbc.o mmc.o osd.o scc.o smc.o ssc.o bs_ssc.o bs.o
+ parser.o spc.o sbc.o mmc.o osd.o passthrough.o scc.o \
+ smc.o ssc.o bs_ssc.o bs.o
MANPAGES = ../doc/manpages/tgtadm.8 ../doc/manpages/tgt-setup-lun.8
TGTD_DEP = $(TGTD_OBJS:.o=.d)
diff --git a/usr/target.c b/usr/target.c
index 70bf72a..e200471 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -1524,21 +1524,20 @@ static struct {
{TYPE_ENCLOSURE, "enclosure"},
{TYPE_RBC, "rbc"},
{TYPE_OSD, "osd"},
- {TYPE_NO_LUN, "No LUN"}
+ {TYPE_NO_LUN, "No LUN"},
+ {TYPE_SPT, "passthrough"}
};
static char *print_type(int type)
{
int i;
- char *name = NULL;
for (i = 0; i < ARRAY_SIZE(disk_type_names); i++) {
if (disk_type_names[i].value == type) {
- name = disk_type_names[i].name;
- break;
+ return disk_type_names[i].name;
}
}
- return name;
+ return "Unknown type";
}
diff --git a/usr/tgtd.h b/usr/tgtd.h
index 4febcd3..a649129 100644
--- a/usr/tgtd.h
+++ b/usr/tgtd.h
@@ -60,7 +60,7 @@ struct lu_phy_attr {
uint16_t version_desc[VERSION_DESCRIPTOR_LEN];
- char device_type; /* Peripheral device type */
+ unsigned char device_type;/* Peripheral device type */
char qualifier; /* Peripheral Qualifier */
char removable; /* Removable media */
char online; /* Logical Unit online */
--
1.5.5
0001-Adding-a-new-backend-for-opening-a-dev-sg-device-fo.patch.gz
Description: GNU Zip compressed data
_______________________________________________ Stgt-devel mailing list [email protected] https://lists.berlios.de/mailman/listinfo/stgt-devel
