mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
client: Add ctdb_client_check_message_handlers() function
Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit c9a9d14c91f203ce964a426a8a1e2c1715af2098)
This commit is contained in:
parent
151bb4b97d
commit
105afa543e
@ -511,6 +511,41 @@ int ctdb_client_remove_message_handler(struct ctdb_context *ctdb, uint64_t srvid
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* check server ids
|
||||
*/
|
||||
int ctdb_client_check_message_handlers(struct ctdb_context *ctdb, uint64_t *ids, uint32_t num,
|
||||
uint8_t *result)
|
||||
{
|
||||
TDB_DATA indata, outdata;
|
||||
int res;
|
||||
int32_t status;
|
||||
int i;
|
||||
|
||||
indata.dptr = (uint8_t *)ids;
|
||||
indata.dsize = num * sizeof(*ids);
|
||||
|
||||
res = ctdb_control(ctdb, CTDB_CURRENT_NODE, 0, CTDB_CONTROL_CHECK_SRVIDS, 0,
|
||||
indata, ctdb, &outdata, &status, NULL, NULL);
|
||||
if (res != 0 || status != 0) {
|
||||
DEBUG(DEBUG_ERR, (__location__ " failed to check srvids\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (outdata.dsize != num*sizeof(uint8_t)) {
|
||||
DEBUG(DEBUG_ERR, (__location__ " expected %lu bytes, received %zi bytes\n",
|
||||
num*sizeof(uint8_t), outdata.dsize));
|
||||
talloc_free(outdata.dptr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i=0; i<num; i++) {
|
||||
result[i] = outdata.dptr[i];
|
||||
}
|
||||
|
||||
talloc_free(outdata.dptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
send a message - from client context
|
||||
|
@ -159,7 +159,9 @@ int ctdb_client_set_message_handler(struct ctdb_context *ctdb, uint64_t srvid,
|
||||
void *private_data);
|
||||
int ctdb_client_remove_message_handler(struct ctdb_context *ctdb,
|
||||
uint64_t srvid, void *private_data);
|
||||
|
||||
int ctdb_client_check_message_handlers(struct ctdb_context *ctdb,
|
||||
uint64_t *ids, uint32_t num,
|
||||
uint8_t *result);
|
||||
|
||||
int ctdb_call(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
|
||||
struct ctdb_client_call_state *ctdb_call_send(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
|
||||
|
Loading…
Reference in New Issue
Block a user