dapl providers: cleanup all compiler warnings in cma and scm providers 

Signed-off by: Arlin Davis [EMAIL PROTECTED]
---
 dapl/include/dapl.h            |   41 +++++++++++++++++++++------------------
 dapl/openib_cma/dapl_ib_cq.c   |    5 +++-
 dapl/openib_cma/dapl_ib_dto.h  |    2 +-
 dapl/openib_cma/dapl_ib_util.c |   33 ++++++++++++++++++++++++-------
 dapl/openib_cma/dapl_ib_util.h |   16 +-------------
 dapl/openib_scm/dapl_ib_cm.c   |   38 +++++++++++++++++++++++++++++-------
 dapl/openib_scm/dapl_ib_dto.h  |    2 +-
 dapl/openib_scm/dapl_ib_util.c |    9 +++++++-
 dapl/openib_scm/dapl_ib_util.h |   14 +------------
 9 files changed, 94 insertions(+), 66 deletions(-)

diff --git a/dapl/include/dapl.h b/dapl/include/dapl.h
index f0f2095..58af95d 100755
--- a/dapl/include/dapl.h
+++ b/dapl/include/dapl.h
@@ -53,20 +53,7 @@
 #include "dapl_osd.h"
 #include "dapl_debug.h"
 
-#ifdef IBAPI
-#include "dapl_ibapi_util.h"
-#elif VAPI
-#include "dapl_vapi_util.h"
-#elif __OPENIB__
-#include "dapl_openib_util.h"
-#include "dapl_openib_cm.h"
-#elif DUMMY
-#include "dapl_dummy_util.h"
-#elif OPENIB
-#include "dapl_ib_util.h"
-#else /* windows - IBAL and/or IBAL+Sock_CM */
-#include "dapl_ibal_util.h"
-#endif
+
 
 /*********************************************************************
  *                                                                   *
@@ -231,11 +218,6 @@ typedef struct dapl_rmr_cookie             DAPL_RMR_COOKIE;
 
 typedef struct dapl_private            DAPL_PRIVATE;
 
-typedef void (*DAPL_CONNECTION_STATE_HANDLER) (
-       IN      DAPL_EP *,
-       IN      ib_cm_events_t,
-       IN      const void *,
-       OUT     DAT_EVENT *);
 
 
 /*********************************************************************
@@ -268,6 +250,21 @@ struct dapl_cookie_buffer
     DAPL_ATOMIC                tail;
 };
 
+#ifdef IBAPI
+#include "dapl_ibapi_util.h"
+#elif VAPI
+#include "dapl_vapi_util.h"
+#elif __OPENIB__
+#include "dapl_openib_util.h"
+#include "dapl_openib_cm.h"
+#elif DUMMY
+#include "dapl_dummy_util.h"
+#elif OPENIB
+#include "dapl_ib_util.h"
+#else /* windows - IBAL and/or IBAL+Sock_CM */
+#include "dapl_ibal_util.h"
+#endif
+
 struct dapl_hca
 {
     DAPL_OS_LOCK       lock;
@@ -701,6 +698,12 @@ void dapls_io_trc_dump (
  *                                                                   *
  *********************************************************************/
 
+typedef void (*DAPL_CONNECTION_STATE_HANDLER) (
+       IN      DAPL_EP *,
+       IN      ib_cm_events_t,
+       IN      const void *,
+       OUT     DAT_EVENT *);
+
 /*
  * DAT Mandated functions
  */
diff --git a/dapl/openib_cma/dapl_ib_cq.c b/dapl/openib_cma/dapl_ib_cq.c
index d7b3309..742c247 100755
--- a/dapl/openib_cma/dapl_ib_cq.c
+++ b/dapl/openib_cma/dapl_ib_cq.c
@@ -486,7 +486,10 @@ dapls_ib_wait_object_wakeup (IN ib_wait_obj_handle_t 
p_cq_wait_obj_handle)
                        p_cq_wait_obj_handle );
 
         /* write to pipe for wake up */
-        write(p_cq_wait_obj_handle->pipe[1], "w", sizeof "w");
+        if (write(p_cq_wait_obj_handle->pipe[1], "w", sizeof "w") == -1)
+               dapl_log(DAPL_DBG_TYPE_UTIL, 
+               " wait object wakeup write error = %s\n",
+               strerror(errno));
        return DAT_SUCCESS;
 }
 
