[ofa-general] [PATCH 1/5] [DAPL] dapl: sync with WinOF tree

Sean Hefty sean.hefty at intel.com
Fri Jan 30 10:51:15 PST 2009


The common DAPL codebase shared between Windows and Linux has
diverged.  Resync to get back to common code that builds on both
operating systems.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---

 dapl/common/dapl_adapter_util.h |    2 +-
 dapl/common/dapl_debug.c        |    2 +-
 dapl/common/dapl_evd_util.c     |    4 ----
 dapl/common/dapl_sp_util.c      |    4 ++--
 dapl/include/dapl.h             |    2 +-
 dapl/udapl/linux/dapl_osd.h     |   15 +++++++++++++++
 dapl/udapl/windows/dapl_osd.h   |   12 ++++++++++--
 dat/udat/SOURCES                |    6 +++++-
 dat/udat/udat_exports.src       |    2 ++
 dat/udat/windows/dat_osd.c      |   10 ++++------
 dat/udat/windows/dat_osd.h      |    4 ++--
 11 files changed, 43 insertions(+), 20 deletions(-)

diff --git a/dapl/common/dapl_adapter_util.h b/dapl/common/dapl_adapter_util.h
index c5bf5da..e3069f8 100755
--- a/dapl/common/dapl_adapter_util.h
+++ b/dapl/common/dapl_adapter_util.h
@@ -247,7 +247,7 @@ int dapls_ib_private_data_size (
 void 
 dapls_query_provider_specific_attr(
    	IN DAPL_IA			*ia_ptr,
-	IN DAT_PROVIDER_ATTR		*provider_attr );
+	IN DAT_PROVIDER_ATTR		*attr_ptr );
 
 #ifdef CQ_WAIT_OBJECT
 DAT_RETURN
diff --git a/dapl/common/dapl_debug.c b/dapl/common/dapl_debug.c
index cbc356c..e717591 100644
--- a/dapl/common/dapl_debug.c
+++ b/dapl/common/dapl_debug.c
@@ -53,7 +53,7 @@ void dapl_internal_dbg_log ( DAPL_DBG_TYPE type, const char *fmt, ...)
 	if ( DAPL_DBG_DEST_STDOUT & g_dapl_dbg_dest )
 	{
 	    va_start (args, fmt);
-            fprintf(stdout, "%s:%d: ", _ptr_host_, getpid());
+            fprintf(stdout, "%s:%d: ", _ptr_host_, dapl_os_getpid());
 	    dapl_os_vprintf (fmt, args);
 	    va_end (args);
 	}
diff --git a/dapl/common/dapl_evd_util.c b/dapl/common/dapl_evd_util.c
index 1d13ce0..c6c7463 100644
--- a/dapl/common/dapl_evd_util.c
+++ b/dapl/common/dapl_evd_util.c
@@ -48,10 +48,6 @@
 #include "dapl_sp_util.h"
 #include "dapl_ep_util.h"
 
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
 STATIC _INLINE_ void dapli_evd_eh_print_cqe (
 	IN  ib_work_completion_t	*cqe);
 
diff --git a/dapl/common/dapl_sp_util.c b/dapl/common/dapl_sp_util.c
index 5ac0660..cdebc67 100644
--- a/dapl/common/dapl_sp_util.c
+++ b/dapl/common/dapl_sp_util.c
@@ -98,7 +98,7 @@ dapls_sp_alloc (
     dapl_llist_init_entry (&sp_ptr->header.ia_list_entry);
     dapl_os_lock_init (&sp_ptr->header.lock);
 
-#if defined(_WIN32) || defined(_WIN64)
+#if defined(_VENDOR_IBAL_)
     dapl_os_wait_object_init( &sp_ptr->wait_object );
 #endif
     /*
@@ -133,7 +133,7 @@ dapls_sp_free_sp (
 		    sp_ptr->header.magic == DAPL_MAGIC_RSP);
     dapl_os_assert (dapl_llist_is_empty (&sp_ptr->cr_list_head));
 
-#if defined(_WIN32) || defined(_WIN64)
+#if defined(_VENDOR_IBAL_)
     dapl_os_wait_object_destroy( &sp_ptr->wait_object );
 #endif
     dapl_os_lock (&sp_ptr->header.lock);
diff --git a/dapl/include/dapl.h b/dapl/include/dapl.h
index 58af95d..e2025ce 100755
--- a/dapl/include/dapl.h
+++ b/dapl/include/dapl.h
@@ -543,7 +543,7 @@ struct dapl_sp
     ib_cm_srvc_handle_t	cm_srvc_handle; /* Used by Mellanox CM */
     DAPL_LLIST_HEAD	cr_list_head;	/* CR pending queue */
     DAT_COUNT		cr_list_count;	/* count of CRs on queue */
-#if _VENDOR_IBAL_
+#if defined(_VENDOR_IBAL_)
     DAPL_OS_WAIT_OBJECT wait_object;    /* cancel & destroy. */
 #endif
 };
diff --git a/dapl/udapl/linux/dapl_osd.h b/dapl/udapl/linux/dapl_osd.h
index 42ced41..6fef9af 100644
--- a/dapl/udapl/linux/dapl_osd.h
+++ b/dapl/udapl/linux/dapl_osd.h
@@ -67,17 +67,31 @@
 #include <sys/time.h>
 #include <syslog.h>
 #include <netdb.h>			/* for getaddrinfo */
+#include <byteswap.h>
+
+#include <sys/ioctl.h>  /* for IOCTL's */
 
 #include "dapl_debug.h"
 
 /*
  * Include files for setting up a network name
  */
