mirror of
https://github.com/samba-team/samba.git
synced 2025-03-08 04:58:40 +03:00
libctdb: "ctdb_request_free" does not need the ctdb_connection parameter
Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 5a5ed2a43b76bec69494b6cdc6451527f5c472e5)
This commit is contained in:
parent
b0706be89e
commit
21bb8abc93
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user