ctdb-ib: Fix build for infiniband transport
authorAmitay Isaacs <amitay@gmail.com>
Tue, 13 Oct 2015 05:19:21 +0000 (16:19 +1100)
committerMartin Schwenke <martins@samba.org>
Tue, 27 Oct 2015 03:15:15 +0000 (04:15 +0100)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/ib/ibw_ctdb.c
ctdb/ib/ibw_ctdb_init.c
ctdb/ib/ibwrapper_test.c
ctdb/wscript

index 2e70d1d8e5bfabadc9fe91ded958d2ec643d791e..438bf69fec0573f1c745aa71af91238297d4601b 100644 (file)
@@ -49,17 +49,8 @@ int ctdb_ibw_node_connect(struct ctdb_node *node)
 
        assert(cn!=NULL);
        assert(cn->conn!=NULL);
-       struct sockaddr_in sock_out;
-
-       memset(&sock_out, 0, sizeof(struct sockaddr_in));
-       sock_out.sin_port = htons(node->address.port);
-       sock_out.sin_family = PF_INET;
-       if (ctdb_ibw_get_address(node->ctdb, node->address.address, &sock_out.sin_addr)) {
-               DEBUG(DEBUG_ERR, ("ctdb_ibw_node_connect failed\n"));
-               return -1;
-       }
 