+#include <sys/socket.h> /* for socket(2) */
+#include <net/if.h>     /* for struct ifreq */
+#include <net/if_arp.h> /* for ARPHRD_ETHER */
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 #include <ctype.h>
 
+#include <sys/poll.h>
+#include <signal.h>
+#include <netinet/tcp.h>
+#include <sys/utsname.h>
+#include <fcntl.h>
+
 #if !defined(REDHAT_EL5) && (defined(__ia64__))
 #include <asm/atomic.h>
 #endif
@@ -543,6 +557,7 @@ dapl_os_strtol(const char *nptr, char **endptr, int base)
 #define dapl_os_vprintf(fmt,args)	vprintf(fmt,args)
 #define dapl_os_syslog(fmt,args)	vsyslog(LOG_USER|LOG_WARNING,fmt,args)
 
+#define dapl_os_getpid getpid
 
 
 #endif /*  _DAPL_OSD_H_ */
diff --git a/dapl/udapl/windows/dapl_osd.h b/dapl/udapl/windows/dapl_osd.h
index 9ed2559..43f70ee 100644
--- a/dapl/udapl/windows/dapl_osd.h
+++ b/dapl/udapl/windows/dapl_osd.h
@@ -56,6 +56,7 @@
 #include <string.h>
 #include <winsock2.h>
 #include <Ws2tcpip.h>
+#include <process.h>
 #include <stdlib.h>
 #pragma warning ( pop )
 
@@ -84,6 +85,9 @@
              exit(1);				\
 	}
 
+#define openlog(...)
+#define closelog(...)
+
 /*
  * Atomic operations
  */
@@ -459,7 +463,7 @@ typedef unsigned long 		DAPL_OS_TICKS;
  */
 STATIC __inline void dapl_os_sleep_usec (int sleep_time)
 {
-    Sleep(sleep_time/1000);
+    Sleep(sleep_time/1000); // convert to milliseconds
 }
 
 STATIC __inline DAPL_OS_TICKS dapl_os_get_ticks (void);
@@ -513,6 +517,11 @@ dapl_os_strtol(const char *nptr, char **endptr, int base)
     return strtol(nptr, endptr, base);
 }
 
+STATIC __inline int
+dapl_os_getpid(void)
+{
+	return (int)GetCurrentProcessId();
+}
 
 /*
  *  Debug Helper Functions
@@ -524,7 +533,6 @@ dapl_os_strtol(const char *nptr, char **endptr, int base)
 #define dapl_os_vprintf(fmt,args)	vprintf(fmt,args)
 #define dapl_os_syslog(fmt,args)	/* XXX Need log routine call */
 
-
 #endif /*  _DAPL_OSD_H_ */
 
 /*
diff --git a/dat/udat/SOURCES b/dat/udat/SOURCES
index a205ebc..7d37f65 100644
--- a/dat/udat/SOURCES
+++ b/dat/udat/SOURCES
@@ -6,8 +6,12 @@ TARGETNAME=dat2d
 TARGETPATH=..\..\..\..\bin\user\obj$(BUILD_ALT_DIR)
 TARGETTYPE=DYNLINK
 DLLENTRY=_DllMainCRTStartup
+!if $(_NT_TOOLS_VERSION) == 0x700
 DLLDEF=$O\udat_exports.def
-USE_CRTDLL=1
+!else
+DLLDEF=$(OBJ_PATH)\$O\udat_exports.def
+!endif
+USE_MSVCRT=1
 
 SOURCES=udat.rc			\
 	udat.c			\
diff --git a/dat/udat/udat_exports.src b/dat/udat/udat_exports.src
index 5493be4..42e3773 100644
--- a/dat/udat/udat_exports.src
+++ b/dat/udat/udat_exports.src
@@ -42,6 +42,7 @@ dat_pz_free
 dat_pz_query
 dat_registry_add_provider
 dat_registry_remove_provider
+dat_registry_list_providers
 dat_rmr_bind
 dat_rmr_create
 dat_rmr_free
@@ -50,6 +51,7 @@ dat_rsp_create
 dat_rsp_free
 dat_rsp_query
 dat_strerror
+dats_get_ia_handle
 #ifdef DAT_EXTENSIONS
 dat_extension_op
 #endif
diff --git a/dat/udat/windows/dat_osd.c b/dat/udat/windows/dat_osd.c
index 9f21e8f..5b57f43 100644
--- a/dat/udat/windows/dat_osd.c
+++ b/dat/udat/windows/dat_osd.c
@@ -113,16 +113,14 @@ dat_os_dbg_print (
     {
         va_list args;
                 
-        va_start(args, fmt);
-
         if ( DAT_OS_DBG_DEST_STDOUT & g_dbg_dest )
         {
+            va_start(args, fmt);
             vfprintf(stdout, fmt, args);
-        }
-
-        va_end(args);
-
         fflush(stdout);
+            va_end(args);
+        }
+	/* no syslog() susport in Windows */
     }
 }
 
diff --git a/dat/udat/windows/dat_osd.h b/dat/udat/windows/dat_osd.h
index 2e18988..d78fe44 100644
--- a/dat/udat/windows/dat_osd.h
+++ b/dat/udat/windows/dat_osd.h
@@ -48,8 +48,8 @@
 #error "UNDEFINED OS TYPE"
 #endif /* WIN32/64 */
 
-#include <dat/udat.h>
-#include <dat/dat_registry.h>
+#include <dat2/udat.h>
+#include <dat2/dat_registry.h>
 
 #include <windows.h>
 #include <assert.h>






More information about the general mailing list