From 467fee4d5afd7db7ee4005a040896d72ab499573 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 19 May 2015 07:05:24 +0200 Subject: [PATCH] ctdbd_conn: Add callback args to register_with_ctdbd Signed-off-by: Volker Lendecke Reviewed-by: Stefan Metzmacher --- source3/include/ctdbd_conn.h | 8 +++++++- source3/lib/ctdb_dummy.c | 5 ++++- source3/lib/ctdbd_conn.c | 20 ++++++++++++-------- source3/lib/serverid.c | 3 ++- 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; -- 2.11.4.GIT