libctdb: "ctdb_request_free" does not need the ctdb_connection parameter
authorVolker Lendecke <vl@samba.org>
Fri, 19 Aug 2011 15:05:36 +0000 (17:05 +0200)
committerMichael Adam <obnox@samba.org>
Mon, 22 Aug 2011 15:11:07 +0000 (17:11 +0200)
Signed-off-by: Michael Adam <obnox@samba.org>
include/ctdb.h
libctdb/ctdb.c
libctdb/sync.c
libctdb/tst.c

index c95c2e1e26796fc7af934e2077678435e3109a86..fad3233ba657e05f206a8329a1e98088072f049f 100644 (file)
@@ -173,7 +173,7 @@ struct ctdb_request;
  * This frees a request: you should only call it once it has been
  * handed to your callback.  For incomplete requests, see ctdb_cancel().
  */
-void ctdb_request_free(struct ctdb_connection *ctdb, struct ctdb_request *req);
+void ctdb_request_free(struct ctdb_request *req);
 
 /**
  * ctdb_callback_t - callback for completed requests.
index 30211d511ecbeb716ff0acaea8b3be2cff89d4ca..2566f50dbeaa57feeb5a16e580c4d3d6209af823 100644 (file)
@@ -133,7 +133,7 @@ static void set_pnn(struct ctdb_connection *ctdb,
                      "ctdb_connect(async): failed to get pnn");
                ctdb->broken = true;
        }
-       ctdb_request_free(ctdb, req);
+       ctdb_request_free(req);
 }
 
 struct ctdb_connection *ctdb_connect(const char *addr,
@@ -199,12 +199,12 @@ void ctdb_disconnect(struct ctdb_connection *ctdb)
 
        while ((i = ctdb->outq) != NULL) {
                DLIST_REMOVE(ctdb->outq, i);
-               ctdb_request_free(ctdb, i);
+               ctdb_request_free(i);
        }
 
        while ((i = ctdb->doneq) != NULL) {
                DLIST_REMOVE(ctdb->doneq, i);
-               ctdb_request_free(ctdb, i);
+               ctdb_request_free(i);
        }
 
        if (ctdb->in)
@@ -253,8 +253,10 @@ struct ctdb_request *new_ctdb_request(struct ctdb_connection *ctdb, size_t len,
        return req;
 }
 
-void ctdb_request_free(struct ctdb_connection *ctdb, struct ctdb_request *req)
+void ctdb_request_free(struct ctdb_request *req)
 {
+       struct ctdb_connection *ctdb = req->ctdb;
+
        if (req->next || req->prev) {
                DEBUG(ctdb, LOG_ALERT,
                      "ctdb_request_free: request not complete! ctdb_cancel? %p (id %u)",
@@ -535,7 +537,7 @@ void ctdb_cancel_callback(struct ctdb_connection *ctdb,
                          struct ctdb_request *req,
                          void *unused)
 {
-       ctdb_request_free(ctdb, req);
+       ctdb_request_free(req);
 }
 
 void ctdb_cancel(struct ctdb_connection *ctdb, struct ctdb_request *req)
@@ -544,7 +546,7 @@ void ctdb_cancel(struct ctdb_connection *ctdb, struct ctdb_request *req)
                DEBUG(ctdb, LOG_ALERT,
                      "ctdb_cancel: request completed! ctdb_request_free? %p (id %u)",
                      req, req->hdr.hdr ? req->hdr.hdr->reqid : 0);
-               ctdb_request_free(ctdb, req);
+               ctdb_request_free(req);
                return;
        }
 
@@ -625,7 +627,7 @@ static void destroy_req_db(struct ctdb_connection *ctdb,
        free(req->priv_data);
        /* second request is chained off this one. */
        if (req->extra) {
-               ctdb_request_free(ctdb, req->extra);
+               ctdb_request_free(req->extra);
        }
 }
 
@@ -820,7 +822,7 @@ static void readrecordlock_retry(struct ctdb_connection *ctdb,
                              " NULL_FUNC returned %i", reply->status);
                }
                lock->callback(lock->ctdb_db, NULL, tdb_null, private);
-               ctdb_request_free(ctdb, req); /* Also frees lock. */
+               ctdb_request_free(req); /* Also frees lock. */
                return;
        }
 
@@ -829,7 +831,7 @@ static void readrecordlock_retry(struct ctdb_connection *ctdb,
                /* Now it's their responsibility to free lock & request! */
                req->extra_destructor = NULL;
                lock->callback(lock->ctdb_db, lock, data, private);
-               ctdb_request_free(ctdb, req);
+               ctdb_request_free(req);
                return;
        }
 
@@ -975,7 +977,7 @@ static void traverse_remhnd_cb(struct ctdb_connection *ctdb,
                                tdb_null, tdb_null,
                                state->cbdata);
        }
-       ctdb_request_free(ctdb, state->handle);
+       ctdb_request_free(state->handle);
        state->handle = NULL;
        free(state);
 }
