summaryrefslogtreecommitdiff
path: root/ctdb/ib
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2015-10-13 16:19:21 +1100
committerMartin Schwenke <martins@samba.org>2015-10-27 04:15:15 +0100
commit47cddb699a28560556ed7db8eb829628407f2e22 (patch)
treef3fa6edeff92bf663e5c3b41cb48453f65d32eef /ctdb/ib
parent42b1d30fbb3fc6bbc06c3a9a1802cab6f2cc769c (diff)
downloadsamba-47cddb699a28560556ed7db8eb829628407f2e22.tar.gz
ctdb-ib: Fix build for infiniband transport
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'ctdb/ib')
-rw-r--r--ctdb/ib/ibw_ctdb.c11
-rw-r--r--ctdb/ib/ibw_ctdb_init.c10
-rw-r--r--ctdb/ib/ibwrapper_test.c30
3 files changed, 18 insertions, 33 deletions
diff --git a/ctdb/ib/ibw_ctdb.c b/ctdb/ib/ibw_ctdb.c
index 2e70d1d8e5b..438bf69fec0 100644
--- a/ctdb/ib/ibw_ctdb.c
+++ b/ctdb/ib/ibw_ctdb.c
@@ -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 */
diff --git a/ctdb/ib/ibw_ctdb_init.c b/ctdb/ib/ibw_ctdb_init.c
index 63deff28430..b71909ad0f8 100644
--- a/ctdb/ib/ibw_ctdb_init.c
+++ b/ctdb/ib/ibw_ctdb_init.c
@@ -31,16 +31,10 @@
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);
}
}
diff --git a/ctdb/ib/ibwrapper_test.c b/ctdb/ib/ibwrapper_test.c
index 397fdf1af71..a006966d58d 100644
--- a/ctdb/ib/ibwrapper_test.c
+++ b/ctdb/ib/ibwrapper_test.c
@@ -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);