ctdb-build: Split protocol-util as a separate subsystem
authorMartin Schwenke <martin@meltin.net>
Mon, 4 Sep 2017 06:00:48 +0000 (16:00 +1000)
committerMartin Schwenke <martins@samba.org>
Tue, 19 Sep 2017 11:30:26 +0000 (13:30 +0200)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
15 files changed:
ctdb/protocol/protocol_api.h
ctdb/protocol/protocol_util.c
ctdb/protocol/protocol_util.h [new file with mode: 0644]
ctdb/server/ctdb_eventd.c
ctdb/server/ctdb_takeover_helper.c
ctdb/server/ipalloc.c
ctdb/server/ipalloc_common.c
ctdb/server/ipalloc_lcp2.c
ctdb/server/ipalloc_nondeterministic.c
ctdb/tests/src/ctdb_takeover_tests.c
ctdb/tests/src/fake_ctdbd.c
ctdb/tools/ctdb.c
ctdb/tools/ctdb_event.c
ctdb/tools/ctdb_killtcp.c
ctdb/wscript

index d165ba25ade3df5897fda5b26057a9b7b4bef70d..67f32a0b8cc875ed3cf12d0772b6309191f993e9 100644 (file)
@@ -678,22 +678,4 @@ void sock_packet_header_set_reqid(struct sock_packet_header *h,
 void sock_packet_header_set_length(struct sock_packet_header *h,
                                   uint32_t length);
 
-/* From protocol/protocol_util.c */
-
-const char *ctdb_runstate_to_string(enum ctdb_runstate runstate);
-enum ctdb_runstate ctdb_runstate_from_string(const char *runstate_str);
-
-const char *ctdb_event_to_string(enum ctdb_event event);
-enum ctdb_event ctdb_event_from_string(const char *event_str);
-
-const char *ctdb_sock_addr_to_string(TALLOC_CTX *mem_ctx, ctdb_sock_addr *addr);
-int ctdb_sock_addr_cmp_ip(const ctdb_sock_addr *addr1,
-                         const ctdb_sock_addr *addr2);
-int ctdb_sock_addr_cmp(const ctdb_sock_addr *addr1,
-                      const ctdb_sock_addr *addr2);
-bool ctdb_sock_addr_same_ip(const ctdb_sock_addr *addr1,
-                           const ctdb_sock_addr *addr2);
-bool ctdb_sock_addr_same(const ctdb_sock_addr *addr1,
-                        const ctdb_sock_addr *addr2);
-
 #endif /* __CTDB_PROTOCOL_API_H__ */
index 0e1bf286799f117c3276bd974baf183dc8cb85f0..3b039446af3623ba758c9d913a5dc9df0796f7e1 100644 (file)
 #include "system/network.h"
 
 #include <talloc.h>
-#include <tdb.h>
 
 #include "protocol.h"
-#include "protocol_private.h"
-#include "protocol_api.h"
+#include "protocol_util.h"
 
 static struct {
        enum ctdb_runstate runstate;
diff --git a/ctdb/protocol/protocol_util.h b/ctdb/protocol/protocol_util.h
new file mode 100644 (file)
index 0000000..9477881
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+   CTDB protocol marshalling
+
+   Copyright (C) Amitay Isaacs  2015
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __CTDB_PROTOCOL_UTIL_H__
+#define __CTDB_PROTOCOL_UTIL_H__
+
+#include <talloc.h>
+
+#include "protocol/protocol.h"
+
+const char *ctdb_runstate_to_string(enum ctdb_runstate runstate);
+enum ctdb_runstate ctdb_runstate_from_string(const char *runstate_str);
+
+const char *ctdb_event_to_string(enum ctdb_event event);
+enum ctdb_event ctdb_event_from_string(const char *event_str);
+
+const char *ctdb_sock_addr_to_string(TALLOC_CTX *mem_ctx, ctdb_sock_addr *addr);
+int ctdb_sock_addr_cmp_ip(const ctdb_sock_addr *addr1,
+                         const ctdb_sock_addr *addr2);
+int ctdb_sock_addr_cmp(const ctdb_sock_addr *addr1,
+                      const ctdb_sock_addr *addr2);
+bool ctdb_sock_addr_same_ip(const ctdb_sock_addr *addr1,
+                           const ctdb_sock_addr *addr2);
+bool ctdb_sock_addr_same(const ctdb_sock_addr *addr1,
+                        const ctdb_sock_addr *addr2);
+
+#endif /* __CTDB_PROTOCOL_UTIL_H__ */
index 68ba2761b4299b8849031792468c7e6a269d4b4b..1a6c69c00eabd507cfa2aa22db554ee7a9fe7ec9 100644 (file)
@@ -35,6 +35,7 @@
 #include "lib/async_req/async_sock.h"
 
 #include "protocol/protocol_api.h"
+#include "protocol/protocol_util.h"
 
 #include "common/comm.h"
 #include "common/logging.h"
index 5efd61983940bcd56e26f64c4c83a71b43b3fd4d..41d4d1c886b330562590bdd04a3772c38ed85db0 100644 (file)
@@ -42,6 +42,7 @@
 
 #include "protocol/protocol.h"
 #include "protocol/protocol_api.h"
+#include "protocol/protocol_util.h"
 #include "client/client.h"
 
 #include "common/logging.h"
index 5dffb0d72164c4e1e704301c2245a298fade4bf1..caa50224156eb7a1b8eea5c6e03102c6a7d6fee8 100644 (file)
@@ -29,7 +29,7 @@
 #include "common/logging.h"
 #include "common/rb_tree.h"
 
-#include "protocol/protocol_api.h"
+#include "protocol/protocol_util.h"
 
 #include "server/ipalloc_private.h"
 
index 50bb59a593706221a7f2570a17f58bf2b3a41fbe..9d5cd03e6be7e87b6cf6c0004b2d4a18db9848ff 100644 (file)
@@ -32,7 +32,7 @@
 #include "common/common.h"
 #include "common/rb_tree.h"
 
-#include "protocol/protocol_api.h"
+#include "protocol/protocol_util.h"
 
 #include "server/ipalloc_private.h"
 
index 48e0d0218e84bc0d7663c557a27faf4037b741b9..715041f4b91a26045717ce13eaa318e359209954 100644 (file)
@@ -25,7 +25,7 @@
 #include "lib/util/debug.h"
 #include "common/logging.h"
 
-#include "protocol/protocol_api.h"
+#include "protocol/protocol_util.h"
 
 #include "server/ipalloc_private.h"
 
index bb5f8faf9c85dc17d328764c2b07b0a23dbc1607..46001dcafd2a02143539db2c5519435da2e31e31 100644 (file)
@@ -28,7 +28,7 @@
 #include "common/logging.h"
 #include "common/common.h"
 
-#include "protocol/protocol_api.h"
+#include "protocol/protocol_util.h"
 
 #include "server/ipalloc_private.h"
 
index 5093757adc3ff048dc2c91000388abd2eaf88005..0fae679bd38fe28e2a02d1ea4f7784b8f82c342d 100644 (file)
@@ -26,7 +26,7 @@
 #include "lib/util/debug.h"
 
 #include "protocol/protocol.h"
-#include "protocol/protocol_api.h"
+#include "protocol/protocol_util.h"
 #include "common/logging.h"
 #include "common/system.h"
 
index 57783f7fd7b5111cffd63185ee53a6bd8245e29c..48440f2c1d1ca413cb46d91a32c44e061cfc4593 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "protocol/protocol.h"
 #include "protocol/protocol_api.h"
+#include "protocol/protocol_util.h"
 
 #include "common/comm.h"
 #include "common/system.h"
index 60d7a172b2d367b77141c49d8fefc0ffec9392f7..23960c3218feb1d8a8bd848578e72d6991ecda07 100644 (file)
@@ -39,6 +39,7 @@
 #include "common/logging.h"
 #include "protocol/protocol.h"
 #include "protocol/protocol_api.h"
+#include "protocol/protocol_util.h"
 #include "common/system.h"
 #include "client/client.h"
 #include "client/client_sync.h"
index 07bc73bc9e7f30f146958d476ab23764cce43554..ee2c25bc1e0b3d7062745e96114cd9189947e826 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "lib/util/debug.h"
 
-#include "protocol/protocol_api.h"
+#include "protocol/protocol_util.h"
 #include "client/client_event.h"
 #include "common/logging.h"
 
index 5db7ec7853bb0c15625619b36133fb37883d8ec0..39f1aaf899729143a78944dba5101bc598780dc7 100644 (file)
@@ -26,7 +26,7 @@
 #include "lib/util/debug.h"
 
 #include "protocol/protocol.h"
-#include "protocol/protocol_api.h"
+#include "protocol/protocol_util.h"
 
 #include "common/rb_tree.h"
 #include "common/system.h"
index 505f2e58bcb4cd6363709f8975608720315eb418..2679c56db3064a5c4ae1ef5cebfce280483194bd 100644 (file)
@@ -400,12 +400,15 @@ def build(bld):
                                              protocol_keepalive.c
                                              protocol_client.c
                                              protocol_debug.c
-                                             protocol_util.c
                                              protocol_event.c
                                              protocol_sock.c'''),
                         includes='include',
                         deps='replace talloc tdb')
 
+    bld.SAMBA_SUBSYSTEM('ctdb-protocol-util',
+                        source='protocol/protocol_util.c',
+                        deps='replace talloc tdb')
+
     bld.SAMBA_SUBSYSTEM('ctdb-client',
                         source=bld.SUBDIR('client', 'ctdb_client.c'),
                         includes='include',
@@ -439,7 +442,7 @@ def build(bld):
                                              ipalloc.c
                                           '''),
                         includes='include',
-                        deps='ctdb-protocol replace talloc tevent')
+                        deps='ctdb-protocol-util replace talloc tevent')
 
     bld.SAMBA_BINARY('ctdbd',
                      source='server/ctdbd.c ' +
@@ -469,21 +472,21 @@ def build(bld):
 
     bld.SAMBA_BINARY('ctdb',
                      source='tools/ctdb.c',
-                     deps='''ctdb-client2 ctdb-protocol ctdb-util ctdb-system
-                             samba-util sys_rw popt''',
+                     deps='''ctdb-client2 ctdb-protocol ctdb-protocol-util
+                             ctdb-util ctdb-system samba-util sys_rw popt''',
                      install_path='${BINDIR}',
                      manpages='ctdb.1')
 
     bld.SAMBA_BINARY('ctdb_killtcp',
                      source='tools/ctdb_killtcp.c',
-                     deps='''ctdb-protocol ctdb-util ctdb-system
+                     deps='''ctdb-protocol-util ctdb-util ctdb-system
                              samba-util replace''',
                      install_path='${CTDB_HELPER_BINDIR}')
 
     bld.SAMBA_BINARY('ctdb_event',
                      source='tools/ctdb_event.c',
-                     deps='''ctdb-client2 ctdb-protocol ctdb-util ctdb-system
-                             samba-util replace''',
+                     deps='''ctdb-client2 ctdb-protocol ctdb-protocol-util
+                             ctdb-util ctdb-system samba-util replace''',
                      install_path='${CTDB_HELPER_BINDIR}')
 
     bld.SAMBA_BINARY('ltdbtool',
@@ -495,8 +498,8 @@ def build(bld):
 
     bld.SAMBA_BINARY('ctdb_eventd',
                      source='server/ctdb_eventd.c',
-                     deps='''ctdb-server-util ctdb-protocol ctdb-util
-                             samba-util LIBASYNC_REQ replace popt''',
+                     deps='''ctdb-server-util ctdb-protocol ctdb-protocol-util
+                             ctdb-util samba-util LIBASYNC_REQ replace popt''',
                      install_path='${CTDB_HELPER_BINDIR}')
 
     bld.SAMBA_BINARY('ctdb_lock_helper',
@@ -840,8 +843,9 @@ def build(bld):
     bld.SAMBA_BINARY('fake_ctdbd',
                      source='''tests/src/fake_ctdbd.c
                                tests/src/ipalloc_read_known_ips.c''',
-                     deps='''ctdb-util ctdb-protocol ctdb-system
-                             samba-util tevent-util LIBASYNC_REQ popt''',
+                     deps='''ctdb-util ctdb-protocol ctdb-protocol-util
+                             ctdb-system samba-util tevent-util
+                             LIBASYNC_REQ popt''',
                      install_path='${CTDB_TEST_LIBEXECDIR}')
 
     if bld.env.HAVE_INFINIBAND: