mirror of
https://github.com/samba-team/samba.git
synced 2025-01-22 22:04:08 +03:00
ctdb-protocol: Add marshalling for struct ctdb_db_vacuum
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
b314835341
commit
a896486b62
@ -83,6 +83,16 @@ void ctdb_pulldb_ext_push(struct ctdb_pulldb_ext *in, uint8_t *buf,
|
||||
int ctdb_pulldb_ext_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
||||
struct ctdb_pulldb_ext **out, size_t *npull);
|
||||
|
||||
size_t ctdb_db_vacuum_len(struct ctdb_db_vacuum *in);
|
||||
void ctdb_db_vacuum_push(struct ctdb_db_vacuum *in,
|
||||
uint8_t *buf,
|
||||
size_t *npush);
|
||||
int ctdb_db_vacuum_pull(uint8_t *buf,
|
||||
size_t buflen,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct ctdb_db_vacuum **out,
|
||||
size_t *npull);
|
||||
|
||||
size_t ctdb_traverse_start_len(struct ctdb_traverse_start *in);
|
||||
void ctdb_traverse_start_push(struct ctdb_traverse_start *in, uint8_t *buf,
|
||||
size_t *npush);
|
||||
|
@ -1240,6 +1240,69 @@ fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t ctdb_db_vacuum_len(struct ctdb_db_vacuum *in)
|
||||
{
|
||||
return ctdb_uint32_len(&in->db_id) +
|
||||
ctdb_bool_len(&in->full_vacuum_run);
|
||||
}
|
||||
|
||||
void ctdb_db_vacuum_push(struct ctdb_db_vacuum *in,
|
||||
uint8_t *buf,
|
||||
size_t *npush)
|
||||
{
|
||||
size_t offset = 0, np;
|
||||
|
||||
ctdb_uint32_push(&in->db_id, buf+offset, &np);
|
||||
offset += np;
|
||||
|
||||
ctdb_bool_push(&in->full_vacuum_run, buf+offset, &np);
|
||||
offset += np;
|
||||
|
||||
*npush = offset;
|
||||
}
|
||||
|
||||
int ctdb_db_vacuum_pull(uint8_t *buf,
|
||||
size_t buflen,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct ctdb_db_vacuum **out,
|
||||
size_t *npull)
|
||||
{
|
||||
struct ctdb_db_vacuum *val;
|
||||
size_t offset = 0, np;
|
||||
int ret;
|
||||
|
||||
val = talloc(mem_ctx, struct ctdb_db_vacuum);
|
||||
if (val == NULL) {
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
ret = ctdb_uint32_pull(buf+offset,
|
||||
buflen-offset,
|
||||
&val->db_id,
|
||||
&np);
|
||||
if (ret != 0) {
|
||||
goto fail;;
|
||||
}
|
||||
offset += np;
|
||||
|
||||
ret = ctdb_bool_pull(buf+offset,
|
||||
buflen-offset,
|
||||
&val->full_vacuum_run,
|
||||
&np);
|
||||
if (ret != 0) {
|
||||
goto fail;
|
||||
}
|
||||
offset += np;
|
||||
|
||||
*out = val;
|
||||
*npull = offset;
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
talloc_free(val);
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t ctdb_ltdb_header_len(struct ctdb_ltdb_header *in)
|
||||
{
|
||||
return ctdb_uint64_len(&in->rsn) +
|
||||
|
@ -310,6 +310,19 @@ void verify_ctdb_pulldb_ext(struct ctdb_pulldb_ext *p1,
|
||||
assert(p1->srvid == p2->srvid);
|
||||
}
|
||||
|
||||
void fill_ctdb_db_vacuum(TALLOC_CTX *mem_ctx, struct ctdb_db_vacuum *p)
|
||||
{
|
||||
fill_ctdb_uint32(&p->db_id);
|
||||
fill_ctdb_bool(&p->full_vacuum_run);
|
||||
}
|
||||
|
||||
void verify_ctdb_db_vacuum(struct ctdb_db_vacuum *p1,
|
||||
struct ctdb_db_vacuum *p2)
|
||||
{
|
||||
verify_ctdb_uint32(&p1->db_id, &p2->db_id);
|
||||
verify_ctdb_bool(&p1->full_vacuum_run, &p2->full_vacuum_run);
|
||||
}
|
||||
|
||||
void fill_ctdb_ltdb_header(struct ctdb_ltdb_header *p)
|
||||
{
|
||||
p->rsn = rand64();
|
||||
|
@ -64,6 +64,10 @@ void fill_ctdb_pulldb_ext(TALLOC_CTX *mem_ctx, struct ctdb_pulldb_ext *p);
|
||||
void verify_ctdb_pulldb_ext(struct ctdb_pulldb_ext *p1,
|
||||
struct ctdb_pulldb_ext *p2);
|
||||
|
||||
void fill_ctdb_db_vacuum(TALLOC_CTX *mem_ctx, struct ctdb_db_vacuum *p);
|
||||
void verify_ctdb_db_vacuum(struct ctdb_db_vacuum *p1,
|
||||
struct ctdb_db_vacuum *p2);
|
||||
|
||||
void fill_ctdb_ltdb_header(struct ctdb_ltdb_header *p);
|
||||
void verify_ctdb_ltdb_header(struct ctdb_ltdb_header *p1,
|
||||
struct ctdb_ltdb_header *p2);
|
||||
|
@ -38,6 +38,7 @@ PROTOCOL_TYPE3_TEST(struct ctdb_dbid, ctdb_dbid);
|
||||
PROTOCOL_TYPE3_TEST(struct ctdb_dbid_map, ctdb_dbid_map);
|
||||
PROTOCOL_TYPE3_TEST(struct ctdb_pulldb, ctdb_pulldb);
|
||||
PROTOCOL_TYPE3_TEST(struct ctdb_pulldb_ext, ctdb_pulldb_ext);
|
||||
PROTOCOL_TYPE3_TEST(struct ctdb_db_vacuum, ctdb_db_vacuum);
|
||||
PROTOCOL_TYPE1_TEST(struct ctdb_ltdb_header, ctdb_ltdb_header);
|
||||
PROTOCOL_TYPE3_TEST(struct ctdb_rec_data, ctdb_rec_data);
|
||||
PROTOCOL_TYPE3_TEST(struct ctdb_rec_buffer, ctdb_rec_buffer);
|
||||
@ -143,6 +144,7 @@ int main(int argc, char *argv[])
|
||||
TEST_FUNC(ctdb_dbid_map)();
|
||||
TEST_FUNC(ctdb_pulldb)();
|
||||
TEST_FUNC(ctdb_pulldb_ext)();
|
||||
TEST_FUNC(ctdb_db_vacuum)();
|
||||
TEST_FUNC(ctdb_ltdb_header)();
|
||||
TEST_FUNC(ctdb_rec_data)();
|
||||
TEST_FUNC(ctdb_rec_buffer)();
|
||||
|
Loading…
x
Reference in New Issue
Block a user