@@ -1045,7 +1047,7 @@ static void traverse_start_cb(struct ctdb_connection *ctdb,
 {
        struct ctdb_traverse_state *state = private_data;
 
-        ctdb_request_free(ctdb, state->handle);
+        ctdb_request_free(state->handle);
        state->handle = NULL;
 }
 
@@ -1064,12 +1066,12 @@ static void traverse_msghnd_cb(struct ctdb_connection *ctdb,
                                TRAVERSE_STATUS_ERROR,
                                tdb_null, tdb_null,
                                state->cbdata);
-               ctdb_request_free(ctdb, state->handle);
+               ctdb_request_free(state->handle);
                state->handle = NULL;
                free(state);
                return;
         }
-        ctdb_request_free(ctdb, state->handle);
+        ctdb_request_free(state->handle);
        state->handle = NULL;
 
        t.db_id = ctdb_db->id;
index a1be3be9fadf6a50309eae7ddcde2bac7ff49dcc..0340a9e173a5fe32ec9de39fd8a062c9e2933657 100644 (file)
@@ -53,7 +53,7 @@ static struct ctdb_request *synchronous(struct ctdb_connection *ctdb,
                        if (!*done)
                                ctdb_cancel(ctdb, req);
                        else
-                               ctdb_request_free(ctdb, req);
+                               ctdb_request_free(req);
                        return NULL;
                }
        }
@@ -78,7 +78,7 @@ bool ctdb_getrecmaster(struct ctdb_connection *ctdb,
                          &done);
        if (req != NULL) {
                ret = ctdb_getrecmaster_recv(ctdb, req, recmaster);
-               ctdb_request_free(ctdb, req);
+               ctdb_request_free(req);
        }
        return ret;
 }
@@ -97,7 +97,7 @@ struct ctdb_db *ctdb_attachdb(struct ctdb_connection *ctdb,
                          &done);
        if (req != NULL) {
                ret = ctdb_attachdb_recv(ctdb, req);
-               ctdb_request_free(ctdb, req);
+               ctdb_request_free(req);
        }
        return ret;
 }
@@ -114,7 +114,7 @@ bool ctdb_getpnn(struct ctdb_connection *ctdb,
                          &done);
        if (req != NULL) {
                ret = ctdb_getpnn_recv(ctdb, req, pnn);
-               ctdb_request_free(ctdb, req);
+               ctdb_request_free(req);
        }
        return ret;
 }
@@ -133,7 +133,7 @@ bool ctdb_getnodemap(struct ctdb_connection *ctdb,
                          &done);
        if (req != NULL) {
                ret = ctdb_getnodemap_recv(ctdb, req, nodemap);
-               ctdb_request_free(ctdb, req);
+               ctdb_request_free(req);
        }
        return ret;
 }
@@ -152,7 +152,7 @@ bool ctdb_getpublicips(struct ctdb_connection *ctdb,
                          &done);
        if (req != NULL) {
                ret = ctdb_getpublicips_recv(ctdb, req, ips);
-               ctdb_request_free(ctdb, req);
+               ctdb_request_free(req);
        }
        return ret;
 }
@@ -170,7 +170,7 @@ bool ctdb_set_message_handler(struct ctdb_connection *ctdb, uint64_t srvid,
                          &done);
        if (req != NULL) {
                ret = ctdb_set_message_handler_recv(ctdb, req);
-               ctdb_request_free(ctdb, req);
+               ctdb_request_free(req);
        }
        return ret;
 }
index 0e3531d039a568b3ce20a73256441cea3326893d..1136aaab209739cc752c0cb3f832403ceb4f9dc1 100644 (file)
@@ -99,7 +99,7 @@ static void gnm_cb(struct ctdb_connection *ctdb,
        struct ctdb_node_map *nodemap;
 
        status = ctdb_getnodemap_recv(ctdb, req, &nodemap);
-       ctdb_request_free(ctdb, req);
+       ctdb_request_free(req);
        if (!status) {
                printf("Error reading NODEMAP\n");
                return;
@@ -128,7 +128,7 @@ static void ips_cb(struct ctdb_connection *ctdb,
        struct ctdb_all_public_ips *ips;
 
        status = ctdb_getpublicips_recv(ctdb, req, &ips);
-       ctdb_request_free(ctdb, req);
+       ctdb_request_free(req);
        if (!status) {
                printf("Error reading PUBLIC IPS\n");
                return;
@@ -145,7 +145,7 @@ static void pnn_cb(struct ctdb_connection *ctdb,
        uint32_t pnn;
 
        status = ctdb_getpnn_recv(ctdb, req, &pnn);
-       ctdb_request_free(ctdb, req);
+       ctdb_request_free(req);
        if (!status) {
                printf("Error reading PNN\n");
                return;
@@ -160,7 +160,7 @@ static void rm_cb(struct ctdb_connection *ctdb,
        uint32_t rm;
 
        status = ctdb_getrecmaster_recv(ctdb, req, &rm);
-       ctdb_request_free(ctdb, req);
+       ctdb_request_free(req);
        if (!status) {
                printf("Error reading RECMASTER\n");
                return;
@@ -218,7 +218,7 @@ void message_handler_cb(struct ctdb_connection *ctdb,
        if (!ctdb_set_message_handler_recv(ctdb, req)) {
                err(1, "registering message");
        }
-       ctdb_request_free(ctdb, req);
+       ctdb_request_free(req);
        printf("Message handler registered\n");
        registered = true;
 }