diff options
author | Amitay Isaacs <amitay@gmail.com> | 2013-08-23 16:51:26 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2013-10-04 15:15:34 +1000 |
commit | 105afa543e7a428eaeb7317215701dfb917d0aae (patch) | |
tree | f0c710024a4a50b715df68828f01ac3803cdb0f4 /ctdb/client | |
parent | 151bb4b97d558d7f01dd61d2a08faca59922ad46 (diff) | |
download | samba-105afa543e7a428eaeb7317215701dfb917d0aae.tar.gz |
client: Add ctdb_client_check_message_handlers() function
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
(This used to be ctdb commit c9a9d14c91f203ce964a426a8a1e2c1715af2098)
Diffstat (limited to 'ctdb/client')
-rw-r--r-- | ctdb/client/ctdb_client.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c index 57dc9ba0025..42645133bff 100644 --- a/ctdb/client/ctdb_client.c +++ b/ctdb/client/ctdb_client.c @@ -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 |