1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

ctdb-daemon: Rename struct ctdb_rec_data to ctdb_rec_data_old

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
Amitay Isaacs 2015-10-29 17:30:30 +11:00 committed by Martin Schwenke
parent 9bf7d0dc44
commit b99436e425
12 changed files with 80 additions and 75 deletions

View File

@ -2227,7 +2227,7 @@ struct traverse_state {
static void traverse_handler(uint64_t srvid, TDB_DATA data, void *p)
{
struct traverse_state *state = (struct traverse_state *)p;
struct ctdb_rec_data *d = (struct ctdb_rec_data *)data.dptr;
struct ctdb_rec_data_old *d = (struct ctdb_rec_data_old *)data.dptr;
TDB_DATA key;
if (data.dsize < sizeof(uint32_t) || d->length != data.dsize) {
@ -4842,7 +4842,7 @@ ctdb_ctrl_updaterecord_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, stru
{
struct ctdb_client_control_state *handle;
struct ctdb_marshall_buffer *m;
struct ctdb_rec_data *rec;
struct ctdb_rec_data_old *rec;
TDB_DATA outdata;
m = talloc_zero(mem_ctx, struct ctdb_marshall_buffer);

View File

@ -107,7 +107,8 @@ bool ctdb_same_address(ctdb_sock_addr *a1, ctdb_sock_addr *a2);
uint32_t ctdb_hash(const TDB_DATA *key);
struct ctdb_rec_data *ctdb_marshall_record(TALLOC_CTX *mem_ctx, uint32_t reqid,
struct ctdb_rec_data_old *ctdb_marshall_record(TALLOC_CTX *mem_ctx,
uint32_t reqid,
TDB_DATA key,
struct ctdb_ltdb_header *header,
TDB_DATA data);
@ -122,8 +123,9 @@ struct ctdb_marshall_buffer *ctdb_marshall_add(TALLOC_CTX *mem_ctx,
TDB_DATA ctdb_marshall_finish(struct ctdb_marshall_buffer *m);
struct ctdb_rec_data *ctdb_marshall_loop_next(struct ctdb_marshall_buffer *m,
struct ctdb_rec_data *r,
struct ctdb_rec_data_old *ctdb_marshall_loop_next(
struct ctdb_marshall_buffer *m,
struct ctdb_rec_data_old *r,
uint32_t *reqid,
struct ctdb_ltdb_header *header,
TDB_DATA *key, TDB_DATA *data);

View File

@ -214,11 +214,11 @@ static uint32_t ctdb_marshall_record_size(TDB_DATA key,
struct ctdb_ltdb_header *header,
TDB_DATA data)
{
return offsetof(struct ctdb_rec_data, data) + key.dsize +
return offsetof(struct ctdb_rec_data_old, data) + key.dsize +
data.dsize + (header ? sizeof(*header) : 0);
}
static void ctdb_marshall_record_copy(struct ctdb_rec_data *rec,
static void ctdb_marshall_record_copy(struct ctdb_rec_data_old *rec,
uint32_t reqid,
TDB_DATA key,
struct ctdb_ltdb_header *header,
@ -249,17 +249,18 @@ static void ctdb_marshall_record_copy(struct ctdb_rec_data *rec,
note that header may be NULL. If not NULL then it is included in the data portion
of the record
*/
struct ctdb_rec_data *ctdb_marshall_record(TALLOC_CTX *mem_ctx, uint32_t reqid,
struct ctdb_rec_data_old *ctdb_marshall_record(TALLOC_CTX *mem_ctx,
uint32_t reqid,
TDB_DATA key,
struct ctdb_ltdb_header *header,
TDB_DATA data)
{
size_t length;
struct ctdb_rec_data *d;
struct ctdb_rec_data_old *d;
length = ctdb_marshall_record_size(key, header, data);
d = (struct ctdb_rec_data *)talloc_size(mem_ctx, length);
d = (struct ctdb_rec_data_old *)talloc_size(mem_ctx, length);
if (d == NULL) {
return NULL;
}
@ -278,7 +279,7 @@ struct ctdb_marshall_buffer *ctdb_marshall_add(TALLOC_CTX *mem_ctx,
struct ctdb_ltdb_header *header,
TDB_DATA data)
{
struct ctdb_rec_data *r;
struct ctdb_rec_data_old *r;
struct ctdb_marshall_buffer *m2;
uint32_t length, offset;
@ -300,7 +301,7 @@ struct ctdb_marshall_buffer *ctdb_marshall_add(TALLOC_CTX *mem_ctx,
m2->db_id = db_id;
}
r = (struct ctdb_rec_data *)((uint8_t *)m2 + offset);
r = (struct ctdb_rec_data_old *)((uint8_t *)m2 + offset);
ctdb_marshall_record_copy(r, reqid, key, header, data, length);
m2->count++;
@ -322,15 +323,17 @@ TDB_DATA ctdb_marshall_finish(struct ctdb_marshall_buffer *m)
- pass r==NULL to start
- loop the number of times indicated by m->count
*/
struct ctdb_rec_data *ctdb_marshall_loop_next(struct ctdb_marshall_buffer *m, struct ctdb_rec_data *r,
struct ctdb_rec_data_old *ctdb_marshall_loop_next(
struct ctdb_marshall_buffer *m,
struct ctdb_rec_data_old *r,
uint32_t *reqid,
struct ctdb_ltdb_header *header,
TDB_DATA *key, TDB_DATA *data)
{
if (r == NULL) {
r = (struct ctdb_rec_data *)&m->data[0];
r = (struct ctdb_rec_data_old *)&m->data[0];
} else {
r = (struct ctdb_rec_data *)(r->length + (uint8_t *)r);
r = (struct ctdb_rec_data_old *)(r->length + (uint8_t *)r);
}
if (reqid != NULL) {

View File

@ -612,7 +612,7 @@ struct ctdb_latency_counter {
/*
structure used to pass record data between the child and parent
*/
struct ctdb_rec_data {
struct ctdb_rec_data_old {
uint32_t length;
uint32_t reqid;
uint32_t keylen;

View File

@ -211,7 +211,7 @@ struct pulldb_data {
static int traverse_pulldb(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *p)
{
struct pulldb_data *params = (struct pulldb_data *)p;
struct ctdb_rec_data *rec;
struct ctdb_rec_data_old *rec;
struct ctdb_context *ctdb = params->ctdb;
struct ctdb_db_context *ctdb_db = params->ctdb_db;
@ -320,7 +320,7 @@ int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata)
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;
struct ctdb_rec_data_old *rec;
if (indata.dsize < offsetof(struct ctdb_marshall_buffer, data)) {
DEBUG(DEBUG_ERR,(__location__ " invalid data in pulldb reply\n"));
@ -344,7 +344,7 @@ int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata)
return -1;
}
rec = (struct ctdb_rec_data *)&reply->data[0];
rec = (struct ctdb_rec_data_old *)&reply->data[0];
DEBUG(DEBUG_INFO,("starting push of %u records for dbid 0x%x\n",
reply->count, reply->db_id));
@ -377,7 +377,7 @@ int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata)
goto failed;
}
rec = (struct ctdb_rec_data *)(rec->length + (uint8_t *)rec);
rec = (struct ctdb_rec_data_old *)(rec->length + (uint8_t *)rec);
}
DEBUG(DEBUG_DEBUG,("finished push of %u records for dbid 0x%x\n",
@ -752,7 +752,7 @@ void ctdb_recovery_unlock(struct ctdb_context *ctdb)
when the function returns)
or !0 is the record still exists in the tdb after returning.
*/
static int delete_tdb_record(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb_db, struct ctdb_rec_data *rec)
static int delete_tdb_record(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb_db, struct ctdb_rec_data_old *rec)
{
TDB_DATA key, data, data2;
struct ctdb_ltdb_header *hdr, *hdr2;
@ -990,7 +990,7 @@ int32_t ctdb_control_try_delete_records(struct ctdb_context *ctdb, TDB_DATA inda
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_rec_data_old *rec;
struct ctdb_marshall_buffer *records;
if (indata.dsize < offsetof(struct ctdb_marshall_buffer, data)) {
@ -1020,7 +1020,7 @@ int32_t ctdb_control_try_delete_records(struct ctdb_context *ctdb, TDB_DATA inda
records->db_id = ctdb_db->db_id;
rec = (struct ctdb_rec_data *)&reply->data[0];
rec = (struct ctdb_rec_data_old *)&reply->data[0];
for (i=0;i<reply->count;i++) {
TDB_DATA key, data;
@ -1057,7 +1057,7 @@ int32_t ctdb_control_try_delete_records(struct ctdb_context *ctdb, TDB_DATA inda
memcpy(old_size+(uint8_t *)records, rec, rec->length);
}
rec = (struct ctdb_rec_data *)(rec->length + (uint8_t *)rec);
rec = (struct ctdb_rec_data_old *)(rec->length + (uint8_t *)rec);
}
@ -1082,7 +1082,7 @@ int32_t ctdb_control_try_delete_records(struct ctdb_context *ctdb, TDB_DATA inda
*/
static int store_tdb_record(struct ctdb_context *ctdb,
struct ctdb_db_context *ctdb_db,
struct ctdb_rec_data *rec)
struct ctdb_rec_data_old *rec)
{
TDB_DATA key, data, data2;
struct ctdb_ltdb_header *hdr, *hdr2;
@ -1182,7 +1182,7 @@ int32_t ctdb_control_receive_records(struct ctdb_context *ctdb,
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_rec_data_old *rec;
struct ctdb_marshall_buffer *records;
if (indata.dsize < offsetof(struct ctdb_marshall_buffer, data)) {
@ -1211,7 +1211,7 @@ int32_t ctdb_control_receive_records(struct ctdb_context *ctdb,
}
records->db_id = ctdb_db->db_id;
rec = (struct ctdb_rec_data *)&reply->data[0];
rec = (struct ctdb_rec_data_old *)&reply->data[0];
for (i=0; i<reply->count; i++) {
TDB_DATA key, data;
@ -1255,7 +1255,7 @@ int32_t ctdb_control_receive_records(struct ctdb_context *ctdb,
memcpy(old_size+(uint8_t *)records, rec, rec->length);
}
rec = (struct ctdb_rec_data *)(rec->length + (uint8_t *)rec);
rec = (struct ctdb_rec_data_old *)(rec->length + (uint8_t *)rec);
}
*outdata = ctdb_marshall_finish(records);

View File

@ -735,7 +735,7 @@ static int pull_one_remote_database(struct ctdb_context *ctdb, uint32_t srcnode,
int ret;
TDB_DATA outdata;
struct ctdb_marshall_buffer *reply;
struct ctdb_rec_data *recdata;
struct ctdb_rec_data_old *recdata;
int i;
TALLOC_CTX *tmp_ctx = talloc_new(recdb);
@ -755,11 +755,11 @@ static int pull_one_remote_database(struct ctdb_context *ctdb, uint32_t srcnode,
return -1;
}
recdata = (struct ctdb_rec_data *)&reply->data[0];
recdata = (struct ctdb_rec_data_old *)&reply->data[0];
for (i=0;
i<reply->count;
recdata = (struct ctdb_rec_data *)(recdata->length + (uint8_t *)recdata), i++) {
recdata = (struct ctdb_rec_data_old *)(recdata->length + (uint8_t *)recdata), i++) {
TDB_DATA key, data;
struct ctdb_ltdb_header *hdr;
TDB_DATA existing;
@ -1021,7 +1021,7 @@ static void vacuum_fetch_callback(struct ctdb_client_call_state *state)
*/
static bool vacuum_fetch_process_one(struct ctdb_db_context *ctdb_db,
uint32_t pnn,
struct ctdb_rec_data *r)
struct ctdb_rec_data_old *r)
{
struct ctdb_client_call_state *state;
TDB_DATA data;
@ -1093,7 +1093,7 @@ static void vacuum_fetch_handler(uint64_t srvid, TDB_DATA data,
struct ctdb_dbid_map *dbmap=NULL;
bool persistent = false;
struct ctdb_db_context *ctdb_db;
struct ctdb_rec_data *r;
struct ctdb_rec_data_old *r;
recs = (struct ctdb_marshall_buffer *)data.dptr;
@ -1132,7 +1132,7 @@ static void vacuum_fetch_handler(uint64_t srvid, TDB_DATA data,
goto done;
}
r = (struct ctdb_rec_data *)&recs->data[0];
r = (struct ctdb_rec_data_old *)&recs->data[0];
while (recs->count) {
bool ok;
@ -1141,7 +1141,7 @@ static void vacuum_fetch_handler(uint64_t srvid, TDB_DATA data,
break;
}
r = (struct ctdb_rec_data *)(r->length + (uint8_t *)r);
r = (struct ctdb_rec_data_old *)(r->length + (uint8_t *)r);
recs->count--;
}
@ -1363,7 +1363,7 @@ struct recdb_data {
static int traverse_recdb(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *p)
{
struct recdb_data *params = (struct recdb_data *)p;
struct ctdb_rec_data *recdata;
struct ctdb_rec_data_old *recdata;
struct ctdb_ltdb_header *hdr;
/*

View File

@ -111,7 +111,7 @@ static int ctdb_traverse_local_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DAT
{
struct ctdb_traverse_local_handle *h = talloc_get_type(p,
struct ctdb_traverse_local_handle);
struct ctdb_rec_data *d;
struct ctdb_rec_data_old *d;
struct ctdb_ltdb_header *hdr;
int res, status;
TDB_DATA outdata;
@ -212,7 +212,7 @@ static struct ctdb_traverse_local_handle *ctdb_traverse_local(struct ctdb_db_con
int res, status;
pid_t parent = getpid();
struct ctdb_context *ctdb = ctdb_db->ctdb;
struct ctdb_rec_data *d;
struct ctdb_rec_data_old *d;
TDB_DATA outdata;
close(h->fd[0]);
@ -578,7 +578,7 @@ int32_t ctdb_control_traverse_all(struct ctdb_context *ctdb, TDB_DATA data, TDB_
*/
int32_t ctdb_control_traverse_data(struct ctdb_context *ctdb, TDB_DATA data, TDB_DATA *outdata)
{
struct ctdb_rec_data *d = (struct ctdb_rec_data *)data.dptr;
struct ctdb_rec_data_old *d = (struct ctdb_rec_data_old *)data.dptr;
struct ctdb_traverse_all_handle *state;
TDB_DATA key;
ctdb_traverse_fn_t callback;
@ -676,7 +676,7 @@ static int ctdb_traverse_start_destructor(struct traverse_start_state *state)
static void traverse_start_callback(void *p, TDB_DATA key, TDB_DATA data)
{
struct traverse_start_state *state;
struct ctdb_rec_data *d;
struct ctdb_rec_data_old *d;
TDB_DATA cdata;
state = talloc_get_type(p, struct traverse_start_state);

View File

@ -52,7 +52,7 @@ struct ctdb_persistent_write_state {
static int ctdb_persistent_store(struct ctdb_persistent_write_state *state)
{
int ret, i;
struct ctdb_rec_data *rec = NULL;
struct ctdb_rec_data_old *rec = NULL;
struct ctdb_marshall_buffer *m = state->m;
ret = tdb_transaction_start(state->ctdb_db->ltdb->tdb);

View File

@ -908,7 +908,7 @@ static void ctdb_process_delete_list(struct ctdb_db_context *ctdb_db,
for (i = 0; i < num_active_nodes; i++) {
struct ctdb_marshall_buffer *records;
struct ctdb_rec_data *rec;
struct ctdb_rec_data_old *rec;
int32_t res;
TDB_DATA outdata;
@ -930,7 +930,7 @@ static void ctdb_process_delete_list(struct ctdb_db_context *ctdb_db,
* the list to process further.
*/
records = (struct ctdb_marshall_buffer *)outdata.dptr;
rec = (struct ctdb_rec_data *)&records->data[0];
rec = (struct ctdb_rec_data_old *)&records->data[0];
while (records->count-- > 1) {
TDB_DATA reckey, recdata;
struct ctdb_ltdb_header *rechdr;
@ -972,7 +972,7 @@ static void ctdb_process_delete_list(struct ctdb_db_context *ctdb_db,
vdata->count.delete_list.left--;
}
rec = (struct ctdb_rec_data *)(rec->length + (uint8_t *)rec);
rec = (struct ctdb_rec_data_old *)(rec->length + (uint8_t *)rec);
}
}
@ -1015,7 +1015,7 @@ static void ctdb_process_delete_list(struct ctdb_db_context *ctdb_db,
for (i = 0; i < num_active_nodes; i++) {
struct ctdb_marshall_buffer *records;
struct ctdb_rec_data *rec;
struct ctdb_rec_data_old *rec;
int32_t res;
TDB_DATA outdata;
@ -1037,7 +1037,7 @@ static void ctdb_process_delete_list(struct ctdb_db_context *ctdb_db,
* the list to delete locally.
*/
records = (struct ctdb_marshall_buffer *)outdata.dptr;
rec = (struct ctdb_rec_data *)&records->data[0];
rec = (struct ctdb_rec_data_old *)&records->data[0];
while (records->count-- > 1) {
TDB_DATA reckey, recdata;
struct ctdb_ltdb_header *rechdr;
@ -1079,7 +1079,7 @@ static void ctdb_process_delete_list(struct ctdb_db_context *ctdb_db,
vdata->count.delete_list.left--;
}
rec = (struct ctdb_rec_data *)(rec->length + (uint8_t *)rec);
rec = (struct ctdb_rec_data_old *)(rec->length + (uint8_t *)rec);
}
}

View File

@ -5416,7 +5416,7 @@ struct backup_data {
static int backup_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *private)
{
struct backup_data *bd = talloc_get_type(private, struct backup_data);
struct ctdb_rec_data *rec;
struct ctdb_rec_data_old *rec;
/* add the record */
rec = ctdb_marshall_record(bd->records, 0, key, NULL, data);
@ -5799,7 +5799,7 @@ static int control_dumpdbbackup(struct ctdb_context *ctdb, int argc, const char
int i, fh;
struct tm *tm;
char tbuf[100];
struct ctdb_rec_data *rec = NULL;
struct ctdb_rec_data_old *rec = NULL;
struct ctdb_marshall_buffer *m;
struct ctdb_dump_db_context c;

View File

@ -1094,7 +1094,7 @@ int ctdbd_traverse(struct ctdbd_connection *master, uint32_t db_id,
while (True) {
struct ctdb_req_header *hdr = NULL;
struct ctdb_req_message_old *m;
struct ctdb_rec_data *d;
struct ctdb_rec_data_old *d;
ret = ctdb_read_packet(conn->fd, conn->timeout, conn, &hdr);
if (ret != 0) {
@ -1111,7 +1111,7 @@ int ctdbd_traverse(struct ctdbd_connection *master, uint32_t db_id,
}
m = (struct ctdb_req_message_old *)hdr;
d = (struct ctdb_rec_data *)&m->data[0];
d = (struct ctdb_rec_data_old *)&m->data[0];
if (m->datalen < sizeof(uint32_t) || m->datalen != d->length) {
DEBUG(0, ("Got invalid traverse data of length %d\n",
(int)m->datalen));

View File

@ -152,17 +152,17 @@ static NTSTATUS db_ctdb_ltdb_store(struct db_ctdb_ctx *db,
/*
form a ctdb_rec_data record from a key/data pair
*/
static struct ctdb_rec_data *db_ctdb_marshall_record(TALLOC_CTX *mem_ctx, uint32_t reqid,
static struct ctdb_rec_data_old *db_ctdb_marshall_record(TALLOC_CTX *mem_ctx, uint32_t reqid,
TDB_DATA key,
struct ctdb_ltdb_header *header,
TDB_DATA data)
{
size_t length;
struct ctdb_rec_data *d;
struct ctdb_rec_data_old *d;
length = offsetof(struct ctdb_rec_data, data) + key.dsize +
length = offsetof(struct ctdb_rec_data_old, data) + key.dsize +
data.dsize + sizeof(*header);
d = (struct ctdb_rec_data *)talloc_size(mem_ctx, length);
d = (struct ctdb_rec_data_old *)talloc_size(mem_ctx, length);
if (d == NULL) {
return NULL;
}
@ -187,7 +187,7 @@ static struct ctdb_marshall_buffer *db_ctdb_marshall_add(TALLOC_CTX *mem_ctx,
struct ctdb_ltdb_header *header,
TDB_DATA data)
{
struct ctdb_rec_data *r;
struct ctdb_rec_data_old *r;
size_t m_size, r_size;
struct ctdb_marshall_buffer *m2 = NULL;
@ -240,13 +240,13 @@ static TDB_DATA db_ctdb_marshall_finish(struct ctdb_marshall_buffer *m)
- pass r==NULL to start
- loop the number of times indicated by m->count
*/
static struct ctdb_rec_data *db_ctdb_marshall_loop_next_key(
struct ctdb_marshall_buffer *m, struct ctdb_rec_data *r, TDB_DATA *key)
static struct ctdb_rec_data_old *db_ctdb_marshall_loop_next_key(
struct ctdb_marshall_buffer *m, struct ctdb_rec_data_old *r, TDB_DATA *key)
{
if (r == NULL) {
r = (struct ctdb_rec_data *)&m->data[0];
r = (struct ctdb_rec_data_old *)&m->data[0];
} else {
r = (struct ctdb_rec_data *)(r->length + (uint8_t *)r);
r = (struct ctdb_rec_data_old *)(r->length + (uint8_t *)r);
}
key->dptr = &r->data[0];
@ -255,7 +255,7 @@ static struct ctdb_rec_data *db_ctdb_marshall_loop_next_key(
}
static bool db_ctdb_marshall_buf_parse(
struct ctdb_rec_data *r, uint32_t *reqid,
struct ctdb_rec_data_old *r, uint32_t *reqid,
struct ctdb_ltdb_header **header, TDB_DATA *data)
{
if (r->datalen < sizeof(struct ctdb_ltdb_header)) {
@ -354,7 +354,7 @@ static bool parse_newest_in_marshall_buffer(
TDB_DATA data, void *private_data),
void *private_data)
{
struct ctdb_rec_data *rec = NULL;
struct ctdb_rec_data_old *rec = NULL;
struct ctdb_ltdb_header *h = NULL;
TDB_DATA data;
int i;
@ -1390,7 +1390,7 @@ static int db_ctdb_traverse(struct db_context *db,
*/
struct db_context *newkeys = db_open_rbt(talloc_tos());
struct ctdb_marshall_buffer *mbuf = ctx->transaction->m_write;
struct ctdb_rec_data *rec=NULL;
struct ctdb_rec_data_old *rec=NULL;
int i;
int count = 0;
NTSTATUS status;