1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

ctdbd_conn: Add callback args to register_with_ctdbd

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Volker Lendecke 2015-05-19 07:05:24 +02:00
parent 4d0572a2a4
commit 467fee4d5a
4 changed files with 25 additions and 11 deletions

View File

@ -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 */

View File

@ -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;
}

View File

@ -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);
}
/*

View File

@ -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;