On Tue, 24 Feb 2009 11:45:35 +0200 Boaz Harrosh <bharrosh@xxxxxxxxxxx> wrote: > FUJITA Tomonori wrote: > > On Mon, 23 Feb 2009 19:41:46 +0200 > > Boaz Harrosh <bharrosh@xxxxxxxxxxx> wrote: > > > >> Please tell me if you are at all interested in these patches or I should > >> keep them out-of-tree at open-osd.org. > > > > I think that it's a good idea to support other operating systems > > though I don't care about them; we could get more users and it would > > improve tgt. > > Thanks. > > > > > I have some technical issues over your patchset (e.g. I will not add > > ifdef to *.c files) but I think that we can solve them. > > > > The setsockopt() and syscall() can be over-ridden an #ifdef can be avoided > but there are a couple of places, like an extra field member in > struct sockaddr, or the naming convention of an IPC, where it is very > hard to avoid. Hmm, why can't you do something like this? I think that you can avoid all the ifdef in your patch like this. diff --git a/usr/Makefile b/usr/Makefile index f76cac2..9a55ee2 100644 --- a/usr/Makefile +++ b/usr/Makefile @@ -1,9 +1,15 @@ VERSION = 0.9.4 EXTRAVERSION = $(if $(shell git-show-ref 2>/dev/null),-git-$(shell git-show-ref --head --abbrev|head -1|awk '{print $$1}')) +UNAME ?= $(shell uname) + mandir = /usr/share/man docdir = /usr/share/doc/tgt +ifeq ($(UNAME),Linux) +TGTD_OBJS += libos/linux.o +endif + ifneq ($(IBMVIO),) CFLAGS += -DIBMVIO -DUSE_KERNEL TGTD_OBJS += $(addprefix ibmvio/, ibmvio.o) diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c index bfaec87..6280bdb 100644 --- a/usr/iscsi/iscsid.c +++ b/usr/iscsi/iscsid.c @@ -39,6 +39,7 @@ #include "driver.h" #include "scsi.h" #include "crc32c.h" +#include "libos.h" #define MAX_QUEUE_CMD 128 @@ -767,9 +768,8 @@ static void text_scan_text(struct iscsi_connection *conn) blen--; } - slen = sizeof(ss); - getnameinfo((struct sockaddr *) &ss, slen, p, blen, - NULL, 0, NI_NUMERICHOST); + do_getnameinfo((struct sockaddr *)&ss, p, blen, + NULL, 0, NI_NUMERICHOST); p = buf + strlen(buf); diff --git a/usr/libos.h b/usr/libos.h new file mode 100644 index 0000000..ef585e2 --- /dev/null +++ b/usr/libos.h @@ -0,0 +1,8 @@ +#ifndef __LIBOS_H__ +#define __LIBOS_H__ + +int do_getnameinfo(const struct sockaddr *sa, char *host, size_t hostlen, + char *serv, size_t servlen, int flags); + +#endif + diff --git a/usr/libos/bsd.c b/usr/libos/bsd.c new file mode 100644 index 0000000..7f1c949 --- /dev/null +++ b/usr/libos/bsd.c @@ -0,0 +1,9 @@ +#include <sys/socket.h> +#include <netdb.h> + +int do_getnameinfo(const struct sockaddr *sa, char *host, size_t hostlen, + char *serv, size_t servlen, int flags) +{ + socklen_t slen = sa->sa_len; + return getnameinfo(sa, slen, host, hostlen, serv, servlen, flags); +} diff --git a/usr/libos/linux.c b/usr/libos/linux.c new file mode 100644 index 0000000..6cfa530 --- /dev/null +++ b/usr/libos/linux.c @@ -0,0 +1,9 @@ +#include <sys/socket.h> +#include <netdb.h> + +int do_getnameinfo(const struct sockaddr *sa, char *host, size_t hostlen, + char *serv, size_t servlen, int flags) +{ + socklen_t slen = sizeof(*sa); + return getnameinfo(sa, slen, host, hostlen, serv, servlen, flags); +} -- 1.5.6.5 -- 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