mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
ctdb-protocol: Add protocol marshalling for control DB_OPEN_FLAGS
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
parent
0b607528ff
commit
339b818e56
@ -597,6 +597,11 @@ void ctdb_req_control_db_push_confirm(struct ctdb_req_control *request,
|
||||
int ctdb_reply_control_db_push_confirm(struct ctdb_reply_control *reply,
|
||||
uint32_t *num_records);
|
||||
|
||||
void ctdb_req_control_db_open_flags(struct ctdb_req_control *request,
|
||||
uint32_t db_id);
|
||||
int ctdb_reply_control_db_open_flags(struct ctdb_reply_control *reply,
|
||||
int *tdb_flags);
|
||||
|
||||
/* From protocol/protocol_debug.c */
|
||||
|
||||
void ctdb_packet_print(uint8_t *buf, size_t buflen, FILE *fp);
|
||||
|
@ -2332,3 +2332,31 @@ int ctdb_reply_control_db_push_confirm(struct ctdb_reply_control *reply,
|
||||
}
|
||||
return reply->status;
|
||||
}
|
||||
|
||||
/* CTDB_CONTROL_DB_OPEN_FLAGS */
|
||||
|
||||
void ctdb_req_control_db_open_flags(struct ctdb_req_control *request,
|
||||
uint32_t db_id)
|
||||
{
|
||||
request->opcode = CTDB_CONTROL_DB_OPEN_FLAGS;
|
||||
request->pad = 0;
|
||||
request->srvid = 0;
|
||||
request->client_id = 0;
|
||||
request->flags = 0;
|
||||
|
||||
request->rdata.opcode = CTDB_CONTROL_DB_OPEN_FLAGS;
|
||||
request->rdata.data.db_id = db_id;
|
||||
}
|
||||
|
||||
int ctdb_reply_control_db_open_flags(struct ctdb_reply_control *reply,
|
||||
int *tdb_flags)
|
||||
{
|
||||
if (reply->rdata.opcode != CTDB_CONTROL_DB_OPEN_FLAGS) {
|
||||
return EPROTO;
|
||||
}
|
||||
|
||||
if (reply->status == 0) {
|
||||
*tdb_flags = reply->rdata.data.tdb_flags;
|
||||
}
|
||||
return reply->status;
|
||||
}
|
||||
|
@ -426,6 +426,10 @@ static size_t ctdb_req_control_data_len(struct ctdb_req_control_data *cd)
|
||||
case CTDB_CONTROL_DB_PUSH_CONFIRM:
|
||||
len = ctdb_uint32_len(cd->data.db_id);
|
||||
break;
|
||||
|
||||
case CTDB_CONTROL_DB_OPEN_FLAGS:
|
||||
len = ctdb_uint32_len(cd->data.db_id);
|
||||
break;
|
||||
}
|
||||
|
||||
return len;
|
||||
@ -689,6 +693,10 @@ static void ctdb_req_control_data_push(struct ctdb_req_control_data *cd,
|
||||
case CTDB_CONTROL_DB_PUSH_CONFIRM:
|
||||
ctdb_uint32_push(cd->data.db_id, buf);
|
||||
break;
|
||||
|
||||
case CTDB_CONTROL_DB_OPEN_FLAGS:
|
||||
ctdb_uint32_push(cd->data.db_id, buf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1019,6 +1027,11 @@ static int ctdb_req_control_data_pull(uint8_t *buf, size_t buflen,
|
||||
ret = ctdb_uint32_pull(buf, buflen, mem_ctx,
|
||||
&cd->data.db_id);
|
||||
break;
|
||||
|
||||
case CTDB_CONTROL_DB_OPEN_FLAGS:
|
||||
ret = ctdb_uint32_pull(buf, buflen, mem_ctx,
|
||||
&cd->data.db_id);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -1380,6 +1393,10 @@ static size_t ctdb_reply_control_data_len(struct ctdb_reply_control_data *cd)
|
||||
case CTDB_CONTROL_DB_PUSH_CONFIRM:
|
||||
len = ctdb_uint32_len(cd->data.num_records);
|
||||
break;
|
||||
|
||||
case CTDB_CONTROL_DB_OPEN_FLAGS:
|
||||
len = ctdb_int32_len(cd->data.tdb_flags);
|
||||
break;
|
||||
}
|
||||
|
||||
return len;
|
||||
@ -1532,6 +1549,10 @@ static void ctdb_reply_control_data_push(struct ctdb_reply_control_data *cd,
|
||||
case CTDB_CONTROL_DB_PUSH_CONFIRM:
|
||||
ctdb_uint32_push(cd->data.num_records, buf);
|
||||
break;
|
||||
|
||||
case CTDB_CONTROL_DB_OPEN_FLAGS:
|
||||
ctdb_int32_push(cd->data.tdb_flags, buf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1719,6 +1740,11 @@ static int ctdb_reply_control_data_pull(uint8_t *buf, size_t buflen,
|
||||
ret = ctdb_uint32_pull(buf, buflen, mem_ctx,
|
||||
&cd->data.num_records);
|
||||
break;
|
||||
|
||||
case CTDB_CONTROL_DB_OPEN_FLAGS:
|
||||
ret = ctdb_int32_pull(buf, buflen, mem_ctx,
|
||||
&cd->data.tdb_flags);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
. "${TEST_SCRIPTS_DIR}/unit.sh"
|
||||
|
||||
last_control=148
|
||||
last_control=149
|
||||
|
||||
control_output=$(
|
||||
for i in $(seq 0 $last_control) ; do
|
||||
|
@ -592,6 +592,10 @@ static void fill_ctdb_req_control_data(TALLOC_CTX *mem_ctx,
|
||||
cd->data.db_id = rand32();
|
||||
break;
|
||||
|
||||
case CTDB_CONTROL_DB_OPEN_FLAGS:
|
||||
cd->data.db_id = rand32();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -988,6 +992,10 @@ static void verify_ctdb_req_control_data(struct ctdb_req_control_data *cd,
|
||||
assert(cd->data.db_id == cd2->data.db_id);
|
||||
break;
|
||||
|
||||
case CTDB_CONTROL_DB_OPEN_FLAGS:
|
||||
assert(cd->data.db_id == cd2->data.db_id);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1395,6 +1403,10 @@ static void fill_ctdb_reply_control_data(TALLOC_CTX *mem_ctx,
|
||||
cd->data.num_records = rand32();
|
||||
break;
|
||||
|
||||
case CTDB_CONTROL_DB_OPEN_FLAGS:
|
||||
cd->data.tdb_flags = rand32();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1732,6 +1744,10 @@ static void verify_ctdb_reply_control_data(struct ctdb_reply_control_data *cd,
|
||||
assert(cd->data.num_records == cd2->data.num_records);
|
||||
break;
|
||||
|
||||
case CTDB_CONTROL_DB_OPEN_FLAGS:
|
||||
assert(cd->data.tdb_flags == cd2->data.tdb_flags);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -2174,7 +2190,7 @@ static void test_ctdb_reply_dmaster(void)
|
||||
talloc_free(mem_ctx);
|
||||
}
|
||||
|
||||
#define NUM_CONTROLS 149
|
||||
#define NUM_CONTROLS 150
|
||||
|
||||
static void test_ctdb_req_control_data(void)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user