summaryrefslogtreecommitdiff
path: root/ctdb/protocol
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2016-02-19 10:45:19 +1100
committerMartin Schwenke <martins@samba.org>2016-03-25 03:26:14 +0100
commitfe69b72569494ef09dc8fa8673af02c0bfc18434 (patch)
tree2af093e36c3778a6c1b82881a12664d5c08b5617 /ctdb/protocol
parentc41808e6d292ec4cd861af545478e7dfb5c448e8 (diff)
downloadsamba-fe69b72569494ef09dc8fa8673af02c0bfc18434.tar.gz
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>
Diffstat (limited to 'ctdb/protocol')
-rw-r--r--ctdb/protocol/protocol.h6
-rw-r--r--ctdb/protocol/protocol_private.h5
-rw-r--r--ctdb/protocol/protocol_types.c28
3 files changed, 39 insertions, 0 deletions
diff --git a/ctdb/protocol/protocol.h b/ctdb/protocol/protocol.h
index d3ee1499d50..1b48c3920fa 100644
--- a/ctdb/protocol/protocol.h
+++ b/ctdb/protocol/protocol.h
@@ -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
diff --git a/ctdb/protocol/protocol_private.h b/ctdb/protocol/protocol_private.h
index 65193d9a3f4..a67d622cc72 100644
--- a/ctdb/protocol/protocol_private.h
+++ b/ctdb/protocol/protocol_private.h
@@ -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);
diff --git a/ctdb/protocol/protocol_types.c b/ctdb/protocol/protocol_types.c
index e36d2e8bc35..a0263336319 100644
--- a/ctdb/protocol/protocol_types.c
+++ b/ctdb/protocol/protocol_types.c
@@ -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);