[PATCH] Adding a new backend for opening a /dev/sg device for
Ronnie Sahlberg
ronniesahlberg
Sat Aug 2 05:38:33 CEST 2008
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 <ronniesahlberg at gmail.com>
---
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
------=_Part_14240_3265295.1217649472661
Content-Type: application/x-gzip;
name=0001-Adding-a-new-backend-for-opening-a-dev-sg-device-fo.patch.gz
Content-Transfer-Encoding: base64
X-Attachment-Id: f_fjdoucv80
Content-Disposition: attachment;
filename=0001-Adding-a-new-backend-for-opening-a-dev-sg-device-fo.patch.gz
H4sIALjYk0gAA5VW63PaRhD/jP6KHU8+QEBC4mnjuBOCiUuLgYJpJ00zmpN0ElcknXIn2fGk/t+7
dwIHv5KWsU97+9Ltbx+n94InQGi73wta3gnpOD3ihaTb7ZC+3ac9O+z2KDkOW62TdrcLlzyFFc3A
6YNtD/QftGzbMd6jmwEseZoyCiuyiT0qIngjNEPu9m+jhLDY8nnyk3FOcjpAzbwBLRgWkX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