From: Martin Schwenke Date: Thu, 28 Jun 2018 10:15:37 +0000 (+1000) Subject: ctdb-common: Rename system utility files X-Git-Tag: tevent-0.9.37~183 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=57834c64bef96d67dabe1ce22ced67e6544b8035;p=thirdparty%2Fsamba.git ctdb-common: Rename system utility files system_socket.[ch] will contain all the raw socket code and other functions that use ctdb_sock_addr. system.[ch] will contain other platform dependent functions. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/common/system_util.c b/ctdb/common/system.c similarity index 100% rename from ctdb/common/system_util.c rename to ctdb/common/system.c diff --git a/ctdb/common/system.h b/ctdb/common/system.h index 5865a1a690e..6a3ef29104c 100644 --- a/ctdb/common/system.h +++ b/ctdb/common/system.h @@ -22,11 +22,6 @@ #include -/* From system_common.c */ - -uint32_t uint16_checksum(uint16_t *data, size_t n); -bool ctdb_sys_have_ip(ctdb_sock_addr *_addr); - /* From system_.c */ int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface); diff --git a/ctdb/common/system_aix.c b/ctdb/common/system_aix.c index f0a0a62efc0..f4c5c700141 100644 --- a/ctdb/common/system_aix.c +++ b/ctdb/common/system_aix.c @@ -38,6 +38,7 @@ #include "common/logging.h" #include "common/system.h" +#include "common/system_socket.h" #if 0 diff --git a/ctdb/common/system_freebsd.c b/ctdb/common/system_freebsd.c index b709a5c75c1..5614e1014d8 100644 --- a/ctdb/common/system_freebsd.c +++ b/ctdb/common/system_freebsd.c @@ -41,6 +41,7 @@ #include "common/logging.h" #include "common/system.h" +#include "common/system_socket.h" #ifndef ETHERTYPE_IP6 #define ETHERTYPE_IP6 0x86dd diff --git a/ctdb/common/system_gnu.c b/ctdb/common/system_gnu.c index 38ccd13988b..27339d18c3e 100644 --- a/ctdb/common/system_gnu.c +++ b/ctdb/common/system_gnu.c @@ -40,6 +40,7 @@ #include "common/logging.h" #include "common/system.h" +#include "common/system_socket.h" #ifndef ETHERTYPE_IP6 #define ETHERTYPE_IP6 0x86dd diff --git a/ctdb/common/system_kfreebsd.c b/ctdb/common/system_kfreebsd.c index d02f28659cb..67c2aa06043 100644 --- a/ctdb/common/system_kfreebsd.c +++ b/ctdb/common/system_kfreebsd.c @@ -40,6 +40,7 @@ #include "common/logging.h" #include "common/system.h" +#include "common/system_socket.h" #ifndef ETHERTYPE_IP6 #define ETHERTYPE_IP6 0x86dd diff --git a/ctdb/common/system_linux.c b/ctdb/common/system_linux.c index fa77a45460f..d8f53ea8ea0 100644 --- a/ctdb/common/system_linux.c +++ b/ctdb/common/system_linux.c @@ -37,6 +37,7 @@ #include "common/logging.h" #include "common/system.h" +#include "common/system_socket.h" #ifndef ETHERTYPE_IP6 #define ETHERTYPE_IP6 0x86dd diff --git a/ctdb/common/system_common.c b/ctdb/common/system_socket.c similarity index 90% rename from ctdb/common/system_common.c rename to ctdb/common/system_socket.c index 49afbf34469..b2af6582c97 100644 --- a/ctdb/common/system_common.c +++ b/ctdb/common/system_socket.c @@ -1,4 +1,4 @@ -/* +/* ctdb system specific code to manage raw sockets on linux Copyright (C) Ronnie Sahlberg 2007 @@ -8,12 +8,12 @@ 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 . */ @@ -26,7 +26,7 @@ #include "protocol/protocol.h" #include "common/logging.h" -#include "common/system.h" +#include "common/system_socket.h" /* uint16 checksum for n bytes @@ -45,11 +45,9 @@ uint32_t uint16_checksum(uint16_t *data, size_t n) return sum; } -/* - see if we currently have an interface with the given IP - we try to bind to it, and if that fails then we don't have that IP - on an interface +/* + * See if the given IP is currently on an interface */ bool ctdb_sys_have_ip(ctdb_sock_addr *_addr) { diff --git a/ctdb/common/system_socket.h b/ctdb/common/system_socket.h new file mode 100644 index 00000000000..aaa7f16e993 --- /dev/null +++ b/ctdb/common/system_socket.h @@ -0,0 +1,28 @@ +/* + System specific network code + + 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 . +*/ + +#ifndef __CTDB_SYSTEM_SOCKET_H__ +#define __CTDB_SYSTEM_SOCKET_H__ + +#include "protocol/protocol.h" + +uint32_t uint16_checksum(uint16_t *data, size_t n); +bool ctdb_sys_have_ip(ctdb_sock_addr *addr); + +#endif /* __CTDB_SYSTEM_SOCKET_H__ */ diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index 2b94fed7478..507cba73283 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -38,7 +38,7 @@ #include "ctdb_private.h" #include "ctdb_client.h" -#include "common/system.h" +#include "common/system_socket.h" #include "common/common.h" #include "common/logging.h" diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index a1567b3a5ec..a4f0358f150 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -39,6 +39,7 @@ #include "common/rb_tree.h" #include "common/reqid.h" #include "common/system.h" +#include "common/system_socket.h" #include "common/common.h" #include "common/logging.h" diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index e6c37642b95..981293554b0 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -41,6 +41,7 @@ #include "protocol/protocol_api.h" #include "protocol/protocol_util.h" #include "common/system.h" +#include "common/system_socket.h" #include "client/client.h" #include "client/client_sync.h" diff --git a/ctdb/wscript b/ctdb/wscript index 85cf495023b..ec828389c9e 100644 --- a/ctdb/wscript +++ b/ctdb/wscript @@ -395,7 +395,7 @@ def build(bld): bld.SAMBA_SUBSYSTEM('ctdb-system', source=bld.SUBDIR('common', - 'system_common.c system_util.c') + + 'system_socket.c system.c') + CTDB_SYSTEM_SRC, includes='include', deps='replace talloc tevent tdb pcap samba-util')