summaryrefslogtreecommitdiff
path: root/ctdb/ib
diff options
context:
space:
mode:
authorPeter Somogyi <psomogyi@gamax.hu>2006-12-05 13:09:48 +0100
committerPeter Somogyi <psomogyi@gamax.hu>2006-12-05 13:09:48 +0100
commit9c21a32c30da9ca1c16597ea3e78f16886f4f1fa (patch)
tree60e7ec8de406da4b0ff3687b8d75c20a18afa7ab /ctdb/ib
parent948dd4522591406487385490e8f64a62ddca76ad (diff)
parent87fb0973f4569179732a1ef654f056176dc1676f (diff)
downloadsamba-9c21a32c30da9ca1c16597ea3e78f16886f4f1fa.tar.gz
Using samba DLIST helper macro set.
(This used to be ctdb commit 1ed174dd02428748b8273a91c8d0d335795f12c3)
Diffstat (limited to 'ctdb/ib')
-rw-r--r--ctdb/ib/ibwrapper.c30
-rw-r--r--ctdb/ib/ibwrapper.h2
2 files changed, 4 insertions, 28 deletions
diff --git a/ctdb/ib/ibwrapper.c b/ctdb/ib/ibwrapper.c
index 9778b4e0419..338afb1096d 100644
--- a/ctdb/ib/ibwrapper.c
+++ b/ctdb/ib/ibwrapper.c
@@ -37,7 +37,7 @@
#include "lib/events/events.h"
#include "ibwrapper_internal.h"
-
+#include "lib/util/dlinklist.h"
#define IBW_LASTERR_BUFSIZE 512
static char ibw_lasterr[IBW_LASTERR_BUFSIZE];
@@ -93,23 +93,7 @@ static int ibw_conn_destruct(void *ptr)
ctx = ibw_conn->ctx;
assert(ctx!=NULL);
- /* unhook conn from ctx's linked list */
- assert(ctx->first_conn!=NULL);
- assert(ctx->last_conn!=NULL);
-
- if (conn->prev==NULL) {
- assert(ctx->first_conn==conn);
- ctx->first_conn = conn->next;
- } else {
- conn->prev->next = conn->next;
- }
-
- if (conn->next==NULL) {
- assert(ctx->last_conn==conn);
- ctx->last_conn = conn->prev;
- } else {
- conn->next->prev = conn->prev;
- }
+ DLIST_REMOVE(ctx->conn_list, conn);
return 0;
}
@@ -128,15 +112,7 @@ static ibw_conn *ibw_new_conn(ibw_ctx *ctx)
conn->ctx = ctx;
- /* append conn to the end of ctx's linked list */
- conn->prev = ctx->last_conn;
- conn->next = NULL;
- if (ctx->first_conn) {
- assert(ctx->last_conn!=NULL);
- conn->prev->next = conn;
- } else {
- ctx->first_conn = ctx->last_conn = conn;
- }
+ DLIST_ADD(ctx->conn_list, conn);
return conn;
}
diff --git a/ctdb/ib/ibwrapper.h b/ctdb/ib/ibwrapper.h
index c5ca0272cc9..6f646a4a08e 100644
--- a/ctdb/ib/ibwrapper.h
+++ b/ctdb/ib/ibwrapper.h
@@ -38,7 +38,7 @@ typedef struct _ibw_ctx {
ibw_state_ctx state;
void *internal;
- ibw_conn *first_conn, *last_conn;
+ ibw_conn *conn_list; /* 1st elem of double linked list */
} ibw_ctx;
typedef enum {