ctdb-protocol: Drop struct ctdb_event_header
authorAmitay Isaacs <amitay@gmail.com>
Mon, 10 Jul 2017 16:16:24 +0000 (02:16 +1000)
committerMartin Schwenke <martins@samba.org>
Fri, 1 Sep 2017 06:52:07 +0000 (08:52 +0200)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/protocol/protocol.h
ctdb/protocol/protocol_api.h
ctdb/protocol/protocol_event.c
ctdb/tests/cunit/protocol_test_102.sh
ctdb/tests/src/protocol_common_event.c
ctdb/tests/src/protocol_common_event.h
ctdb/tests/src/protocol_event_test.c

index 15d2faa80f1b97c7cd9fd1f08728e69189f58399..c61b97249a6ecad5a5461c78e16acb6ab05b3824 100644 (file)
@@ -1081,11 +1081,6 @@ struct ctdb_event_reply_data {
        } data;
 };
 
-struct ctdb_event_header {
-       uint32_t length;
-       uint32_t reqid;
-};
-
 struct ctdb_event_request {
        struct sock_packet_header header;
        struct ctdb_event_request_data rdata;
index 22fc448320541efa4ffcd3af0f5a5cf3096f2a35..83ebd4862ffcae6d2407c7378fe712c9ae1df805 100644 (file)
@@ -652,8 +652,6 @@ int ctdb_req_keepalive_pull(uint8_t *buf, size_t buflen,
 
 /* From protocol/protocol_event.c */
 
-void ctdb_event_header_fill(struct ctdb_event_header *h, uint32_t reqid);
-
 size_t ctdb_event_request_len(struct ctdb_event_request *in);
 
 int ctdb_event_request_push(struct ctdb_event_request *in,
index 40e21ce2dfb2b5c879661c0d4db973f2e85de7fb..af6040abd92062659bbe33a4eaad09f88c51e49a 100644 (file)
@@ -801,59 +801,6 @@ static int ctdb_event_reply_data_pull(uint8_t *buf, size_t buflen,
        return 0;
 }
 
-size_t ctdb_event_header_len(struct ctdb_event_header *in);
-void ctdb_event_header_push(struct ctdb_event_header *in, uint8_t *buf,
-                           size_t *npush);
-int ctdb_event_header_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
-                          struct ctdb_event_header *out, size_t *npull);
-
-size_t ctdb_event_header_len(struct ctdb_event_header *in)
-{
-       return ctdb_uint32_len(&in->length) + ctdb_uint32_len(&in->reqid);
-}
-
-void ctdb_event_header_push(struct ctdb_event_header *in, uint8_t *buf,
-                           size_t *npush)
-{
-       size_t offset = 0, np;
-
-       ctdb_uint32_push(&in->length, buf, &np);
-       offset += np;
-
-       ctdb_uint32_push(&in->reqid, buf+offset, &np);
-       offset += np;
-
-       *npush = offset;
-}
-
-int ctdb_event_header_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
-                          struct ctdb_event_header *out, size_t *npull)
-{
-       size_t offset = 0, np;
-       int ret;
-
-       ret = ctdb_uint32_pull(buf, buflen, &out->length, &np);
-       if (ret != 0) {
-               return ret;
-       }
-       offset += np;
-
-       ret = ctdb_uint32_pull(buf+offset, buflen-offset, &out->reqid, &np);
-       if (ret != 0) {
-               return ret;
-       }
-       offset += np;
-
-       *npull = offset;
-       return 0;
-}
-
-void ctdb_event_header_fill(struct ctdb_event_header *h, uint32_t reqid)
-{
-       h->length = ctdb_event_header_len(h);
-       h->reqid = reqid;
-}
-
 size_t ctdb_event_request_len(struct ctdb_event_request *in)
 {
        return sock_packet_header_len(&in->header) +
index 898a43dc7c1ef14fd04b66305ab2edee83004df3..0d9795c21020cdbdc99cb6469d242640167a9b36 100755 (executable)
@@ -12,7 +12,6 @@ generate_output ()
 }
 
 output=$(
-    echo "ctdb_event_header"
     generate_output "ctdb_event_request_data"
     generate_output "ctdb_event_reply_data"
     generate_output "ctdb_event_request"
index 6c71802aec2f4d7a5fb3874282dd3a54988e39ef..891af8d29bdf2bbd0804d368b4bff1e678b04470 100644 (file)
@@ -256,19 +256,6 @@ void verify_ctdb_event_reply_data(struct ctdb_event_reply_data *r,
        }
 }
 
-void fill_ctdb_event_header(struct ctdb_event_header *h)
-{
-       h->length = rand32();
-       h->reqid = rand32();
-}
-
-void verify_ctdb_event_header(struct ctdb_event_header *h,
-                             struct ctdb_event_header *h2)
-{
-       assert(h->length == h2->length);
-       assert(h->reqid == h2->reqid);
-}
-
 void fill_ctdb_event_request(TALLOC_CTX *mem_ctx,
                             struct ctdb_event_request *r, uint32_t command)
 {
index 00bfc736a8e17182d387227fc0d34e671617d156..e0c237c5b3330bce0d5bda382616dade5c7c8cfd 100644 (file)
@@ -73,10 +73,6 @@ void fill_ctdb_event_reply_data(TALLOC_CTX *mem_ctx,
 void verify_ctdb_event_reply_data(struct ctdb_event_reply_data *r,
                                  struct ctdb_event_reply_data *r2);
 
-void fill_ctdb_event_header(struct ctdb_event_header *h);
-void verify_ctdb_event_header(struct ctdb_event_header *h,
-                             struct ctdb_event_header *h2);
-
 void fill_ctdb_event_request(TALLOC_CTX *mem_ctx,
                             struct ctdb_event_request *r, uint32_t command);
 void verify_ctdb_event_request(struct ctdb_event_request *r,
index c48fdb1240161678adeb6463aa810a3d120ccfb1..46123b4eeeacfdf13a71e4494415feaa956cd446 100644 (file)
@@ -94,35 +94,6 @@ static void TEST_FUNC(NAME)(uint32_t command) \
        talloc_free(mem_ctx); \
 }
 
-static void test_ctdb_event_header(void)
-{
-       TALLOC_CTX *mem_ctx;
-       size_t buflen, np = 0;
-       struct ctdb_event_header h, h2;
-       int ret;
-
-       printf("ctdb_event_header\n");
-       fflush(stdout);
-
-       mem_ctx = talloc_new(NULL);
-       assert(mem_ctx != NULL);
-
-       ctdb_event_header_fill(&h, REQID);
-
-       buflen = ctdb_event_header_len(&h);
-       assert(buflen < sizeof(BUFFER));
-       ctdb_event_header_push(&h, BUFFER, &np);
-       assert(np == buflen);
-       np = 0;
-       ret = ctdb_event_header_pull(BUFFER, buflen, mem_ctx, &h2, &np);
-       assert(ret == 0);
-       assert(np == buflen);
-
-       verify_ctdb_event_header(&h, &h2);
-
-       talloc_free(mem_ctx);
-}
-
 #define NUM_COMMANDS   5
 
 PROTOCOL_TYPE3_TEST(struct ctdb_event_request_run, ctdb_event_request_run);
@@ -157,8 +128,6 @@ int main(int argc, char *argv[])
        TEST_FUNC(ctdb_event_reply_status)();
        TEST_FUNC(ctdb_event_reply_script_list)();
 
-       test_ctdb_event_header();
-
        for (command=1; command<=NUM_COMMANDS; command++) {
                TEST_FUNC(ctdb_event_request_data)(command);
        }