mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
ctdb-client: Drop client code to send CHECK_SRVIDS control
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
parent
31c2d0af04
commit
4041cd7594
@ -2194,48 +2194,6 @@ int ctdb_ctrl_set_db_readonly(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ctdb_ctrl_check_srvids(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
|
||||
struct ctdb_client_context *client,
|
||||
int destnode, struct timeval timeout,
|
||||
uint64_t *srvid, int count, uint8_t **result)
|
||||
{
|
||||
struct ctdb_uint64_array srvid_list;
|
||||
struct ctdb_uint8_array *u8_array;
|
||||
struct ctdb_req_control request;
|
||||
struct ctdb_reply_control *reply;
|
||||
int ret;
|
||||
|
||||
srvid_list.num = count;
|
||||
srvid_list.val = srvid;
|
||||
|
||||
ctdb_req_control_check_srvids(&request, &srvid_list);
|
||||
ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
|
||||
&request, &reply);
|
||||
if (ret != 0) {
|
||||
DEBUG(DEBUG_ERR,
|
||||
("Control CHECK_SRVIDS failed to node %u, ret=%d\n",
|
||||
destnode, ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ctdb_reply_control_check_srvids(reply, &request, &u8_array);
|
||||
if (ret != 0) {
|
||||
DEBUG(DEBUG_ERR,
|
||||
("Control CHECK_SRVIDS failed, ret=%d\n", ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (u8_array->num != count) {
|
||||
DEBUG(DEBUG_ERR,
|
||||
("Control CHECK_SRVIDS returned invalid data %d != %d\n",
|
||||
u8_array->num, count));
|
||||
return ret;
|
||||
}
|
||||
|
||||
*result = talloc_steal(mem_ctx, u8_array->val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ctdb_ctrl_traverse_start_ext(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct ctdb_client_context *client,
|
||||
|
@ -397,11 +397,6 @@ int ctdb_ctrl_set_db_readonly(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
|
||||
int destnode, struct timeval timeout,
|
||||
uint32_t db_id);
|
||||
|
||||
int ctdb_ctrl_check_srvids(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
|
||||
struct ctdb_client_context *client,
|
||||
int destnode, struct timeval timeout,
|
||||
uint64_t *srvid, int count, uint8_t **result);
|
||||
|
||||
int ctdb_ctrl_traverse_start_ext(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct ctdb_client_context *client,
|
||||
|
@ -558,43 +558,6 @@ int ctdb_client_remove_message_handler(struct ctdb_context *ctdb,
|
||||
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",
|
||||
(long unsigned int)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
|
||||
*/
|
||||
|
@ -95,9 +95,6 @@ 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);
|
||||
|
||||
/* send a ctdb message */
|
||||
int ctdb_client_send_message(struct ctdb_context *ctdb, uint32_t pnn,
|
||||
|
Loading…
Reference in New Issue
Block a user