summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2011-11-30 10:00:27 +1100
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2011-11-30 10:00:27 +1100
commit7d31c64c1cb5d64bf1c92f770501a280d7f8dc21 (patch)
tree2f13e870f119e6c0d7ecbd52f80fab04d2bfb161
parent11f3c947e6189994bd43a9fcd1301a1dc6251c78 (diff)
downloadsamba-7d31c64c1cb5d64bf1c92f770501a280d7f8dc21.tar.gz
samba-7d31c64c1cb5d64bf1c92f770501a280d7f8dc21.tar.xz
samba-7d31c64c1cb5d64bf1c92f770501a280d7f8dc21.zip
ctdb: use libctdb version of check-srvids call
(This used to be ctdb commit 36105b7283df729946e0a2ed61a696a14221efa6)
-rw-r--r--ctdb/tools/ctdb.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index b902789ef3..5fd6307672 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -2070,40 +2070,37 @@ static int getsrvids(struct ctdb_context *ctdb, int argc, const char **argv)
*/
static int check_srvids(struct ctdb_context *ctdb, int argc, const char **argv)
{
- int32_t status;
- char *errmsg;
- int ret;
+ TALLOC_CTX *tmp_ctx = talloc_new(NULL);
uint64_t *ids;
+ uint8_t *result;
int i;
- TDB_DATA data, outdata;
if (argc < 1) {
+ talloc_free(tmp_ctx);
usage();
}
- ids = talloc_array(ctdb, uint64_t, argc);
+ ids = talloc_array(tmp_ctx, uint64_t, argc);
+ result = talloc_array(tmp_ctx, uint8_t, argc);
for (i = 0; i < argc; i++) {
ids[i] = strtoull(argv[i], NULL, 0);
}
- data.dptr = (uint8_t *)ids;
- data.dsize = talloc_get_size(ids);
- ret = ctdb_control(ctdb, options.pnn, 0, CTDB_CONTROL_CHECK_SRVIDS,
- 0, data, ctdb, &outdata, &status, NULL, &errmsg);
- if (ret != 0) {
+ if (!ctdb_check_message_handlers(ctdb_connection,
+ options.pnn, argc, ids, result)) {
DEBUG(DEBUG_ERR, ("Unable to check server_id from node %u\n",
options.pnn));
- return ret;
+ talloc_free(tmp_ctx);
+ return -1;
}
- for (i=0; i < argc; i++) {
- bool exists;
-
- exists = ((outdata.dptr[i/8] & (1<<(i%8))) != 0);
+ for (i=0; i < argc; i++) {
printf("Server id %d:%llu %s\n", options.pnn, (long long)ids[i],
- exists ? "exists" : "does not exist");
+ result[i] ? "exists" : "does not exist");
}
+
+ talloc_free(tmp_ctx);
return 0;
}