rename the structure we use for marshalling multiple records
authorAndrew Tridgell <tridge@samba.org>
Wed, 30 Jul 2008 04:24:56 +0000 (14:24 +1000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 30 Jul 2008 04:24:56 +0000 (14:24 +1000)
include/ctdb_private.h
server/ctdb_recover.c
server/ctdb_recoverd.c
tools/ctdb_vacuum.c

index 77d109266035830a15841d3de24285beb225d342..4d547782c2a27e490a67486a843e6d70f5a1098a 100644 (file)
@@ -1028,8 +1028,8 @@ struct ctdb_control_pulldb {
        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];
index 7b8d28c58a8f4ce7022569701e2ca90d4891bada..2b7489849ce317d98ae2889b3cb26e8934c47f62 100644 (file)
@@ -258,7 +258,7 @@ int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DAT
        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"));
@@ -273,14 +273,14 @@ int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DAT
                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) {
@@ -308,7 +308,7 @@ int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DAT
  */
 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;
@@ -318,7 +318,7 @@ int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata)
                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;
        }
@@ -887,13 +887,13 @@ int32_t ctdb_control_get_reclock_file(struct ctdb_context *ctdb, TDB_DATA *outda
 */
 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;
        }
@@ -910,9 +910,9 @@ int32_t ctdb_control_try_delete_records(struct ctdb_context *ctdb, TDB_DATA inda
 
 
        /* 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;
index 64a05a777e7bb2414040ee401eba4384b7c496be..2bc24dd74963b9dd0d7fdbd7581752415927f9b4 100644 (file)
@@ -546,9 +546,9 @@ static int pull_one_remote_database(struct ctdb_context *ctdb, uint32_t srcnode,
                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;
@@ -764,7 +764,7 @@ struct vacuum_info {
        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;
 };
 
@@ -866,7 +866,7 @@ static void vacuum_fetch_handler(struct ctdb_context *ctdb, uint64_t srvid,
                                 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;
@@ -877,7 +877,7 @@ static void vacuum_fetch_handler(struct ctdb_context *ctdb, uint64_t srvid,
        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) {
@@ -1136,7 +1136,7 @@ static struct tdb_wrap *create_recdb(struct ctdb_context *ctdb, TALLOC_CTX *mem_
  */
 struct recdb_data {
        struct ctdb_context *ctdb;
-       struct ctdb_control_pulldb_reply *recdata;
+       struct ctdb_marshall_buffer *recdata;
        uint32_t len;
        bool failed;
 };
@@ -1184,7 +1184,7 @@ static int push_recdb_database(struct ctdb_context *ctdb, uint32_t dbid,
                               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;
@@ -1192,14 +1192,14 @@ static int push_recdb_database(struct ctdb_context *ctdb, uint32_t dbid,
        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, &params) == -1) {
index 60a0b0a3ee7b410e054e63b79de9aebe70f58755..f517c6ea7199d7eb2a980066cd68ddd87680bceb 100644 (file)
@@ -39,7 +39,7 @@ struct vacuum_data {
        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;
 };
@@ -153,7 +153,7 @@ static int vacuum_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
 }
 
 struct delete_records_list {
-       struct ctdb_control_pulldb_reply *records;
+       struct ctdb_marshall_buffer *records;
 };
 
 /*
@@ -269,16 +269,16 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
        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);
@@ -332,9 +332,9 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
                        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;
@@ -353,7 +353,7 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
                   (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) {
@@ -375,7 +375,7 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
                        /* 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;