ctdb: Rename CTDB_VERSION to CTDB_PROTOCOL
authorAmitay Isaacs <amitay@gmail.com>
Tue, 21 Oct 2014 00:53:29 +0000 (11:53 +1100)
committerAmitay Isaacs <amitay@samba.org>
Tue, 28 Oct 2014 04:42:05 +0000 (05:42 +0100)
CTDB_VERSION really is the ctdb protocol version.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
ctdb/client/ctdb_client.c
ctdb/include/ctdb_protocol.h
ctdb/server/ctdb_daemon.c
ctdb/tcp/tcp_io.c
ctdb/tools/ctdb.c
source3/lib/cluster_support.c
source3/lib/ctdb_conn.c
source3/lib/ctdbd_conn.c

index 424937ad8ca84e34dad455ee5205fd018eca62e6..07b17d016a488110e835ba6c0df7f4c96e383043 100644 (file)
@@ -54,7 +54,7 @@ struct ctdb_req_header *_ctdbd_allocate_pkt(struct ctdb_context *ctdb,
        hdr->length       = length;
        hdr->operation    = operation;
        hdr->ctdb_magic   = CTDB_MAGIC;
-       hdr->ctdb_version = CTDB_VERSION;
+       hdr->ctdb_version = CTDB_PROTOCOL;
        hdr->srcnode      = ctdb->pnn;
        if (ctdb->vnn_map) {
                hdr->generation = ctdb->vnn_map->generation;
@@ -216,7 +216,7 @@ void ctdb_client_read_cb(uint8_t *data, size_t cnt, void *args)
                goto done;
        }
 
-       if (hdr->ctdb_version != CTDB_VERSION) {
+       if (hdr->ctdb_version != CTDB_PROTOCOL) {
                ctdb_set_error(ctdb, "Bad CTDB version 0x%x rejected in client\n", hdr->ctdb_version);
                goto done;
        }
index 72161affa6e6f9bd6fa2b60e3c70cd1ee1265f44..725e42623006120b9bed19a0aa78416a6b7b625c 100644 (file)
@@ -272,7 +272,7 @@ enum ctdb_operation {
 };
 
 #define CTDB_MAGIC 0x43544442 /* CTDB */
-#define CTDB_VERSION 1
+#define CTDB_PROTOCOL 1
 
 enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
                    CTDB_CONTROL_STATISTICS              = 1,
index 254b1ca81952c02971827d335df5827e0984cef6..aac507cab5cce496e0b4c0b184b215ae0bc98fdb 100644 (file)
@@ -814,7 +814,7 @@ static void daemon_incoming_packet(void *p, struct ctdb_req_header *hdr)
                goto done;
        }
 
-       if (hdr->ctdb_version != CTDB_VERSION) {
+       if (hdr->ctdb_version != CTDB_PROTOCOL) {
                ctdb_set_error(client->ctdb, "Bad CTDB version 0x%x rejected in daemon\n", hdr->ctdb_version);
                goto done;
        }
@@ -876,7 +876,7 @@ static void ctdb_daemon_read_cb(uint8_t *data, size_t cnt, void *args)
                return;
        }
 
-       if (hdr->ctdb_version != CTDB_VERSION) {
+       if (hdr->ctdb_version != CTDB_PROTOCOL) {
                ctdb_set_error(client->ctdb, "Bad CTDB version 0x%x rejected in daemon\n", hdr->ctdb_version);
                return;
        }
@@ -1354,7 +1354,7 @@ struct ctdb_req_header *_ctdb_transport_allocate(struct ctdb_context *ctdb,
        hdr->length       = length;
        hdr->operation    = operation;
        hdr->ctdb_magic   = CTDB_MAGIC;
-       hdr->ctdb_version = CTDB_VERSION;
+       hdr->ctdb_version = CTDB_PROTOCOL;
        hdr->generation   = ctdb->vnn_map->generation;
        hdr->srcnode      = ctdb->pnn;
 
index 5111195b178fcb79529200dee51f770d573e6917..a951320a07d4e1a173b7b98176d6d4510328afb6 100644 (file)
@@ -63,7 +63,7 @@ void ctdb_tcp_read_cb(uint8_t *data, size_t cnt, void *args)
                goto failed;
        }
 
-       if (hdr->ctdb_version != CTDB_VERSION) {
+       if (hdr->ctdb_version != CTDB_PROTOCOL) {
                DEBUG(DEBUG_ALERT, (__location__ " Bad CTDB version 0x%x rejected\n", 
                          hdr->ctdb_version));
                goto failed;
index 458ea9e4abe79b509f39d262a6660a67cd2a5f2e..5d5ce3cc9ea7653790f0d4b2d4a113a410699b22 100644 (file)
@@ -484,7 +484,7 @@ static void show_statistics(struct ctdb_statistics *s, int show_header)
                        printf("max_childwrite_latency:");
                        printf("\n");
                }
-               printf("%d:", CTDB_VERSION);
+               printf("%d:", CTDB_PROTOCOL);
                printf("%d:", (int)s->statistics_current_time.tv_sec);
                printf("%d:", (int)s->statistics_start_time.tv_sec);
                for (i=0;i<ARRAY_SIZE(fields);i++) {
@@ -511,7 +511,7 @@ static void show_statistics(struct ctdb_statistics *s, int show_header)
                printf("%.6f:", s->childwrite_latency.max);
                printf("\n");
        } else {
-               printf("CTDB version %u\n", CTDB_VERSION);
+               printf("CTDB version %u\n", CTDB_PROTOCOL);
                printf("Current time of statistics  :                %s", ctime(&s->statistics_current_time.tv_sec));
                printf("Statistics collected since  : (%03d %02d:%02d:%02d) %s", days, hours, minutes, seconds, ctime(&s->statistics_start_time.tv_sec));
 
index 6a5f91d1d379bafb2969c0450c31835631d63139..b8925aa77258a870e1689d887901a2365ae65984 100644 (file)
@@ -21,9 +21,7 @@
 #include "cluster_support.h"
 
 #ifdef CLUSTER_SUPPORT
-#include <ctdb.h>
 #include <ctdb_protocol.h>
-#include <ctdb_private.h>
 #endif
 
 bool cluster_support_available(void)
@@ -49,8 +47,8 @@ const char *cluster_support_features(void)
 #ifdef CTDB_SOCKET
        _LINE_STR(CTDB_SOCKET)
 #endif
-#ifdef CTDB_VERSION
-       _LINE_INT(CTDB_VERSION)
+#ifdef CTDB_PROTOCOL
+       _LINE_INT(CTDB_PROTOCOL)
 #endif
        "";
 
index 1bba8e7e82d44ee80d863c8334ed26ac4a67baf7..c705c211c3c940e3e2fd3502e8ad5c1d4f31c2bf 100644 (file)
@@ -179,7 +179,7 @@ struct tevent_req *ctdb_conn_control_send(TALLOC_CTX *mem_ctx,
        hdr = &state->req.hdr;
        hdr->length = offsetof(struct ctdb_req_control, data) + datalen;
        hdr->ctdb_magic    = CTDB_MAGIC;
-       hdr->ctdb_version  = CTDB_VERSION;
+       hdr->ctdb_version  = CTDB_PROTOCOL;
        hdr->operation     = CTDB_REQ_CONTROL;
        hdr->reqid         = 1; /* FIXME */
        hdr->destnode      = vnn;
@@ -306,7 +306,7 @@ struct tevent_req *ctdb_conn_msg_write_send(TALLOC_CTX *mem_ctx,
 
        h->length = offsetof(struct ctdb_req_message, data) + msg_len;
        h->ctdb_magic = CTDB_MAGIC;
-       h->ctdb_version = CTDB_VERSION;
+       h->ctdb_version = CTDB_PROTOCOL;
        h->generation = 1;
        h->operation  = CTDB_REQ_MESSAGE;
        h->destnode   = vnn;
index 5044ddfb328cfad0ff5a701249052166fbe04e47..a26f41023685509fd85bedaaa6c72c89dea3fe59 100644 (file)
@@ -767,7 +767,7 @@ NTSTATUS ctdbd_messaging_send_blob(struct ctdbd_connection *conn,
 
        r.hdr.length = offsetof(struct ctdb_req_message, data) + buflen;
        r.hdr.ctdb_magic = CTDB_MAGIC;
-       r.hdr.ctdb_version = CTDB_VERSION;
+       r.hdr.ctdb_version = CTDB_PROTOCOL;
        r.hdr.generation = 1;
        r.hdr.operation  = CTDB_REQ_MESSAGE;
        r.hdr.destnode   = dst_vnn;
@@ -826,7 +826,7 @@ static NTSTATUS ctdbd_control(struct ctdbd_connection *conn,
        ZERO_STRUCT(req);
        req.hdr.length = offsetof(struct ctdb_req_control, data) + data.dsize;
        req.hdr.ctdb_magic   = CTDB_MAGIC;
-       req.hdr.ctdb_version = CTDB_VERSION;
+       req.hdr.ctdb_version = CTDB_PROTOCOL;
        req.hdr.operation    = CTDB_REQ_CONTROL;
        req.hdr.reqid        = ctdbd_next_reqid(conn);
        req.hdr.destnode     = vnn;
@@ -947,7 +947,7 @@ bool ctdb_processes_exist(struct ctdbd_connection *conn,
                req.hdr.length = offsetof(struct ctdb_req_control, data);
                req.hdr.length += sizeof(pid);
                req.hdr.ctdb_magic   = CTDB_MAGIC;
-               req.hdr.ctdb_version = CTDB_VERSION;
+               req.hdr.ctdb_version = CTDB_PROTOCOL;
                req.hdr.operation    = CTDB_REQ_CONTROL;
                req.hdr.reqid        = reqids[i];
                req.hdr.destnode     = pids[i].vnn;
@@ -1143,7 +1143,7 @@ bool ctdb_serverids_exist(struct ctdbd_connection *conn,
 
                req.hdr.length = offsetof(struct ctdb_req_control, data);
                req.hdr.ctdb_magic   = CTDB_MAGIC;
-               req.hdr.ctdb_version = CTDB_VERSION;
+               req.hdr.ctdb_version = CTDB_PROTOCOL;
                req.hdr.operation    = CTDB_REQ_CONTROL;
                req.hdr.reqid        = vnn->reqid;
                req.hdr.destnode     = vnn->vnn;
@@ -1354,7 +1354,7 @@ NTSTATUS ctdbd_migrate(struct ctdbd_connection *conn, uint32_t db_id,
 
        req.hdr.length = offsetof(struct ctdb_req_call, data) + key.dsize;
        req.hdr.ctdb_magic   = CTDB_MAGIC;
-       req.hdr.ctdb_version = CTDB_VERSION;
+       req.hdr.ctdb_version = CTDB_PROTOCOL;
        req.hdr.operation    = CTDB_REQ_CALL;
        req.hdr.reqid        = ctdbd_next_reqid(conn);
        req.flags            = CTDB_IMMEDIATE_MIGRATION;
@@ -1419,7 +1419,7 @@ NTSTATUS ctdbd_parse(struct ctdbd_connection *conn, uint32_t db_id,
 
        req.hdr.length = offsetof(struct ctdb_req_call, data) + key.dsize;
        req.hdr.ctdb_magic   = CTDB_MAGIC;
-       req.hdr.ctdb_version = CTDB_VERSION;
+       req.hdr.ctdb_version = CTDB_PROTOCOL;
        req.hdr.operation    = CTDB_REQ_CALL;
        req.hdr.reqid        = ctdbd_next_reqid(conn);
        req.flags            = flags;