summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/ctdbd_conn.h8
-rw-r--r--source3/lib/ctdb_dummy.c5
-rw-r--r--source3/lib/ctdbd_conn.c20
-rw-r--r--source3/lib/serverid.c3
4 files changed, 25 insertions, 11 deletions
diff --git a/source3/include/ctdbd_conn.h b/source3/include/ctdbd_conn.h
index 36932bdaf54..397c09331f5 100644
--- a/source3/include/ctdbd_conn.h
+++ b/source3/include/ctdbd_conn.h
@@ -90,7 +90,13 @@ NTSTATUS ctdbd_control_local(struct ctdbd_connection *conn, uint32_t opcode,
int *cstatus);
NTSTATUS ctdb_watch_us(struct ctdbd_connection *conn);
NTSTATUS ctdb_unwatch(struct ctdbd_connection *conn);
-NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid);
+
+struct ctdb_req_message;
+
+NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid,
+ void (*cb)(struct ctdb_req_message *msg,
+ void *private_data),
+ void *private_data);
NTSTATUS ctdbd_probe(void);
#endif /* _CTDBD_CONN_H */
diff --git a/source3/lib/ctdb_dummy.c b/source3/lib/ctdb_dummy.c
index e19765b125a..ca1309b0311 100644
--- a/source3/lib/ctdb_dummy.c
+++ b/source3/lib/ctdb_dummy.c
@@ -44,7 +44,10 @@ NTSTATUS ctdbd_messaging_send_blob(struct ctdbd_connection *conn,
return NT_STATUS_NOT_IMPLEMENTED;
}
-NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid)
+NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid,
+ void (*cb)(struct ctdb_req_message *msg,
+ void *private_data),
+ void *private_data)
{
return NT_STATUS_NOT_IMPLEMENTED;
}
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index cdec97863c6..9794d3ede19 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -96,7 +96,10 @@ static void ctdb_packet_dump(struct ctdb_req_header *hdr)
/*
* Register a srvid with ctdbd
*/
-NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid)
+NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid,
+ void (*cb)(struct ctdb_req_message *msg,
+ void *private_data),
+ void *private_data)
{
NTSTATUS status;
@@ -121,7 +124,7 @@ NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid)
conn->callbacks = tmp;
conn->callbacks[num_callbacks] = (struct ctdbd_srvid_cb) {
- .srvid = srvid
+ .srvid = srvid, .cb = cb, .private_data = private_data
};
return NT_STATUS_OK;
@@ -573,7 +576,7 @@ static NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx,
generate_random_buffer((unsigned char *)&conn->rand_srvid,
sizeof(conn->rand_srvid));
- status = register_with_ctdbd(conn, conn->rand_srvid);
+ status = register_with_ctdbd(conn, conn->rand_srvid, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(5, ("Could not register random srvid: %s\n",
@@ -605,17 +608,18 @@ NTSTATUS ctdbd_messaging_connection(TALLOC_CTX *mem_ctx,
return status;
}
- status = register_with_ctdbd(conn, (uint64_t)getpid());
+ status = register_with_ctdbd(conn, (uint64_t)getpid(), NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
goto fail;
}
- status = register_with_ctdbd(conn, MSG_SRVID_SAMBA);
+ status = register_with_ctdbd(conn, MSG_SRVID_SAMBA, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
goto fail;
}
- status = register_with_ctdbd(conn, CTDB_SRVID_SAMBA_NOTIFY);
+ status = register_with_ctdbd(conn, CTDB_SRVID_SAMBA_NOTIFY,
+ NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
goto fail;
}
@@ -1685,7 +1689,7 @@ NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
* We want to be told about IP releases
*/
- status = register_with_ctdbd(conn, CTDB_SRVID_RELEASE_IP);
+ status = register_with_ctdbd(conn, CTDB_SRVID_RELEASE_IP, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -1705,7 +1709,7 @@ NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
*/
NTSTATUS ctdbd_register_reconfigure(struct ctdbd_connection *conn)
{
- return register_with_ctdbd(conn, CTDB_SRVID_RECONFIGURE);
+ return register_with_ctdbd(conn, CTDB_SRVID_RECONFIGURE, NULL, NULL);
}
/*
diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c
index f5e0937224e..39c733c113f 100644
--- a/source3/lib/serverid.c
+++ b/source3/lib/serverid.c
@@ -123,7 +123,8 @@ bool serverid_register(const struct server_id id, uint32_t msg_flags)
if (lp_clustering() &&
ctdb_serverids_exist_supported(messaging_ctdbd_connection()))
{
- register_with_ctdbd(messaging_ctdbd_connection(), id.unique_id);
+ register_with_ctdbd(messaging_ctdbd_connection(), id.unique_id,
+ NULL, NULL);
}
ret = true;