-       rc = ibw_connect(cn->conn, &sock_out, node);
+       rc = ibw_connect(cn->conn, &node->address.ip, node);
        if (rc) {
                DEBUG(DEBUG_ERR, ("ctdb_ibw_node_connect/ibw_connect failed - retrying...\n"));
                /* try again once a second */
index 63deff28430acd864a44baefc8ccd7495ee09dee..b71909ad0f82fcb5f913b3b40f513666d00abb9a 100644 (file)
 static int ctdb_ibw_listen(struct ctdb_context *ctdb, int backlog)
 {
        struct ibw_ctx *ictx = talloc_get_type(ctdb->private_data, struct ibw_ctx);
-       struct sockaddr_in my_addr;
 
        assert(ictx!=NULL);
-       memset(&my_addr, 0, sizeof(struct sockaddr_in));
-       my_addr.sin_port = htons(ctdb->address.port);
-       my_addr.sin_family = PF_INET;
-       if (ctdb_ibw_get_address(ctdb, ctdb->address.address, &my_addr.sin_addr))
-               return -1;
 
-       if (ibw_bind(ictx, &my_addr)) {
+       if (ibw_bind(ictx, &ctdb->address->ip)) {
                DEBUG(DEBUG_CRIT, ("ctdb_ibw_listen: ibw_bind failed\n"));
                return -1;
        }
@@ -105,7 +99,7 @@ static int ctdb_ibw_start(struct ctdb_context *ctdb)
        /* everything async here */
        for (i=0;i<ctdb->num_nodes;i++) {
                struct ctdb_node *node = ctdb->nodes[i];
-               if (!ctdb_same_address(&ctdb->address, &node->address)) {
+               if (!ctdb_same_address(ctdb->address, &node->address)) {
                        ctdb_ibw_node_connect(node);
                }
        }
index 397fdf1af710d2f5840588be1810543be8d1ab8e..a006966d58d45d0959bc3782fbad83ef121fe41a 100644 (file)
@@ -77,7 +77,7 @@ enum testopcode {
        TESTOP_SEND_RND = 3
 };
 
-int ibwtest_connect_everybody(struct ibwtest_ctx *tcx)
+static int ibwtest_connect_everybody(struct ibwtest_ctx *tcx)
 {
        struct ibw_conn         *conn;
        struct ibwtest_conn     *tconn = talloc_zero(tcx, struct ibwtest_conn);
@@ -95,7 +95,7 @@ int ibwtest_connect_everybody(struct ibwtest_ctx *tcx)
        return 0;
 }
 
-int ibwtest_send_id(struct ibw_conn *conn)
+static int ibwtest_send_id(struct ibw_conn *conn)
 {
        struct ibwtest_ctx *tcx = talloc_get_type(conn->ctx->ctx_userdata, struct ibwtest_ctx);
        char *buf;
@@ -123,7 +123,7 @@ int ibwtest_send_id(struct ibw_conn *conn)
        return 0;
 }
 
-int ibwtest_send_test_msg(struct ibwtest_ctx *tcx, struct ibw_conn *conn, const char *msg)
+static int ibwtest_send_test_msg(struct ibwtest_ctx *tcx, struct ibw_conn *conn, const char *msg)
 {
        char *buf, *p;
        void *key;
@@ -154,7 +154,7 @@ int ibwtest_send_test_msg(struct ibwtest_ctx *tcx, struct ibw_conn *conn, const
        return 0;
 }
 
-unsigned char ibwtest_fill_random(unsigned char *buf, uint32_t size)
+static unsigned char ibwtest_fill_random(unsigned char *buf, uint32_t size)
 {
        uint32_t        i = size;
        unsigned char   sum = 0;
@@ -168,7 +168,7 @@ unsigned char ibwtest_fill_random(unsigned char *buf, uint32_t size)
        return sum;
 }
 
-unsigned char ibwtest_get_sum(unsigned char *buf, uint32_t size)
+static unsigned char ibwtest_get_sum(unsigned char *buf, uint32_t size)
 {
        uint32_t        i = size;
        unsigned char   sum = 0;
@@ -180,7 +180,7 @@ unsigned char ibwtest_get_sum(unsigned char *buf, uint32_t size)
        return sum;
 }
 
-int ibwtest_do_varsize_scenario_conn_size(struct ibwtest_ctx *tcx, struct ibw_conn *conn, uint32_t size)
+static int ibwtest_do_varsize_scenario_conn_size(struct ibwtest_ctx *tcx, struct ibw_conn *conn, uint32_t size)
 {
        unsigned char *buf;
        void    *key;
@@ -205,7 +205,7 @@ int ibwtest_do_varsize_scenario_conn_size(struct ibwtest_ctx *tcx, struct ibw_co
        return 0;
 }
 
-int ibwtest_do_varsize_scenario_conn(struct ibwtest_ctx *tcx, struct ibw_conn *conn)
+static int ibwtest_do_varsize_scenario_conn(struct ibwtest_ctx *tcx, struct ibw_conn *conn)
 {
        uint32_t        size;
        int     i;
@@ -234,7 +234,7 @@ int ibwtest_do_varsize_scenario_conn(struct ibwtest_ctx *tcx, struct ibw_conn *c
        }
 }*/
 
-int ibwtest_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn)
+static int ibwtest_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn)
 {
        struct ibwtest_ctx      *tcx = NULL; /* userdata */
        struct ibwtest_conn     *tconn = NULL; /* userdata */
@@ -298,7 +298,7 @@ int ibwtest_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn)
        return 0;
 }
 
-int ibwtest_receive_handler(struct ibw_conn *conn, void *buf, int n)
+static int ibwtest_receive_handler(struct ibw_conn *conn, void *buf, int n)
 {
        struct ibwtest_conn *tconn;
        enum testopcode op;
@@ -375,7 +375,7 @@ error:
        return -1;
 }
 
-void ibwtest_timeout_handler(struct event_context *ev, struct timed_event *te, 
+static void ibwtest_timeout_handler(struct event_context *ev, struct timed_event *te,
        struct timeval t, void *private_data)
 {
        struct ibwtest_ctx *tcx = talloc_get_type(private_data, struct ibwtest_ctx);
@@ -401,7 +401,7 @@ void ibwtest_timeout_handler(struct event_context *ev, struct timed_event *te,
 
 static struct ibwtest_ctx *testctx = NULL;
 
-void ibwtest_sigint_handler(int sig)
+static void ibwtest_sigint_handler(int sig)
 {
        DEBUG(DEBUG_ERR, ("got SIGINT\n"));
        if (testctx) {
@@ -422,7 +422,7 @@ void ibwtest_sigint_handler(int sig)
        }
 }
 
-int ibwtest_parse_attrs(struct ibwtest_ctx *tcx, char *optext,
+static int ibwtest_parse_attrs(struct ibwtest_ctx *tcx, char *optext,
        struct ibw_initattr **pattrs, int *nattrs, char op)
 {
        int     i = 0, n = 1;
@@ -477,7 +477,7 @@ static int ibwtest_get_address(const char *address, struct in_addr *addr)
        return 0;
 }
 
-int ibwtest_getdests(struct ibwtest_ctx *tcx, char op)
+static int ibwtest_getdests(struct ibwtest_ctx *tcx, char op)
 {
        int     i;
        struct ibw_initattr     *attrs = NULL;
@@ -503,7 +503,7 @@ int ibwtest_getdests(struct ibwtest_ctx *tcx, char op)
        return 0;
 }
 
-int ibwtest_init_server(struct ibwtest_ctx *tcx)
+static int ibwtest_init_server(struct ibwtest_ctx *tcx)
 {
        if (tcx->naddrs!=1) {
                fprintf(stderr, "incorrect number of addrs(%d!=1)\n", tcx->naddrs);
@@ -524,7 +524,7 @@ int ibwtest_init_server(struct ibwtest_ctx *tcx)
        return 0;
 }
 
-void ibwtest_usage(struct ibwtest_ctx *tcx, char *name)
+static void ibwtest_usage(struct ibwtest_ctx *tcx, char *name)
 {
        printf("Usage:\n");
        printf("\t%s -i <id> -o {name:value} -d {addr:port} -t nsec -s\n", name);
index 0dc4adc25f5383e0256c62a9df74fb53c28c45fc..22df39ed32d68be820fd7c62ee602f25e0b751c6 100755 (executable)
@@ -298,7 +298,7 @@ def build(bld):
                                               '''ibwrapper.c ibw_ctdb.c
                                                  ibw_ctdb_init.c'''),
                             includes='include include/internal',
-                            deps='replace')
+                            deps='replace talloc tevent')
         ib_deps = ' ctdb-ib rdmacm ibverbs'
 
     if sys.platform.startswith('linux'):
@@ -685,7 +685,8 @@ def build(bld):
         bld.SAMBA_BINARY('ibwrapper_test',
                          source='ib/ibwrapper_test.c',
                          includes='include include/internal',
-                         deps='replace talloc ctdb-client ctdb-common ' +
+                         deps='''replace talloc ctdb-client ctdb-common
+                                 ctdb-common-util''' +
                               ib_deps,
                          install_path='${CTDB_TEST_LIBDIR}')