1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

ctdb-build: Split protocol-util as a separate subsystem

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2017-09-04 16:00:48 +10:00 committed by Martin Schwenke
parent 2550a88e2f
commit 3783b66fb3
15 changed files with 70 additions and 39 deletions

View 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, void sock_packet_header_set_length(struct sock_packet_header *h,
uint32_t length); 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__ */ #endif /* __CTDB_PROTOCOL_API_H__ */

View File

@ -21,11 +21,9 @@
#include "system/network.h" #include "system/network.h"
#include <talloc.h> #include <talloc.h>
#include <tdb.h>
#include "protocol.h" #include "protocol.h"
#include "protocol_private.h" #include "protocol_util.h"
#include "protocol_api.h"
static struct { static struct {
enum ctdb_runstate runstate; enum ctdb_runstate runstate;

View File

@ -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__ */

View File

@ -35,6 +35,7 @@
#include "lib/async_req/async_sock.h" #include "lib/async_req/async_sock.h"
#include "protocol/protocol_api.h" #include "protocol/protocol_api.h"
#include "protocol/protocol_util.h"
#include "common/comm.h" #include "common/comm.h"
#include "common/logging.h" #include "common/logging.h"

View File

@ -42,6 +42,7 @@
#include "protocol/protocol.h" #include "protocol/protocol.h"
#include "protocol/protocol_api.h" #include "protocol/protocol_api.h"
#include "protocol/protocol_util.h"
#include "client/client.h" #include "client/client.h"
#include "common/logging.h" #include "common/logging.h"

View File

@ -29,7 +29,7 @@
#include "common/logging.h" #include "common/logging.h"
#include "common/rb_tree.h" #include "common/rb_tree.h"
#include "protocol/protocol_api.h" #include "protocol/protocol_util.h"
#include "server/ipalloc_private.h" #include "server/ipalloc_private.h"

View File

@ -32,7 +32,7 @@
#include "common/common.h" #include "common/common.h"
#include "common/rb_tree.h" #include "common/rb_tree.h"
#include "protocol/protocol_api.h" #include "protocol/protocol_util.h"
#include "server/ipalloc_private.h" #include "server/ipalloc_private.h"

View File

@ -25,7 +25,7 @@
#include "lib/util/debug.h" #include "lib/util/debug.h"
#include "common/logging.h" #include "common/logging.h"
#include "protocol/protocol_api.h" #include "protocol/protocol_util.h"
#include "server/ipalloc_private.h" #include "server/ipalloc_private.h"

View File

@ -28,7 +28,7 @@
#include "common/logging.h" #include "common/logging.h"
#include "common/common.h" #include "common/common.h"
#include "protocol/protocol_api.h" #include "protocol/protocol_util.h"
#include "server/ipalloc_private.h" #include "server/ipalloc_private.h"

View File

@ -26,7 +26,7 @@
#include "lib/util/debug.h" #include "lib/util/debug.h"
#include "protocol/protocol.h" #include "protocol/protocol.h"
#include "protocol/protocol_api.h" #include "protocol/protocol_util.h"
#include "common/logging.h" #include "common/logging.h"
#include "common/system.h" #include "common/system.h"

View File

@ -34,6 +34,7 @@
#include "protocol/protocol.h" #include "protocol/protocol.h"
#include "protocol/protocol_api.h" #include "protocol/protocol_api.h"
#include "protocol/protocol_util.h"
#include "common/comm.h" #include "common/comm.h"
#include "common/system.h" #include "common/system.h"

View File

@ -39,6 +39,7 @@
#include "common/logging.h" #include "common/logging.h"
#include "protocol/protocol.h" #include "protocol/protocol.h"
#include "protocol/protocol_api.h" #include "protocol/protocol_api.h"
#include "protocol/protocol_util.h"
#include "common/system.h" #include "common/system.h"
#include "client/client.h" #include "client/client.h"
#include "client/client_sync.h" #include "client/client_sync.h"

View File

@ -26,7 +26,7 @@
#include "lib/util/debug.h" #include "lib/util/debug.h"
#include "protocol/protocol_api.h" #include "protocol/protocol_util.h"
#include "client/client_event.h" #include "client/client_event.h"
#include "common/logging.h" #include "common/logging.h"

View File

@ -26,7 +26,7 @@
#include "lib/util/debug.h" #include "lib/util/debug.h"
#include "protocol/protocol.h" #include "protocol/protocol.h"
#include "protocol/protocol_api.h" #include "protocol/protocol_util.h"
#include "common/rb_tree.h" #include "common/rb_tree.h"
#include "common/system.h" #include "common/system.h"

View File

@ -400,12 +400,15 @@ def build(bld):
protocol_keepalive.c protocol_keepalive.c
protocol_client.c protocol_client.c
protocol_debug.c protocol_debug.c
protocol_util.c
protocol_event.c protocol_event.c
protocol_sock.c'''), protocol_sock.c'''),
includes='include', includes='include',
deps='replace talloc tdb') deps='replace talloc tdb')
bld.SAMBA_SUBSYSTEM('ctdb-protocol-util',
source='protocol/protocol_util.c',
deps='replace talloc tdb')
bld.SAMBA_SUBSYSTEM('ctdb-client', bld.SAMBA_SUBSYSTEM('ctdb-client',
source=bld.SUBDIR('client', 'ctdb_client.c'), source=bld.SUBDIR('client', 'ctdb_client.c'),
includes='include', includes='include',
@ -439,7 +442,7 @@ def build(bld):
ipalloc.c ipalloc.c
'''), '''),
includes='include', includes='include',
deps='ctdb-protocol replace talloc tevent') deps='ctdb-protocol-util replace talloc tevent')
bld.SAMBA_BINARY('ctdbd', bld.SAMBA_BINARY('ctdbd',
source='server/ctdbd.c ' + source='server/ctdbd.c ' +
@ -469,21 +472,21 @@ def build(bld):
bld.SAMBA_BINARY('ctdb', bld.SAMBA_BINARY('ctdb',
source='tools/ctdb.c', source='tools/ctdb.c',
deps='''ctdb-client2 ctdb-protocol ctdb-util ctdb-system deps='''ctdb-client2 ctdb-protocol ctdb-protocol-util
samba-util sys_rw popt''', ctdb-util ctdb-system samba-util sys_rw popt''',
install_path='${BINDIR}', install_path='${BINDIR}',
manpages='ctdb.1') manpages='ctdb.1')
bld.SAMBA_BINARY('ctdb_killtcp', bld.SAMBA_BINARY('ctdb_killtcp',
source='tools/ctdb_killtcp.c', source='tools/ctdb_killtcp.c',
deps='''ctdb-protocol ctdb-util ctdb-system deps='''ctdb-protocol-util ctdb-util ctdb-system
samba-util replace''', samba-util replace''',
install_path='${CTDB_HELPER_BINDIR}') install_path='${CTDB_HELPER_BINDIR}')
bld.SAMBA_BINARY('ctdb_event', bld.SAMBA_BINARY('ctdb_event',
source='tools/ctdb_event.c', source='tools/ctdb_event.c',
deps='''ctdb-client2 ctdb-protocol ctdb-util ctdb-system deps='''ctdb-client2 ctdb-protocol ctdb-protocol-util
samba-util replace''', ctdb-util ctdb-system samba-util replace''',
install_path='${CTDB_HELPER_BINDIR}') install_path='${CTDB_HELPER_BINDIR}')
bld.SAMBA_BINARY('ltdbtool', bld.SAMBA_BINARY('ltdbtool',
@ -495,8 +498,8 @@ def build(bld):
bld.SAMBA_BINARY('ctdb_eventd', bld.SAMBA_BINARY('ctdb_eventd',
source='server/ctdb_eventd.c', source='server/ctdb_eventd.c',
deps='''ctdb-server-util ctdb-protocol ctdb-util deps='''ctdb-server-util ctdb-protocol ctdb-protocol-util
samba-util LIBASYNC_REQ replace popt''', ctdb-util samba-util LIBASYNC_REQ replace popt''',
install_path='${CTDB_HELPER_BINDIR}') install_path='${CTDB_HELPER_BINDIR}')
bld.SAMBA_BINARY('ctdb_lock_helper', bld.SAMBA_BINARY('ctdb_lock_helper',
@ -840,8 +843,9 @@ def build(bld):
bld.SAMBA_BINARY('fake_ctdbd', bld.SAMBA_BINARY('fake_ctdbd',
source='''tests/src/fake_ctdbd.c source='''tests/src/fake_ctdbd.c
tests/src/ipalloc_read_known_ips.c''', tests/src/ipalloc_read_known_ips.c''',
deps='''ctdb-util ctdb-protocol ctdb-system deps='''ctdb-util ctdb-protocol ctdb-protocol-util
samba-util tevent-util LIBASYNC_REQ popt''', ctdb-system samba-util tevent-util
LIBASYNC_REQ popt''',
install_path='${CTDB_TEST_LIBEXECDIR}') install_path='${CTDB_TEST_LIBEXECDIR}')
if bld.env.HAVE_INFINIBAND: if bld.env.HAVE_INFINIBAND: