On Mon, 29 Sep 2008 11:15:26 +0300 Doron Shoham <dorons@xxxxxxxxxxxx> wrote: > OK, I've tried a different approuch. > > All the code of iscsi_rdma.c moved to libtgt_rdma.c and it will be compiled as > a shared library. > > The only thing that will do in iscsi_rdma.c is to try dlopen libibverbs and librdmacm. > If it works then will try to dlopen libtgtrdma. > > So basically we'll have 3 shared libraries (2 from IB userspace and one is libtgtrdma) for iser support. > > In this way, userspace IB will be required in order to build the tgt RPM, > but will not be required to run tgtd. > If userspace IB is not installed, tgt will run without iser support. > Installing and using tgt RPM will not be depended on having userspace IB. > > I've also update the patch to current git (iscsi_rdma.c was changed). > > Please let me know what do you think about it. Looks much better. > Signed-off-by: Doron Shoham <dorons@xxxxxxxxxxxx> > --- > usr/Makefile | 31 +- > usr/iscsi/iscsi_rdma.c | 1763 ++--------------------------------------------- > usr/iscsi/libtgt_rdma.c | 1764 +++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 1828 insertions(+), 1730 deletions(-) > create mode 100644 usr/iscsi/libtgt_rdma.c > > diff --git a/usr/Makefile b/usr/Makefile > index 82ddf07..dfebe64 100644 > --- a/usr/Makefile > +++ b/usr/Makefile > @@ -14,13 +14,19 @@ TGTD_OBJS += $(addprefix iscsi/, conn.o param.o session.o \ > TGTD_OBJS += bs_rdwr.o bs_aio.o > > LIBS += -lcrypto > -ifneq ($(ISCSI_RDMA),) > -CFLAGS += -DISCSI_RDMA > + > + > +ifneq ($(findstring verbs.h,$(wildcard /usr/include/infiniband/*.h)), ) > +ifneq ($(findstring rdma_cma.h,$(wildcard /usr/include/rdma/*.h)), ) > TGTD_OBJS += iscsi/iscsi_rdma.o > -LIBS += -libverbs -lrdmacm > +ISER_OBJS = iscsi/libtgt_rdma.o > +SO_NAME = libtgtrdma.so > +SO_LIBS = $(SO_NAME).0.0 > endif > endif > > +endif > + > ifneq ($(FCP),) > CFLAGS += -DFCP -DUSE_KERNEL > TGTD_OBJS += $(addprefix fc/, fc.o) > @@ -54,6 +60,7 @@ CFLAGS += -g -O2 -Wall -Wstrict-prototypes -fPIC > > LIBS += -lpthread > > + > PROGRAMS += tgtd tgtadm > SCRIPTS += ../scripts/tgt-setup-lun ../scripts/tgt-admin > TGTD_OBJS += tgtd.o mgmt.o target.o scsi.o log.o driver.o util.o work.o \ > @@ -65,10 +72,10 @@ MANPAGES = ../doc/manpages/tgtadm.8 ../doc/manpages/tgt-admin.8 \ > TGTD_DEP = $(TGTD_OBJS:.o=.d) > > .PHONY:all > -all: $(PROGRAMS) > +all: $(PROGRAMS) $(SO_LIBS) > > tgtd: $(TGTD_OBJS) > - $(CC) $^ -o $@ $(LIBS) > + $(CC) -Xlinker -E $^ -o $@ $(LIBS) > > -include $(TGTD_DEP) > > @@ -81,15 +88,25 @@ tgtadm: tgtadm.o > $(CC) -c $(CFLAGS) $*.c -o $*.o > @$(CC) -MM $(CFLAGS) -MF $*.d -MT $*.o $*.c > > +$(SO_LIBS): $(ISER_OBJS) > + rm -f $@ $(SO_NAME) > + $(LD) -shared -soname $(SO_LIBS) -o $(SO_LIBS) $(ISER_OBJS) > + ln -s $(SO_LIBS) $(SO_NAME) > + > .PHONY: install > -install: $(PROGRAMS) $(SCRIPTS) install_doc > +install: $(PROGRAMS) $(SCRIPTS) install_doc install_lib > install -d -m 755 $(DESTDIR)/usr/sbin > install -m 755 $(PROGRAMS) $(SCRIPTS) $(DESTDIR)/usr/sbin > > +install_lib: $(SO_LIBS) > + rm -f $(DESTDIR)/usr/lib64/$(SO_NAME) > + install -m 755 $(SO_LIBS) $(DESTDIR)/usr/lib64 > + ln -s $(DESTDIR)/usr/lib64/$(SO_LIBS) $(DESTDIR)/usr/lib64/$(SO_NAME) /usr/lib64/ is a standard place? At least, it doesn't look so on Debian. Can you make it configurable? > install_doc: $(MANPAGES) > install -d -m 755 $(DESTDIR)$(mandir)/man8 > install -m 644 $^ $(DESTDIR)$(mandir)/man8 > > .PHONY: clean > clean: > - rm -f *.[od] $(PROGRAMS) iscsi/*.[od] ibmvio/*.[od] fc/*.[od] fcoe/*.[od] > + rm -f *.[od] $(PROGRAMS) $(SO_LIBS) iscsi/*.[od] ibmvio/*.[od] fc/*.[od] fcoe/*.[od] > diff --git a/usr/iscsi/iscsi_rdma.c b/usr/iscsi/iscsi_rdma.c > index d3b5147..31b04a4 100644 > --- a/usr/iscsi/iscsi_rdma.c > +++ b/usr/iscsi/iscsi_rdma.c > @@ -21,1740 +21,57 @@ > * 02110-1301 USA > */ > #include <stdio.h> > -#include <stdlib.h> > -#include <string.h> > -#include <errno.h> > -#include <unistd.h> > -#include <assert.h> > -#include <netdb.h> > -#include <sys/epoll.h> > -#include <infiniband/verbs.h> > -#include <rdma/rdma_cma.h> > +#include <dlfcn.h> > +#include <syslog.h> With the way you changed the code, it's impossible to see what changes you made. Can you make these changes with two patches? The first patch should do only renaming in the following way. The second patch can make changes to iscsi_rdma.c and libtgtrdma.c >From 34516d25b722108da3574f29b888653b87a0070b Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx> Date: Tue, 30 Sep 2008 09:33:44 +0900 Subject: [PATCH] rename iscsi_rdma.c libtgtrdma.c Signed-off-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx> --- usr/Makefile | 2 +- usr/iscsi/{iscsi_rdma.c => libtgtrdma.c} | 0 2 files changed, 1 insertions(+), 1 deletions(-) rename usr/iscsi/{iscsi_rdma.c => libtgtrdma.c} (100%) diff --git a/usr/Makefile b/usr/Makefile index 82ddf07..bc6f44c 100644 --- a/usr/Makefile +++ b/usr/Makefile @@ -16,7 +16,7 @@ TGTD_OBJS += bs_rdwr.o bs_aio.o LIBS += -lcrypto ifneq ($(ISCSI_RDMA),) CFLAGS += -DISCSI_RDMA -TGTD_OBJS += iscsi/iscsi_rdma.o +TGTD_OBJS += iscsi/libtgtrdma.o LIBS += -libverbs -lrdmacm endif endif diff --git a/usr/iscsi/iscsi_rdma.c b/usr/iscsi/libtgtrdma.c similarity index 100% rename from usr/iscsi/iscsi_rdma.c rename to usr/iscsi/libtgtrdma.c -- 1.5.4.2 -- To unsubscribe from this list: send the line "unsubscribe stgt" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html