1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-21 18:04:06 +03:00

ctdb-protocol: Add new data type ctdb_pulldb_ext for new control

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit fe69b72569494ef09dc8fa8673af02c0bfc18434)
This commit is contained in:
Amitay Isaacs 2016-02-19 10:45:19 +11:00 committed by Karolin Seeger
parent ea98f51616
commit d0c4375f72
3 changed files with 39 additions and 0 deletions

View File

@ -457,6 +457,12 @@ struct ctdb_pulldb {
uint32_t lmaster;
};
struct ctdb_pulldb_ext {
uint32_t db_id;
uint32_t lmaster;
uint64_t srvid;
};
#define CTDB_RECOVERY_NORMAL 0
#define CTDB_RECOVERY_ACTIVE 1

View File

@ -91,6 +91,11 @@ void ctdb_pulldb_push(struct ctdb_pulldb *pulldb, uint8_t *buf);
int ctdb_pulldb_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
struct ctdb_pulldb **out);
size_t ctdb_pulldb_ext_len(struct ctdb_pulldb_ext *pulldb);
void ctdb_pulldb_ext_push(struct ctdb_pulldb_ext *pulldb, 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 ctdb_traverse_start_len(struct ctdb_traverse_start *traverse);
void ctdb_traverse_start_push(struct ctdb_traverse_start *traverse,
uint8_t *buf);

View File

@ -473,6 +473,34 @@ int ctdb_pulldb_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
return 0;
}
size_t ctdb_pulldb_ext_len(struct ctdb_pulldb_ext *pulldb)
{
return sizeof(struct ctdb_pulldb_ext);
}
void ctdb_pulldb_ext_push(struct ctdb_pulldb_ext *pulldb, uint8_t *buf)
{
memcpy(buf, pulldb, sizeof(struct ctdb_pulldb_ext));
}
int ctdb_pulldb_ext_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
struct ctdb_pulldb_ext **out)
{
struct ctdb_pulldb_ext *pulldb;
if (buflen < sizeof(struct ctdb_pulldb_ext)) {
return EMSGSIZE;
}
pulldb = talloc_memdup(mem_ctx, buf, sizeof(struct ctdb_pulldb_ext));
if (pulldb == NULL) {
return ENOMEM;
}
*out = pulldb;
return 0;
}
size_t ctdb_ltdb_header_len(struct ctdb_ltdb_header *header)
{
return sizeof(struct ctdb_ltdb_header);