libctdb: "unpack_reply_control" 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>
libctdb/control.c
libctdb/ctdb.c
libctdb/libctdb_private.h
libctdb/messages.c

index 07185dbb41bad23a8e29b03a9508c91aa8441d37..e18a44ee2274703ce1fafbd37d5af16c4b70502f 100644 (file)
@@ -32,7 +32,7 @@ bool ctdb_getrecmaster_recv(struct ctdb_connection *ctdb,
 {
        struct ctdb_reply_control *reply;
 
-       reply = unpack_reply_control(ctdb, req, CTDB_CONTROL_GET_RECMASTER);
+       reply = unpack_reply_control(req, CTDB_CONTROL_GET_RECMASTER);
        if (!reply) {
                return false;
        }
@@ -59,7 +59,7 @@ bool ctdb_getpnn_recv(struct ctdb_connection *ctdb,
 {
        struct ctdb_reply_control *reply;
 
-       reply = unpack_reply_control(ctdb, req, CTDB_CONTROL_GET_PNN);
+       reply = unpack_reply_control(req, CTDB_CONTROL_GET_PNN);
        if (!reply) {
                return false;
        }
@@ -86,7 +86,7 @@ bool ctdb_getnodemap_recv(struct ctdb_connection *ctdb,
        struct ctdb_reply_control *reply;
 
        *nodemap = NULL;
-       reply = unpack_reply_control(ctdb, req, CTDB_CONTROL_GET_NODEMAP);
+       reply = unpack_reply_control(req, CTDB_CONTROL_GET_NODEMAP);
        if (!reply) {
                return false;
        }
@@ -133,7 +133,7 @@ bool ctdb_getpublicips_recv(struct ctdb_connection *ctdb,
        struct ctdb_reply_control *reply;
 
        *ips = NULL;
-       reply = unpack_reply_control(ctdb, req, CTDB_CONTROL_GET_PUBLIC_IPS);
+       reply = unpack_reply_control(req, CTDB_CONTROL_GET_PUBLIC_IPS);
        if (!reply) {
                return false;
        }
index 573e22961c933a4ece71e8e6f077ee440c517822..e407910a30761f7c18a785c87ffa6a834082f4de 100644 (file)
@@ -311,8 +311,7 @@ static struct ctdb_reply_call *unpack_reply_call(struct ctdb_request *req,
 }
 
 /* Sanity-checking wrapper for reply. */
-struct ctdb_reply_control *unpack_reply_control(struct ctdb_connection *ctdb,
-                                               struct ctdb_request *req,
+struct ctdb_reply_control *unpack_reply_control(struct ctdb_request *req,
                                                enum ctdb_controls control)
 {
        size_t len;
@@ -321,13 +320,13 @@ struct ctdb_reply_control *unpack_reply_control(struct ctdb_connection *ctdb,
        /* Library user error if this isn't a reply to a call. */
        if (len < sizeof(*inhdr)) {
                errno = EINVAL;
-               DEBUG(ctdb, LOG_ALERT,
+               DEBUG(req->ctdb, LOG_ALERT,
                      "Short ctdbd control reply: %zu bytes", len);
                return NULL;
        }
        if (req->hdr.hdr->operation != CTDB_REQ_CONTROL) {
                errno = EINVAL;
-               DEBUG(ctdb, LOG_ALERT,
+               DEBUG(req->ctdb, LOG_ALERT,
                      "This was not a ctdbd control request: operation %u",
                      req->hdr.hdr->operation);
                return NULL;
@@ -336,7 +335,7 @@ struct ctdb_reply_control *unpack_reply_control(struct ctdb_connection *ctdb,
        /* ... or if it was a different control from what we expected. */
        if (req->hdr.control->opcode != control) {
                errno = EINVAL;
-               DEBUG(ctdb, LOG_ALERT,
+               DEBUG(req->ctdb, LOG_ALERT,
                      "This was not an opcode %u ctdbd control request: %u",
                      control, req->hdr.control->opcode);
                return NULL;
@@ -345,7 +344,7 @@ struct ctdb_reply_control *unpack_reply_control(struct ctdb_connection *ctdb,
        /* ctdbd or our error if this isn't a reply call. */
        if (inhdr->hdr.operation != CTDB_REPLY_CONTROL) {
                errno = EIO;
-               DEBUG(ctdb, LOG_CRIT,
+               DEBUG(req->ctdb, LOG_CRIT,
                      "Invalid ctdbd control reply: operation %u",
                      inhdr->hdr.operation);
                return NULL;
@@ -643,7 +642,7 @@ static void attachdb_done(struct ctdb_connection *ctdb,
                control = CTDB_CONTROL_DB_ATTACH_PERSISTENT;
        }
 
-       reply = unpack_reply_control(ctdb, req, control);
+       reply = unpack_reply_control(req, control);
        if (!reply || reply->status != 0) {
                if (reply) {
                        DEBUG(ctdb, LOG_ERR,
@@ -700,7 +699,7 @@ struct ctdb_db *ctdb_attachdb_recv(struct ctdb_connection *ctdb,
                return NULL;
        }
 
-       reply = unpack_reply_control(ctdb, dbpath_req, CTDB_CONTROL_GETDBPATH);
+       reply = unpack_reply_control(dbpath_req, CTDB_CONTROL_GETDBPATH);
        if (!reply) {
                return NULL;
        }
index d572aeabde16c2da8cb71cf7f58b22fd62fe6360..547e95bd22ff70dc8040ad31684db8ae5004c79b 100644 (file)
@@ -90,8 +90,7 @@ struct ctdb_request *new_ctdb_control_request(struct ctdb_connection *ctdb,
                                              ctdb_callback_t, void *);
 uint32_t new_reqid(struct ctdb_connection *ctdb);
 
-struct ctdb_reply_control *unpack_reply_control(struct ctdb_connection *ctdb,
-                                               struct ctdb_request *req,
+struct ctdb_reply_control *unpack_reply_control(struct ctdb_request *req,
                                                enum ctdb_controls control);
 void ctdb_cancel_callback(struct ctdb_connection *ctdb,
                          struct ctdb_request *req,
index b69428baf0e7ac6c727d09bfaf5250ac0c3f8c45..66b41b52553305674bb21f8bb45ca870482211ad 100644 (file)
@@ -127,7 +127,7 @@ bool ctdb_set_message_handler_recv(struct ctdb_connection *ctdb,
        struct message_handler_info *info = req->extra;
        struct ctdb_reply_control *reply;
 
-       reply = unpack_reply_control(ctdb, req, CTDB_CONTROL_REGISTER_SRVID);
+       reply = unpack_reply_control(req, CTDB_CONTROL_REGISTER_SRVID);
        if (!reply) {
                return false;
        }
@@ -189,7 +189,7 @@ bool ctdb_remove_message_handler_recv(struct ctdb_connection *ctdb,
        struct message_handler_info *handler = req->extra;
        struct ctdb_reply_control *reply;
 
-       reply = unpack_reply_control(ctdb, req, CTDB_CONTROL_DEREGISTER_SRVID);
+       reply = unpack_reply_control(req, CTDB_CONTROL_DEREGISTER_SRVID);
        if (!reply) {
                return false;
        }