diff --git a/dapl/openib_cma/dapl_ib_dto.h b/dapl/openib_cma/dapl_ib_dto.h
index 334fa4b..2b01963 100644
--- a/dapl/openib_cma/dapl_ib_dto.h
+++ b/dapl/openib_cma/dapl_ib_dto.h
@@ -304,7 +304,7 @@ dapls_ib_post_ext_send (
                     remote_iov, completion_flags);
 
        ib_data_segment_t ds_array[DEFAULT_DS_ENTRIES];
-       ib_data_segment_t *ds_array_p, *ds_array_start_p;
+       ib_data_segment_t *ds_array_p, *ds_array_start_p = NULL;
        struct ibv_send_wr wr;
        struct ibv_send_wr *bad_wr;
        DAT_COUNT i, total_len;
diff --git a/dapl/openib_cma/dapl_ib_util.c b/dapl/openib_cma/dapl_ib_util.c
index 4bbeb8b..a8e1fe3 100755
--- a/dapl/openib_cma/dapl_ib_util.c
+++ b/dapl/openib_cma/dapl_ib_util.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005-2007 Intel Corporation.  All rights reserved.
+ * Copyright (c) 2005-2008 Intel Corporation.  All rights reserved.
  *
  * This Software is licensed under one of the following licenses:
  *
@@ -317,7 +317,10 @@ DAT_RETURN dapls_ib_open_hca(IN IB_HCA_NAME hca_name, IN 
DAPL_HCA *hca_ptr)
        dapl_llist_add_tail(&g_hca_list, 
                            (DAPL_LLIST_ENTRY*)&hca_ptr->ib_trans.entry, 
                            &hca_ptr->ib_trans.entry);
