diff options
author | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2009-05-21 11:49:16 +1000 |
---|---|---|
committer | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2009-05-21 11:49:16 +1000 |
commit | 26e1486db7cafa86d9deceb225820631dfeb2a92 (patch) | |
tree | c58301360350c1fa609cba5c8cbb3f2662c8e889 /ctdb/ib | |
parent | 2fcedf6dac9dd275adbb0017e53547614df29d93 (diff) | |
download | samba-26e1486db7cafa86d9deceb225820631dfeb2a92.tar.gz |
Whitespace changes and using the CTDB_NO_MEMORY() macro changes to
the previous patch.
(This used to be ctdb commit d623ea7c04daa6349b42d50862843c9f86115488)
Diffstat (limited to 'ctdb/ib')
-rw-r--r-- | ctdb/ib/ibw_ctdb.c | 3 | ||||
-rw-r--r-- | ctdb/ib/ibw_ctdb_init.c | 12 | ||||
-rw-r--r-- | ctdb/ib/ibwrapper.c | 8 |
3 files changed, 12 insertions, 11 deletions
diff --git a/ctdb/ib/ibw_ctdb.c b/ctdb/ib/ibw_ctdb.c index 05541ada810..78d960a458a 100644 --- a/ctdb/ib/ibw_ctdb.c +++ b/ctdb/ib/ibw_ctdb.c @@ -166,7 +166,8 @@ int ctdb_ibw_receive_handler(struct ibw_conn *conn, void *buf, int n) * and being reused for next receive * noticed that HL requires talloc-ed memory to be stolen */ buf2 = talloc_zero_size(conn, n); - if (buf2 == NULL) return -1; + CTDB_NO_MEMORY(ctdb, buf2); + memcpy(buf2, buf, n); ctdb->upcalls->recv_pkt(ctdb, (uint8_t *)buf2, (uint32_t)n); diff --git a/ctdb/ib/ibw_ctdb_init.c b/ctdb/ib/ibw_ctdb_init.c index fa2ddda5aff..170ce302af2 100644 --- a/ctdb/ib/ibw_ctdb_init.c +++ b/ctdb/ib/ibw_ctdb_init.c @@ -164,15 +164,11 @@ static int ctdb_ibw_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t le rc = ctdb_ibw_send_pkt(cn->conn, data, length); } else { struct ctdb_ibw_msg *p = talloc_zero(cn, struct ctdb_ibw_msg); - if (p == NULL) { - DEBUG(DEBUG_ERR, ("talloc_zero failed.\n")); - return -1; - } + CTDB_NO_MEMORY(node->ctdb, p); + p->data = talloc_memdup(p, data, length); - if (p->data == NULL) { - DEBUG(DEBUG_ERR, ("talloc_memdup failed.\n")); - return -1; - } + CTDB_NO_MEMORY(node->ctdb, p->data); + p->length = length; DLIST_ADD_AFTER(cn->queue, p, cn->queue_last); diff --git a/ctdb/ib/ibwrapper.c b/ctdb/ib/ibwrapper.c index 6a557cbb4de..f6e71687f32 100644 --- a/ctdb/ib/ibwrapper.c +++ b/ctdb/ib/ibwrapper.c @@ -852,7 +852,9 @@ static int ibw_wc_recv(struct ibw_conn *conn, struct ibv_wc *wc) } if (part->to_read==0) { - if(pctx->receive_func(conn, part->buf, part->len)) goto error; + if (pctx->receive_func(conn, part->buf, part->len) != 0) { + goto error; + } part->len = 0; /* tells not having partial data (any more) */ if (ibw_wc_mem_threshold(pconn, part, pctx->opts.recv_threshold)) goto error; @@ -867,7 +869,9 @@ static int ibw_wc_recv(struct ibw_conn *conn, struct ibv_wc *wc) /* mostly awaited case: */ if (msglen<=remain) { - if(pctx->receive_func(conn, p, msglen)) goto error; + if (pctx->receive_func(conn, p, msglen) != 0) { + goto error; + } p += msglen; remain -= msglen; } else { |