uint32_t lmaster;
};
-/* structure used for pulldb control */
-struct ctdb_control_pulldb_reply {
+/* structure used for sending lists of records */
+struct ctdb_marshall_buffer {
uint32_t db_id;
uint32_t count;
uint8_t data[1];
struct ctdb_control_pulldb *pull;
struct ctdb_db_context *ctdb_db;
struct pulldb_data params;
- struct ctdb_control_pulldb_reply *reply;
+ struct ctdb_marshall_buffer *reply;
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
DEBUG(DEBUG_DEBUG,("rejecting ctdb_control_pull_db when not frozen\n"));
return -1;
}
- reply = talloc_zero(outdata, struct ctdb_control_pulldb_reply);
+ reply = talloc_zero(outdata, struct ctdb_marshall_buffer);
CTDB_NO_MEMORY(ctdb, reply);
reply->db_id = pull->db_id;
params.ctdb = ctdb;
params.pulldata = reply;
- params.len = offsetof(struct ctdb_control_pulldb_reply, data);
+ params.len = offsetof(struct ctdb_marshall_buffer, data);
params.failed = false;
if (ctdb_lock_all_databases_mark(ctdb) != 0) {
*/
int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata)
{
- struct ctdb_control_pulldb_reply *reply = (struct ctdb_control_pulldb_reply *)indata.dptr;
+ struct ctdb_marshall_buffer *reply = (struct ctdb_marshall_buffer *)indata.dptr;
struct ctdb_db_context *ctdb_db;
int i, ret;
struct ctdb_rec_data *rec;
return -1;
}
- if (indata.dsize < offsetof(struct ctdb_control_pulldb_reply, data)) {
+ if (indata.dsize < offsetof(struct ctdb_marshall_buffer, data)) {
DEBUG(DEBUG_ERR,(__location__ " invalid data in pulldb reply\n"));
return -1;
}
*/
int32_t ctdb_control_try_delete_records(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DATA *outdata)
{
- struct ctdb_control_pulldb_reply *reply = (struct ctdb_control_pulldb_reply *)indata.dptr;
+ struct ctdb_marshall_buffer *reply = (struct ctdb_marshall_buffer *)indata.dptr;
struct ctdb_db_context *ctdb_db;
int i;
struct ctdb_rec_data *rec;
- struct ctdb_control_pulldb_reply *records;
+ struct ctdb_marshall_buffer *records;
- if (indata.dsize < offsetof(struct ctdb_control_pulldb_reply, data)) {
+ if (indata.dsize < offsetof(struct ctdb_marshall_buffer, data)) {
DEBUG(DEBUG_ERR,(__location__ " invalid data in try_delete_records\n"));
return -1;
}
/* create a blob to send back the records we couldnt delete */
- records = (struct ctdb_control_pulldb_reply *)
+ records = (struct ctdb_marshall_buffer *)
talloc_zero_size(outdata,
- offsetof(struct ctdb_control_pulldb_reply, data));
+ offsetof(struct ctdb_marshall_buffer, data));
if (records == NULL) {
DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
return -1;
return -1;
}
- reply = (struct ctdb_control_pulldb_reply *)outdata.dptr;
+ reply = (struct ctdb_marshall_buffer *)outdata.dptr;
- if (outdata.dsize < offsetof(struct ctdb_control_pulldb_reply, data)) {
+ if (outdata.dsize < offsetof(struct ctdb_marshall_buffer, data)) {
DEBUG(DEBUG_ERR,(__location__ " invalid data in pulldb reply\n"));
talloc_free(tmp_ctx);
return -1;
struct ctdb_recoverd *rec;
uint32_t srcnode;
struct ctdb_db_context *ctdb_db;
- struct ctdb_control_pulldb_reply *recs;
+ struct ctdb_marshall_buffer *recs;
struct ctdb_rec_data *r;
};
TDB_DATA data, void *private_data)
{
struct ctdb_recoverd *rec = talloc_get_type(private_data, struct ctdb_recoverd);
- struct ctdb_control_pulldb_reply *recs;
+ struct ctdb_marshall_buffer *recs;
int ret, i;
TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
const char *name;
uint32_t srcnode;
struct vacuum_info *v;
- recs = (struct ctdb_control_pulldb_reply *)data.dptr;
+ recs = (struct ctdb_marshall_buffer *)data.dptr;
r = (struct ctdb_rec_data *)&recs->data[0];
if (recs->count == 0) {
*/
struct recdb_data {
struct ctdb_context *ctdb;
- struct ctdb_control_pulldb_reply *recdata;
+ struct ctdb_marshall_buffer *recdata;
uint32_t len;
bool failed;
};
struct tdb_wrap *recdb, struct ctdb_node_map *nodemap)
{
struct recdb_data params;
- struct ctdb_control_pulldb_reply *recdata;
+ struct ctdb_marshall_buffer *recdata;
TDB_DATA outdata;
TALLOC_CTX *tmp_ctx;
uint32_t *nodes;
tmp_ctx = talloc_new(ctdb);
CTDB_NO_MEMORY(ctdb, tmp_ctx);
- recdata = talloc_zero(recdb, struct ctdb_control_pulldb_reply);
+ recdata = talloc_zero(recdb, struct ctdb_marshall_buffer);
CTDB_NO_MEMORY(ctdb, recdata);
recdata->db_id = dbid;
params.ctdb = ctdb;
params.recdata = recdata;
- params.len = offsetof(struct ctdb_control_pulldb_reply, data);
+ params.len = offsetof(struct ctdb_marshall_buffer, data);
params.failed = false;
if (tdb_traverse_read(recdb->tdb, traverse_recdb, ¶ms) == -1) {
struct ctdb_db_context *ctdb_db;
trbt_tree_t *delete_tree;
uint32_t delete_count;
- struct ctdb_control_pulldb_reply **list;
+ struct ctdb_marshall_buffer **list;
bool traverse_error;
uint32_t total;
};
}
struct delete_records_list {
- struct ctdb_control_pulldb_reply *records;
+ struct ctdb_marshall_buffer *records;
};
/*
vdata->ctdb_db = ctdb_db;
/* the list needs to be of length num_nodes */
- vdata->list = talloc_array(vdata, struct ctdb_control_pulldb_reply *, ctdb->vnn_map->size);
+ vdata->list = talloc_array(vdata, struct ctdb_marshall_buffer *, ctdb->vnn_map->size);
if (vdata->list == NULL) {
DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
talloc_free(vdata);
return -1;
}
for (i=0;i<ctdb->vnn_map->size;i++) {
- vdata->list[i] = (struct ctdb_control_pulldb_reply *)
+ vdata->list[i] = (struct ctdb_marshall_buffer *)
talloc_zero_size(vdata->list,
- offsetof(struct ctdb_control_pulldb_reply, data));
+ offsetof(struct ctdb_marshall_buffer, data));
if (vdata->list[i] == NULL) {
DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
talloc_free(vdata);
DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
return -1;
}
- recs->records = (struct ctdb_control_pulldb_reply *)
+ recs->records = (struct ctdb_marshall_buffer *)
talloc_zero_size(vdata,
- offsetof(struct ctdb_control_pulldb_reply, data));
+ offsetof(struct ctdb_marshall_buffer, data));
if (recs->records == NULL) {
DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
return -1;
(if possible)
*/
for (i=0;i<ctdb->vnn_map->size;i++) {
- struct ctdb_control_pulldb_reply *records;
+ struct ctdb_marshall_buffer *records;
struct ctdb_rec_data *rec;
if (ctdb->vnn_map->map[i] == ctdb->pnn) {
/* outdata countains the list of records coming back
from the node which the node could not delete
*/
- records = (struct ctdb_control_pulldb_reply *)outdata.dptr;
+ records = (struct ctdb_marshall_buffer *)outdata.dptr;
rec = (struct ctdb_rec_data *)&records->data[0];
while (records->count-- > 1) {
TDB_DATA reckey, recdata;