-       write(g_ib_pipe[1], "w", sizeof "w");
+       if (write(g_ib_pipe[1], "w", sizeof "w") == -1)
+               dapl_log(DAPL_DBG_TYPE_UTIL, 
+                        " open_hca: thread wakeup error = %s\n", 
+                        strerror(errno));
        dapl_os_unlock(&g_hca_lock);
        
        dapl_dbg_log(
@@ -384,14 +387,20 @@ DAT_RETURN dapls_ib_close_hca(IN DAPL_HCA *hca_ptr)
         * Wakeup work thread to remove from polling list
         */
        hca_ptr->ib_trans.destroy = 1;
-       write(g_ib_pipe[1], "w", sizeof "w");
+       if (write(g_ib_pipe[1], "w", sizeof "w") == -1)
+               dapl_log(DAPL_DBG_TYPE_UTIL, 
+                        " destroy: thread wakeup error = %s\n", 
+                        strerror(errno));
 
        /* wait for thread to remove HCA references */
        while (hca_ptr->ib_trans.destroy != 2) {
                struct timespec sleep, remain;
                sleep.tv_sec = 0;
                sleep.tv_nsec = 10000000; /* 10 ms */
-               write(g_ib_pipe[1], "w", sizeof "w");
+               if (write(g_ib_pipe[1], "w", sizeof "w") == -1)
+                       dapl_log(DAPL_DBG_TYPE_UTIL, 
+                                " destroy: thread wakeup error = %s\n", 
+                                strerror(errno));              
                dapl_dbg_log(DAPL_DBG_TYPE_UTIL, 
                             " ib_thread_destroy: wait on hca %p destroy\n");
                nanosleep (&sleep, &remain);
@@ -670,14 +679,20 @@ void dapli_ib_thread_destroy(void)
                goto bail;
                        
        g_ib_thread_state = IB_THREAD_CANCEL;
-       write(g_ib_pipe[1], "w", sizeof "w");
+       if (write(g_ib_pipe[1], "w", sizeof "w") == -1)
+               dapl_log(DAPL_DBG_TYPE_UTIL, 
+                        " destroy: thread wakeup error = %s\n", 
+                        strerror(errno));
        while ((g_ib_thread_state != IB_THREAD_EXIT) && (retries--)) {
                struct timespec sleep, remain;
                sleep.tv_sec = 0;
                sleep.tv_nsec = 2000000; /* 2 ms */
                dapl_dbg_log(DAPL_DBG_TYPE_UTIL, 
                        " ib_thread_destroy: waiting for ib_thread\n");
-               write(g_ib_pipe[1], "w", sizeof "w");
+               if (write(g_ib_pipe[1], "w", sizeof "w") == -1)
+                       dapl_log(DAPL_DBG_TYPE_UTIL, 
+                                " destroy: thread wakeup error = %s\n", 
+                               strerror(errno));
                dapl_os_unlock( &g_hca_lock );
                nanosleep(&sleep, &remain);
                dapl_os_lock( &g_hca_lock );
@@ -890,9 +905,11 @@ void dapli_thread(void *arg)
 
                /* check and process user events, PIPE */
                if (ufds[0].revents == POLLIN) {
+                       if (read(g_ib_pipe[0], rbuf, 2) == -1)
+                               dapl_log(DAPL_DBG_TYPE_UTIL,
+                                        " cr_thread: pipe rd err= %s\n",
+                                        strerror(errno));
 
-                       read(g_ib_pipe[0], rbuf, 2);
-                       
                        /* cleanup any device on list marked for destroy */
                        for(idx=3;idx<fds;idx++) {
                                if(uhca[idx] && uhca[idx]->destroy == 1) {
diff --git a/dapl/openib_cma/dapl_ib_util.h b/dapl/openib_cma/dapl_ib_util.h
index 3368180..1e13db9 100755
--- a/dapl/openib_cma/dapl_ib_util.h
+++ b/dapl/openib_cma/dapl_ib_util.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005-2007 Intel Corporation.  All rights reserved.
+ * Copyright (c) 2005-2008 Intel Corporation.  All rights reserved.
  *
  * This Software is licensed under one of the following licenses:
  *
@@ -155,18 +155,6 @@ typedef enum
 
 } ib_thread_state_t;
 
-/* 
- * dapl_llist_entry in dapl.h but dapl.h depends on provider 
- * typedef's in this file first. move dapl_llist_entry out of dapl.h
- */
-struct ib_llist_entry
-{
-    struct dapl_llist_entry    *flink;
-    struct dapl_llist_entry    *blink;
-    void                       *data;
-    struct dapl_llist_entry    *list_head;
-};
-
 struct dapl_cm_id {
        DAPL_OS_LOCK                    lock;
        int                             destroy;
@@ -247,7 +235,7 @@ typedef void (*ib_async_handler_t)(
 /* ib_hca_transport_t, specific to this implementation */
 typedef struct _ib_hca_transport
 { 
-       struct ib_llist_entry   entry;
+       struct dapl_llist_entry entry;
        int                     destroy;
        struct dapl_hca         *d_hca;
        struct rdma_cm_id       *cm_id;
diff --git a/dapl/openib_scm/dapl_ib_cm.c b/dapl/openib_scm/dapl_ib_cm.c
index d2982c7..cf5891d 100644
--- a/dapl/openib_scm/dapl_ib_cm.c
+++ b/dapl/openib_scm/dapl_ib_cm.c
@@ -119,7 +119,10 @@ static void dapli_cm_destroy(struct ib_cm_handle *cm_ptr)
        dapl_os_unlock(&cm_ptr->lock);
 
        /* wakeup work thread */
-        write(g_scm_pipe[1], "w", sizeof "w");
+       if (write(g_scm_pipe[1], "w", sizeof "w") == -1)
+               dapl_log(DAPL_DBG_TYPE_CM, 
+                        " cm_destroy: thread wakeup error = %s\n", 
+                        strerror(errno));
 }
 
 /* queue socket for processing CM work */
@@ -133,7 +136,10 @@ static void dapli_cm_queue(struct ib_cm_handle *cm_ptr)
        dapl_os_unlock(&cm_ptr->hca->ib_trans.lock);
 
         /* wakeup CM work thread */
-        write(g_scm_pipe[1], "w", sizeof "w");
+       if (write(g_scm_pipe[1], "w", sizeof "w") == -1)
+               dapl_log(DAPL_DBG_TYPE_CM, 
+                        " cm_queue: thread wakeup error = %s\n", 
+                        strerror(errno));
 }
 
 static uint16_t dapli_get_lid(IN struct ibv_context *ctx, IN uint8_t port)
@@ -167,7 +173,11 @@ dapli_socket_disconnect(dp_ib_cm_handle_t  cm_ptr)
        } else {
                /* send disc date, close socket, schedule destroy */
                if (cm_ptr->socket >= 0) { 
-                       write(cm_ptr->socket, &disc_data, sizeof(disc_data));
+                       if (write(cm_ptr->socket, 
+                                 &disc_data, sizeof(disc_data)) == -1)
+                               dapl_log(DAPL_DBG_TYPE_WARN, 
+                                        " cm_disc: write error = %s\n", 
+                                        strerror(errno));
                        close(cm_ptr->socket);
                        cm_ptr->socket = -1;
                }
@@ -483,8 +493,11 @@ dapli_socket_connect_rtu(dp_ib_cm_handle_t cm_ptr)
        dapl_dbg_log(DAPL_DBG_TYPE_EP," connect_rtu: send RTU\n"); 
 
        /* complete handshake after final QP state change */
-       write(cm_ptr->socket, &rtu_data, sizeof(rtu_data));
-
+       if (write(cm_ptr->socket, &rtu_data, sizeof(rtu_data)) == -1) {
+               dapl_log(DAPL_DBG_TYPE_ERR, 
+                        " CONN_RTU: write error = %s\n", strerror(errno));
+               goto bail;
+       }
        /* init cm_handle and post the event with private data */
        ep_ptr->cm_handle = cm_ptr;
        cm_ptr->state = SCM_CONNECTED;
@@ -1097,7 +1110,10 @@ dapls_ib_remove_conn_listener (
                /* cr_thread will free */
                cm_ptr->state = SCM_DESTROY;
                sp_ptr->cm_srvc_handle = NULL;
-               write(g_scm_pipe[1], "w", sizeof "w");
+               if (write(g_scm_pipe[1], "w", sizeof "w") == -1)
+                       dapl_log(DAPL_DBG_TYPE_CM, 
+                                " cm_destroy: thread wakeup error = %s\n", 
+                               strerror(errno));
        }
        return DAT_SUCCESS;
 }
@@ -1199,7 +1215,10 @@ dapls_ib_reject_connection(
 
        /* cr_thread will destroy CR */
        cm_ptr->state = SCM_REJECTED;
-        write(g_scm_pipe[1], "w", sizeof "w");
+       if (write(g_scm_pipe[1], "w", sizeof "w") == -1)
+               dapl_log(DAPL_DBG_TYPE_CM, 
+                        " cm_destroy: thread wakeup error = %s\n", 
+                        strerror(errno));
        return DAT_SUCCESS;
 }
 
@@ -1536,7 +1555,10 @@ void cr_thread(void *arg)
        poll(ufds,idx+1,-1); /* infinite, all sockets and pipe */
        /* if pipe used to wakeup, consume */
        if (ufds[0].revents == POLLIN)
-               read(g_scm_pipe[0], rbuf, 2);
+               if (read(g_scm_pipe[0], rbuf, 2) == -1)
+                       dapl_log(DAPL_DBG_TYPE_CM,
+                                " cr_thread: read pipe error = %s\n",
+                                strerror(errno));
        dapl_dbg_log(DAPL_DBG_TYPE_CM," cr_thread: wakeup\n");
        dapl_os_lock(&hca_ptr->ib_trans.lock);
     } 
diff --git a/dapl/openib_scm/dapl_ib_dto.h b/dapl/openib_scm/dapl_ib_dto.h
index b9826f5..45000b9 100644
--- a/dapl/openib_scm/dapl_ib_dto.h
+++ b/dapl/openib_scm/dapl_ib_dto.h
@@ -324,7 +324,7 @@ dapls_ib_post_ext_send (
                     remote_iov, completion_flags, remote_ah);
 
        ib_data_segment_t ds_array[DEFAULT_DS_ENTRIES];
-       ib_data_segment_t *ds_array_p, *ds_array_start_p;
+       ib_data_segment_t *ds_array_p, *ds_array_start_p = NULL;
        struct ibv_send_wr wr;
        struct ibv_send_wr *bad_wr;
        DAT_COUNT i, total_len;
diff --git a/dapl/openib_scm/dapl_ib_util.c b/dapl/openib_scm/dapl_ib_util.c
index 11294fa..58c9943 100644
--- a/dapl/openib_scm/dapl_ib_util.c
+++ b/dapl/openib_scm/dapl_ib_util.c
@@ -359,13 +359,20 @@ DAT_RETURN dapls_ib_close_hca (   IN   DAPL_HCA   
*hca_ptr )
 
        /* destroy cr_thread and lock */
        hca_ptr->ib_trans.cr_state = IB_THREAD_CANCEL;
-       write(g_scm_pipe[1], "w", sizeof "w");
+       if (write(g_scm_pipe[1], "w", sizeof "w") == -1)
+               dapl_log(DAPL_DBG_TYPE_UTIL, 
+                        " thread_destroy: thread wakeup err = %s\n", 
+                        strerror(errno));
        while (hca_ptr->ib_trans.cr_state != IB_THREAD_EXIT) {
                struct timespec sleep, remain;
                sleep.tv_sec = 0;
                sleep.tv_nsec = 2000000; /* 2 ms */
                dapl_dbg_log(DAPL_DBG_TYPE_UTIL, 
                             " close_hca: waiting for cr_thread\n");
+               if (write(g_scm_pipe[1], "w", sizeof "w") == -1)
+                       dapl_log(DAPL_DBG_TYPE_UTIL, 
+                                " thread_destroy: thread wakeup err = %s\n", 
+                                strerror(errno));
                nanosleep (&sleep, &remain);
        }
        dapl_os_lock_destroy(&hca_ptr->ib_trans.lock);
diff --git a/dapl/openib_scm/dapl_ib_util.h b/dapl/openib_scm/dapl_ib_util.h
index 4e75d2c..f0230b8 100644
--- a/dapl/openib_scm/dapl_ib_util.h
+++ b/dapl/openib_scm/dapl_ib_util.h
@@ -90,18 +90,6 @@ typedef struct _ib_qp_cm
        uint16_t                qp_type; 
 } ib_qp_cm_t;
 
-/* 
- * dapl_llist_entry in dapl.h but dapl.h depends on provider 
- * typedef's in this file first. move dapl_llist_entry out of dapl.h
- */
-struct ib_llist_entry
-{
-    struct dapl_llist_entry    *flink;
-    struct dapl_llist_entry    *blink;
-    void                       *data;
-    struct dapl_llist_entry    *list_head;
-};
-
 typedef enum scm_state 
 {
        SCM_INIT,
@@ -119,7 +107,7 @@ typedef enum scm_state
 
 struct ib_cm_handle
 { 
-       struct ib_llist_entry   entry;
+       struct dapl_llist_entry entry;
        DAPL_OS_LOCK            lock;
        SCM_STATE               state;
        int                     socket;
-- 
1.5.2.5


_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to