[WinOF] IBSDK sample code - Applied AL_API declarations to all callback routines.
authorstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 10 Dec 2007 20:38:36 +0000 (20:38 +0000)
committerstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 10 Dec 2007 20:38:36 +0000 (20:38 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@915 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

tests/cmtest/user/cmtest_main.c

index a06db1f..f24b6af 100644 (file)
@@ -206,39 +206,39 @@ static char *wc_status_text[] = {
 \r
 \r
 \r
-static void\r
+static void AL_API\r
 __req_cb(\r
        IN                              ib_cm_req_rec_t                         *p_cm_req_rec );\r
 \r
-static void\r
+static void AL_API\r
 __rep_cb(\r
        IN                              ib_cm_rep_rec_t                         *p_cm_rep_rec );\r
 \r
-static void\r
+static void AL_API\r
 __rtu_cb(\r
        IN                              ib_cm_rtu_rec_t                         *p_cm_rtu_rec );\r
 \r
-static void\r
+static void AL_API\r
 __rej_cb(\r
        IN                              ib_cm_rej_rec_t                         *p_cm_rej_rec );\r
 \r
-static void\r
+static void AL_API\r
 __mra_cb(\r
        IN                              ib_cm_mra_rec_t                         *p_cm_mra_rec );\r
 \r
-static void\r
+static void AL_API\r
 __apr_cb(\r
        IN                              ib_cm_apr_rec_t                         *p_cm_apr_rec );\r
 \r
-static void\r
+static void AL_API\r
 __lap_cb(\r
        IN                              ib_cm_lap_rec_t                         *p_cm_lap_rec );\r
 \r
-static void\r
+static void AL_API\r
 __dreq_cb(\r
        IN                              ib_cm_dreq_rec_t                        *p_cm_dreq_rec );\r
 \r
-static void\r
+static void AL_API\r
 __drep_cb(\r
        IN                              ib_cm_drep_rec_t                        *p_cm_drep_rec );\r
 \r
@@ -509,46 +509,46 @@ static void
 __init_conn_info()\r
 {\r
        /* Initialize connection request parameters. */\r
-       g_root.cm_req.svc_id = CMT_BASE_SVC_ID + g_root.inst_id;\r
-       g_root.cm_req.max_cm_retries = 5;\r
-       g_root.cm_req.p_primary_path = &g_root.path_rec;\r
-       g_root.cm_req.pfn_cm_rep_cb = (ib_pfn_cm_rep_cb_t)__rep_cb;\r
-       g_root.cm_req.qp_type = IB_QPT_RELIABLE_CONN;\r
-       g_root.cm_req.resp_res = 3;\r
-       g_root.cm_req.init_depth = 1;\r
+       g_root.cm_req.svc_id                    = CMT_BASE_SVC_ID + g_root.inst_id;\r
+       g_root.cm_req.max_cm_retries    = 5;\r
+       g_root.cm_req.p_primary_path    = &g_root.path_rec;\r
+       g_root.cm_req.pfn_cm_rep_cb             = __rep_cb;\r
+       g_root.cm_req.qp_type                   = IB_QPT_RELIABLE_CONN;\r
+       g_root.cm_req.resp_res                  = 3;\r
+       g_root.cm_req.init_depth                = 1;\r
        g_root.cm_req.remote_resp_timeout = 20;\r
-       g_root.cm_req.flow_ctrl = TRUE;\r
-       g_root.cm_req.local_resp_timeout = 20;\r
-       g_root.cm_req.rnr_nak_timeout = 6;\r
-       g_root.cm_req.rnr_retry_cnt = 3;\r
-       g_root.cm_req.retry_cnt = 5;\r
-       g_root.cm_req.pfn_cm_mra_cb = (ib_pfn_cm_mra_cb_t)__mra_cb;\r
-       g_root.cm_req.pfn_cm_rej_cb = (ib_pfn_cm_rej_cb_t)__rej_cb;\r
+       g_root.cm_req.flow_ctrl                 = TRUE;\r
+       g_root.cm_req.local_resp_timeout= 20;\r
+       g_root.cm_req.rnr_nak_timeout   = 6;\r
+       g_root.cm_req.rnr_retry_cnt             = 3;\r
+       g_root.cm_req.retry_cnt                 = 5;\r
+       g_root.cm_req.pfn_cm_mra_cb             = __mra_cb;\r
+       g_root.cm_req.pfn_cm_rej_cb             = __rej_cb;\r
 \r
        /* Initialize connection reply parameters. */\r
-       g_root.cm_rep.qp_type = IB_QPT_RELIABLE_CONN;\r
-       g_root.cm_rep.access_ctrl = CMT_ACCESS_CTRL;\r
-       g_root.cm_rep.sq_depth = 0;\r
-       g_root.cm_rep.rq_depth = 0;\r
-       g_root.cm_rep.init_depth = 1;\r
-       g_root.cm_rep.target_ack_delay = 7;\r
-       g_root.cm_rep.failover_accepted = IB_FAILOVER_ACCEPT_UNSUPPORTED;\r
-       g_root.cm_rep.flow_ctrl = TRUE;\r
-       g_root.cm_rep.rnr_nak_timeout = 7;\r
-       g_root.cm_rep.rnr_retry_cnt = 6;\r
-       g_root.cm_rep.pfn_cm_rej_cb = (ib_pfn_cm_rej_cb_t)__rej_cb;\r
-       g_root.cm_rep.pfn_cm_mra_cb = (ib_pfn_cm_mra_cb_t)__mra_cb;\r
-       g_root.cm_rep.pfn_cm_rtu_cb = (ib_pfn_cm_rtu_cb_t)__rtu_cb;\r
-       g_root.cm_rep.pfn_cm_lap_cb = (ib_pfn_cm_lap_cb_t)__lap_cb;\r
-       g_root.cm_rep.pfn_cm_dreq_cb = (ib_pfn_cm_dreq_cb_t)__dreq_cb;\r
+       g_root.cm_rep.qp_type                   = IB_QPT_RELIABLE_CONN;\r
+       g_root.cm_rep.access_ctrl               = CMT_ACCESS_CTRL;\r
+       g_root.cm_rep.sq_depth                  = 0;\r
+       g_root.cm_rep.rq_depth                  = 0;\r
+       g_root.cm_rep.init_depth                = 1;\r
+       g_root.cm_rep.target_ack_delay  = 7;\r
+       g_root.cm_rep.failover_accepted = IB_FAILOVER_ACCEPT_UNSUPPORTED;\r
+       g_root.cm_rep.flow_ctrl                 = TRUE;\r
+       g_root.cm_rep.rnr_nak_timeout   = 7;\r
+       g_root.cm_rep.rnr_retry_cnt             = 6;\r
+       g_root.cm_rep.pfn_cm_rej_cb             = __rej_cb;\r
+       g_root.cm_rep.pfn_cm_mra_cb             = __mra_cb;\r
+       g_root.cm_rep.pfn_cm_rtu_cb             = __rtu_cb;\r
+       g_root.cm_rep.pfn_cm_lap_cb             = __lap_cb;\r
+       g_root.cm_rep.pfn_cm_dreq_cb    = __dreq_cb;\r
 \r
        /* Initialize connection RTU parameters. */\r
-       g_root.cm_rtu.pfn_cm_apr_cb = (ib_pfn_cm_apr_cb_t)__apr_cb;\r
-       g_root.cm_rtu.pfn_cm_dreq_cb = (ib_pfn_cm_dreq_cb_t)__dreq_cb;\r
+       g_root.cm_rtu.pfn_cm_apr_cb             = __apr_cb;\r
+       g_root.cm_rtu.pfn_cm_dreq_cb    = __dreq_cb;\r
 \r
        /* Initialize disconnection request parameters. */\r
-       g_root.cm_dreq.pfn_cm_drep_cb = (ib_pfn_cm_drep_cb_t)__drep_cb;\r
-       g_root.cm_dreq.qp_type = IB_QPT_RELIABLE_CONN;\r
+       g_root.cm_dreq.pfn_cm_drep_cb   = __drep_cb;\r
+       g_root.cm_dreq.qp_type                  = IB_QPT_RELIABLE_CONN;\r
 \r
        /* Disconnection reply parameters are all zero. */\r
 }\r
@@ -659,7 +659,7 @@ __post_recvs(
 \r
 \r
 \r
-static void\r
+static void AL_API\r
 __ca_async_event_cb(\r
        ib_async_event_rec_t    *p_err_rec )\r
 {\r
@@ -673,32 +673,32 @@ __ca_async_event_cb(
 \r
 \r
 \r
-static void\r
+static void AL_API\r
 __cm_listen_err_cb(\r
        IN                              ib_listen_err_rec_t                     *p_listen_err_rec )\r
 {\r
        CL_ENTER( CMT_DBG_VERBOSE, cmt_dbg_lvl );\r
        if( !p_listen_err_rec )\r
-               printf( "__listen_err_cb NULL p_listen_err_rec\n" );\r
+               printf( "%s NULL p_listen_err_rec\n", __FUNCTION__ );\r
        CL_EXIT( CMT_DBG_VERBOSE, cmt_dbg_lvl );\r
 }\r
 \r
 \r
 \r
-static void\r
+static void AL_API\r
 __cancel_listen_cb(\r
        IN                              void                                            *context )\r
 {\r
        CL_ENTER( CMT_DBG_VERBOSE, cmt_dbg_lvl );\r
        if( !context )\r
-               printf( "__cancel_listen_cb NULL context\n" );\r
+               printf( "%s NULL context\n", __FUNCTION__ );\r
        CL_EXIT( CMT_DBG_VERBOSE, cmt_dbg_lvl );\r
 }\r
 \r
 \r
 \r
 /* We need to halt the test and recover from the reject error. */\r
-static void\r
+static void AL_API\r
 __rej_cb(\r
        IN                              ib_cm_rej_rec_t                         *p_cm_rej_rec )\r
 {\r
@@ -719,7 +719,7 @@ __rej_cb(
 \r
 \r
 \r
-static void\r
+static void AL_API\r
 __req_cb(\r
        IN                              ib_cm_req_rec_t                         *p_cm_req_rec )\r
 {\r
@@ -763,7 +763,7 @@ __req_cb(
 \r
 \r
 \r
-static void\r
+static void AL_API\r
 __rep_cb(\r
        IN                              ib_cm_rep_rec_t                         *p_cm_rep_rec )\r
 {\r
@@ -806,7 +806,7 @@ __rep_cb(
 \r
 \r
 \r
-static void\r
+static void AL_API\r
 __rtu_cb(\r
        IN                              ib_cm_rtu_rec_t                         *p_cm_rtu_rec )\r
 {\r
@@ -826,7 +826,7 @@ __rtu_cb(
 \r
 \r
 \r
-static void\r
+static void AL_API\r
 __mra_cb(\r
        IN                              ib_cm_mra_rec_t                         *p_cm_mra_rec )\r
 {\r
@@ -837,7 +837,7 @@ __mra_cb(
 \r
 \r
 \r
-static void\r
+static void AL_API\r
 __apr_cb(\r
        IN                              ib_cm_apr_rec_t                         *p_cm_apr_rec )\r
 {\r
@@ -848,7 +848,7 @@ __apr_cb(
 \r
 \r
 \r
-static void\r
+static void AL_API\r
 __lap_cb(\r
        IN                              ib_cm_lap_rec_t                         *p_cm_lap_rec )\r
 {\r
@@ -859,7 +859,7 @@ __lap_cb(
 \r
 \r
 \r
-static void\r
+static void AL_API\r
 __dreq_cb(\r
        IN                              ib_cm_dreq_rec_t                        *p_cm_dreq_rec )\r
 {\r
@@ -904,7 +904,7 @@ __dreq_cb(
 \r
 \r
 \r
-static void\r
+static void AL_API\r
 __drep_cb(\r
        IN                              ib_cm_drep_rec_t                        *p_cm_drep_rec )\r
 {\r
@@ -926,7 +926,7 @@ __drep_cb(
 \r
 \r
 \r
-static void\r
+static void AL_API\r
 __cq_cb(\r
        IN              const   ib_cq_handle_t                          h_cq,\r
        IN                              void*                                           cq_context )\r
@@ -1070,7 +1070,7 @@ __init_node(
        else\r
                cq_create.size = 1;     /* minimal of one entry */\r
 \r
-       cq_create.pfn_comp_cb = (ib_pfn_comp_cb_t)__cq_cb;\r
+       cq_create.pfn_comp_cb = __cq_cb;\r
        status = ib_create_cq( g_root.h_ca, &cq_create, p_node, NULL,\r
                &p_node->h_send_cq );\r
        if( status != IB_SUCCESS )\r
@@ -1186,7 +1186,7 @@ __destroy_nodes()
 }\r
 \r
 /* query function called by ib_query() */\r
-static void\r
+static void AL_API\r
 __sa_query_cb(\r
        IN                              ib_query_rec_t                          *p_query_rec )\r
 {\r
@@ -1259,7 +1259,7 @@ __query_for_path()
        query_rec.retry_cnt = 2;\r
        query_rec.flags = IB_FLAGS_SYNC;\r
        query_rec.query_context = &g_root;\r
-       query_rec.pfn_query_cb = (ib_pfn_query_cb_t)__sa_query_cb;\r
+       query_rec.pfn_query_cb = __sa_query_cb;\r
 \r
        status = ib_query( g_root.h_al, &query_rec, NULL );\r
        if( ( status != IB_SUCCESS ) || ( !g_root.path_rec.dlid ) )\r
@@ -1319,7 +1319,7 @@ __create_messages()
 /*\r
  * PnP callback handler.  Record the port GUID of an active port.\r
  */\r
-static ib_api_status_t\r
+static ib_api_status_t AL_API\r
 __pnp_cb(\r
        IN                                      ib_pnp_rec_t                            *p_pnp_rec )\r
 {\r
@@ -1379,7 +1379,7 @@ __reg_pnp()
        cl_memclr( &pnp_req, sizeof( ib_pnp_req_t ) );\r
        pnp_req.pnp_class = IB_PNP_PORT;\r
        pnp_req.pnp_context = &g_root;\r
-       pnp_req.pfn_pnp_cb = (ib_pfn_pnp_cb_t)__pnp_cb;\r
+       pnp_req.pfn_pnp_cb = __pnp_cb;\r
 \r
        /* Register for PnP events. */\r
        status = ib_reg_pnp( g_root.h_al, &pnp_req, &h_pnp );\r
@@ -1427,7 +1427,7 @@ __init_root()
        /* Open the CA. */\r
        status = ib_open_ca( g_root.h_al,\r
                                                 g_root.ca_guid,\r
-                                                (ib_pfn_event_cb_t)__ca_async_event_cb,\r
+                                                __ca_async_event_cb,\r
                                                 &g_root,\r
                                                 &g_root.h_ca );\r
        if( status != IB_SUCCESS )\r
@@ -1478,7 +1478,7 @@ static void
 __cleanup()\r
 {\r
        if( g_root.h_listen )\r
-               ib_cm_cancel( g_root.h_listen, (ib_pfn_destroy_cb_t)__cancel_listen_cb );\r
+               ib_cm_cancel( g_root.h_listen, __cancel_listen_cb );\r
 \r
        /* Close AL if it was opened. */\r
        if( g_root.h_al )\r
@@ -1513,13 +1513,13 @@ __listen()
        /* The server side listens. */\r
        cm_listen.svc_id = CMT_BASE_SVC_ID + g_root.inst_id;\r
 \r
-       cm_listen.pfn_cm_req_cb = (ib_pfn_cm_req_cb_t)__req_cb;\r
+       cm_listen.pfn_cm_req_cb = __req_cb;\r
 \r
        cm_listen.qp_type = IB_QPT_RELIABLE_CONN;\r
 \r
        status = ib_cm_listen( g_root.h_al,\r
                                                   &cm_listen, \r
-                                                  (ib_pfn_listen_err_cb_t)__cm_listen_err_cb,\r
+                                                  __cm_listen_err_cb,\r
                                                   &g_root,\r
                                                   &g_root.h_listen );\r
        if( status != IB_SUCCESS )\r
@@ -1706,8 +1706,7 @@ __disconnect()
 \r
        if( g_root.h_listen )\r
        {\r
-               ib_cm_cancel( g_root.h_listen,\r
-                                         (const ib_pfn_destroy_cb_t)__cancel_listen_cb );\r
+               ib_cm_cancel( g_root.h_listen, __cancel_listen_cb );\r
                g_root.h_listen = NULL;\r
        }\r
        /* Calculate the total connection time. */\r