ctdb-common: Rename system utility files
authorMartin Schwenke <martin@meltin.net>
Thu, 28 Jun 2018 10:15:37 +0000 (20:15 +1000)
committerMartin Schwenke <martins@samba.org>
Mon, 2 Jul 2018 06:51:20 +0000 (08:51 +0200)
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 <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
13 files changed:
ctdb/common/system.c [moved from ctdb/common/system_util.c with 100% similarity]
ctdb/common/system.h
ctdb/common/system_aix.c
ctdb/common/system_freebsd.c
ctdb/common/system_gnu.c
ctdb/common/system_kfreebsd.c
ctdb/common/system_linux.c
ctdb/common/system_socket.c [moved from ctdb/common/system_common.c with 90% similarity]
ctdb/common/system_socket.h [new file with mode: 0644]
ctdb/server/ctdb_recoverd.c
ctdb/server/ctdb_takeover.c
ctdb/tools/ctdb.c
ctdb/wscript

index 5865a1a690edd0821b1821883b098e808cb7197c..6a3ef29104cab623e7ad95f54ab0ed0c789bc0b8 100644 (file)
 
 #include <talloc.h>
 
-/* 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_<os>.c */
 
 int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface);
index f0a0a62efc099b2696d54f29a8ccf98daf203306..f4c5c70014190b535e0d2e6a5f256bdfb69bb6f5 100644 (file)
@@ -38,6 +38,7 @@
 
 #include "common/logging.h"
 #include "common/system.h"
+#include "common/system_socket.h"
 
 
 #if 0
index b709a5c75c14113cf5b93f2ece9e5aeaaa0c8411..5614e1014d803a007e20df0f76487b316978b294 100644 (file)
@@ -41,6 +41,7 @@
 
 #include "common/logging.h"
 #include "common/system.h"
+#include "common/system_socket.h"
 
 #ifndef ETHERTYPE_IP6
 #define ETHERTYPE_IP6 0x86dd
index 38ccd13988bcd599868a24869093138d9e586140..27339d18c3e4d1ef4ee6a6a44c77fe27b5a6258d 100644 (file)
@@ -40,6 +40,7 @@
 
 #include "common/logging.h"
 #include "common/system.h"
+#include "common/system_socket.h"
 
 #ifndef ETHERTYPE_IP6
 #define ETHERTYPE_IP6 0x86dd
index d02f28659cbe680ab176f023fb80b3a1e0ec86a7..67c2aa060434c2e6a183379c38bba4f072c46d44 100644 (file)
@@ -40,6 +40,7 @@
 
 #include "common/logging.h"
 #include "common/system.h"
+#include "common/system_socket.h"
 
 #ifndef ETHERTYPE_IP6
 #define ETHERTYPE_IP6 0x86dd
index fa77a45460f854c1ca84d69d9bca1b47cfbf7d63..d8f53ea8ea05b46ba6325d8de0f5fd2a12080efb 100644 (file)
@@ -37,6 +37,7 @@
 
 #include "common/logging.h"
 #include "common/system.h"
+#include "common/system_socket.h"
 
 #ifndef ETHERTYPE_IP6
 #define ETHERTYPE_IP6 0x86dd
similarity index 90%
rename from ctdb/common/system_common.c
rename to ctdb/common/system_socket.c
index 49afbf34469085c3a8815b894445dd0fd454777f..b2af6582c97ffdad209e94bc9620f2d22659d10d 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>.
 */
@@ -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 (file)
index 0000000..aaa7f16
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+*/
+
+#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__ */
index 2b94fed7478d5736401d79f79ccf2b338c8826c9..507cba73283ec2da9ad412bed2558ba01f15284f 100644 (file)
@@ -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"
 
index a1567b3a5ecced74cfc27443d922498440b068b9..a4f0358f15007438a988b84f18ee0493287919b1 100644 (file)
@@ -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"
 
index e6c37642b956b0c70a9e6c386e21850ef205ffd9..981293554b06c5018116c87ebac6a50f1044fc15 100644 (file)
@@ -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"
 
index 85cf495023b14095a3233d7a59bf05445f42b013..ec828389c9e7dc8c925e315b4b4d90ac1a49869f 100644 (file)
@@ -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')