The branch, master has been updated via 5629cfc ctdb-util: Make tdb_wrap self-sufficient - it doesn't need includes.h via 86430d5 ctdb-build: Tests don't include lib/util/*.c, link ctdb-util instead via 9c69a71 ctdb-build: Drop lib/util from includes via acf2608 ctdb-util: Rename db_wrap to tdb_wrap and make it a build subsystem via 088e4ab ctdb-build: Make ctdb-util a wscript build subsystem via 8b39141 ctdb-logging: Move variable debug_extra from debug.* via 97dc127 ctdb-logging: Factor out ctdb_logging.h from includes.h via 01598ce ctdb-build: Add extra includes to help recursive utility compilation via 0c0f323 ctdb-recoverd: Change include of dlinklist.h to contain directory via 6e15681 ctdb-tools: Move definition of timeval_delta() to tools/ctdb.c via c5c74e4 ctdb-daemon: Drop the argument to fault_setup() via a4e76b5 ctdb-util: Add extra max_size argument to file_lines_load() via b831829 ctdb-client: Rename static function server_id_equal() via cd2b166 ctdb-util: Remove declaration of non-existent ctdb_fault_setup() via 94a5e28 ctdb-common: Move hex_decode_talloc() to the lock helper via f031d5b ctdb-build: Fix includes for SAMBA_BINARY()s via 05f08d5 ctdb-build: Don't try to set lib64 directory automatically in build via 4cb92e4 ctdb-build: Make ctdb-client depend on ctdb-util and ctdb-util-misc via ef72188 ctdb-build: Allow configure and Makefile to find waf in tarball via 751ad4b ctdb-common: Add some missing #includes via a81dccf ctdb-daemon: Move some inline declarations to header file via 6336b95 ctdb-tests: Add missing declarations caused by #define magic via 6674949 ctdb-tests: Mark some functions as static via 5de4a97 ctdb-util: Remove util/strlist.c and references to str_util_*() via b0f9d33 ctdb: Fix some "declarations after code" problems via 1d16555 ctdb-util: Variables should be declared extern in headers from 210c647 docs-xml: Bump version up to 4.2.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 5629cfcd2e62bedbcbe35d33c83123cf0cd72fb7 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Sep 9 12:58:13 2014 +1000 ctdb-util: Make tdb_wrap self-sufficient - it doesn't need includes.h It should use finer grained includes like replace.h and ctdb_logging.h. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> Autobuild-User(master): Amitay Isaacs <ami...@samba.org> Autobuild-Date(master): Wed Sep 10 04:03:20 CEST 2014 on sn-devel-104 commit 86430d528bbb1d8ddb6de57c7a35e15b31977498 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Aug 15 16:15:37 2014 +1000 ctdb-build: Tests don't include lib/util/*.c, link ctdb-util instead Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 9c69a71740f93bacc4e69b45fec8f432242e5e24 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Aug 19 13:27:33 2014 +1000 ctdb-build: Drop lib/util from includes In is unnecessary and can accidentally cause lib/util/time.h to be found instead of /usr/include/time.h. The only things depending on it were bare includes of db_wrap.h and a bare include of dlinklist.h, which are both gone now. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit acf26089f18c163290a0540ece1209aea26834d5 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Aug 15 15:46:33 2014 +1000 ctdb-util: Rename db_wrap to tdb_wrap and make it a build subsystem This makes it consistent with Samba, to ease transition. Update unit test code to link to with tdb_wrap instead of including db_wrap.c. There are some potential whitespace fixes in this commit that have been ignored. CTDB's lib/tdb_wrap will be deleted after the transition to Samba's lib/tdb_wrap, so there's no point polishing it too much. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 088e4ab3ac22112a11cb685bb048bf49bf55c592 Author: Martin Schwenke <mar...@meltin.net> Date: Sun Aug 17 14:29:32 2014 +1000 ctdb-build: Make ctdb-util a wscript build subsystem This makes it look similar to samba-util, easing the transition. Fold ctdb-util-misc into ctdb-util, since Samba doesn't separate them. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 8b39141c46458974d5476b2925f2dd5d51d9180d Author: Martin Schwenke <mar...@meltin.net> Date: Sat Aug 16 16:17:02 2014 +1000 ctdb-logging: Move variable debug_extra from debug.* debug_extra is CTDB-specific. Moving it will help with the transitions to Samba's updated debug.[ch]. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 97dc127b81c1923755b59aad6e735aa679af3f64 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Sep 9 13:52:07 2014 +1000 ctdb-logging: Factor out ctdb_logging.h from includes.h Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 01598ce18d7980a3aa13314e943a5d82bdcbd672 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Sep 4 11:37:15 2014 +1000 ctdb-build: Add extra includes to help recursive utility compilation Subsequent commits will introduce recursive compilation of utilities. Unfortunately the include file structure requires some global includes to be found, so make this work. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 0c0f323bb3e9146dc584a461b225586670fa9c2e Author: Martin Schwenke <mar...@meltin.net> Date: Fri Aug 15 16:18:05 2014 +1000 ctdb-recoverd: Change include of dlinklist.h to contain directory This makes it consistent with the rest of the code and avoids problems when some variant of lib/util isn't in the include path. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 6e1568149ede06d48b91bbc7ecd8c55da3b41a41 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Aug 15 15:53:03 2014 +1000 ctdb-tools: Move definition of timeval_delta() to tools/ctdb.c This function is only used in this file. Samba's lib/util doesn't have timeval_delta(), so staging a clean transition. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit c5c74e47ee672e9e9605c5c4b96733d899b6f9b6 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Aug 15 15:55:20 2014 +1000 ctdb-daemon: Drop the argument to fault_setup() Samba's version doesn't accept an argument, so this aids a smooth transition. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit a4e76b58a5086e1339dea53b72437ed179e6025a Author: Martin Schwenke <mar...@meltin.net> Date: Fri Aug 15 16:11:45 2014 +1000 ctdb-util: Add extra max_size argument to file_lines_load() This is part of a migration to Samba's lib/util. CTDB always passes 0 (i.e. no max_size) so use a simple assert() to enforce this, rather than changing a lot of code that will be discarded anyway. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit b831829cedefd7fb614b8631cc25339a00192ec1 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Aug 15 16:12:43 2014 +1000 ctdb-client: Rename static function server_id_equal() Otherwise it conflicts with the same function provided by Samba's lib/util. Using the Samba one drags in too many dependencies, so rename the CTDB version to avoid a declaration clash when CTDB starts including samba_util.h. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit cd2b1662a65627ec90f71f0f6f708fe88bb7cf58 Author: Martin Schwenke <mar...@meltin.net> Date: Sat Aug 16 16:43:23 2014 +1000 ctdb-util: Remove declaration of non-existent ctdb_fault_setup() Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 94a5e28ffb53a268865666038678e78cbbb39de3 Author: Martin Schwenke <mar...@meltin.net> Date: Wed Aug 6 16:36:58 2014 +1000 ctdb-common: Move hex_decode_talloc() to the lock helper This is the only place it is used. After migrating to Samba's lib/util, the lock helper can be changed to use strhex_to_data_blob(). Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit f031d5b43fb272fbccc570dd174536c55e78ad47 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Aug 25 14:00:45 2014 +1000 ctdb-build: Fix includes for SAMBA_BINARY()s No need for "..", since the correct thing is generated. Add "include" and "include/internal" where missing. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 05f08d5148e4df8c5bed13023824f030efebf26e Author: Martin Schwenke <mar...@meltin.net> Date: Tue Sep 2 16:18:01 2014 +1000 ctdb-build: Don't try to set lib64 directory automatically in build Just install into lib/ and let packagers decide on this policy, since it can vary between distributions. Update our packaging files accordingly. A secondary matter is that things are incorrectly installed into lib64/ when building with 32-bit userspace on a 64-bit kernel. If this is done then it should depend on the architecture of the compiler. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 4cb92e42f2d4753332d3ddddf2a87fc678afd306 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Aug 18 15:45:29 2014 +1000 ctdb-build: Make ctdb-client depend on ctdb-util and ctdb-util-misc The client code uses both of these, so might as well depend on it. That way code that depends on ctdb-client transitively get the dependencies. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit ef72188302f3c2ce85c676c2ddf544d734d390c2 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Aug 19 11:59:03 2014 +1000 ctdb-build: Allow configure and Makefile to find waf in tarball Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 751ad4b62561b140b7a33d66e63907411a748501 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Sep 4 13:33:58 2014 +1000 ctdb-common: Add some missing #includes To avoid warnings when using --enable-developer, which uses -Wmissing-prototypes. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit a81dccf7ad8345a1c44dc7a08e2320bd88e1aaa5 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Sep 4 13:31:15 2014 +1000 ctdb-daemon: Move some inline declarations to header file To avoid warnings when using --enable-developer, which uses -Wmissing-prototypes. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 6336b958d61ba6901edbaddac8bc10539c8f30ab Author: Martin Schwenke <mar...@meltin.net> Date: Thu Sep 4 13:30:09 2014 +1000 ctdb-tests: Add missing declarations caused by #define magic Some declarations get lost because they basically get #define-d away, so they need to be repeated after the #undef-s. Also, some functions are introduced due the #define-s. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 6674949317dd4b2c1855571ea378eb6bc3b2e86c Author: Martin Schwenke <mar...@meltin.net> Date: Thu Sep 4 13:28:34 2014 +1000 ctdb-tests: Mark some functions as static To avoid warnings when using --enable-developer, which uses -Wmissing-prototypes. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 5de4a97fe941c27080061480cdd7ed8f60f4438e Author: Martin Schwenke <mar...@meltin.net> Date: Thu Sep 4 12:34:46 2014 +1000 ctdb-util: Remove util/strlist.c and references to str_util_*() They're not used in CTDB. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit b0f9d3305850bdcce171b53e7bbbc9628a4e3c20 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Sep 4 11:21:24 2014 +1000 ctdb: Fix some "declarations after code" problems Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 1d16555fa0ad562dcd8c4bbffaca454e68bcabbf Author: Martin Schwenke <mar...@meltin.net> Date: Thu Sep 4 11:20:28 2014 +1000 ctdb-util: Variables should be declared extern in headers Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> ----------------------------------------------------------------------- Summary of changes: ctdb/Makefile | 2 +- ctdb/client/ctdb_client.c | 11 ++- ctdb/common/cmdline.c | 2 + ctdb/common/ctdb_logging.c | 1 + ctdb/common/ctdb_ltdb.c | 2 +- ctdb/common/system_common.c | 2 + ctdb/common/system_util.c | 1 + ctdb/configure | 3 +- ctdb/configure.rpm | 8 +++ ctdb/include/ctdb_logging.h | 42 ++++++++++++ ctdb/include/ctdb_private.h | 4 +- ctdb/include/internal/includes.h | 23 +------ ctdb/lib/{util/db_wrap.c => tdb_wrap/tdb_wrap.c} | 23 ++++--- ctdb/lib/{util/db_wrap.h => tdb_wrap/tdb_wrap.h} | 11 ++- ctdb/lib/tdb_wrap/wscript_build | 7 ++ ctdb/lib/util/debug.c | 1 - ctdb/lib/util/debug.h | 5 +- ctdb/lib/util/fault.c | 5 +- ctdb/lib/util/strlist.c | 52 --------------- ctdb/lib/util/util.h | 69 +-------------------- ctdb/lib/util/util_file.c | 22 ++----- ctdb/lib/util/util_time.c | 6 -- ctdb/lib/util/wscript_build | 10 +++ ctdb/packaging/RPM/ctdb.spec.in | 1 + ctdb/server/ctdb_control.c | 2 +- ctdb/server/ctdb_daemon.c | 4 +- ctdb/server/ctdb_freeze.c | 2 +- ctdb/server/ctdb_lock.c | 4 +- ctdb/server/ctdb_lock_helper.c | 16 +++++ ctdb/server/ctdb_ltdb_server.c | 2 +- ctdb/server/ctdb_persistent.c | 2 +- ctdb/server/ctdb_recover.c | 5 +- ctdb/server/ctdb_recoverd.c | 4 +- ctdb/server/ctdb_server.c | 2 +- ctdb/server/ctdb_takeover.c | 2 +- ctdb/server/ctdb_traverse.c | 2 +- ctdb/server/ctdb_update_record.c | 2 +- ctdb/server/ctdb_vacuum.c | 2 +- ctdb/server/ctdbd.c | 2 +- ctdb/tests/src/ctdb_lock_tdb.c | 2 +- ctdb/tests/src/ctdb_porting_tests.c | 6 +- ctdb/tests/src/ctdb_takeover_tests.c | 37 ++++++----- ctdb/tests/src/ctdb_test.c | 43 +++++++++---- ctdb/tests/src/ctdb_test_stubs.c | 20 ++++-- ctdb/tests/src/ctdb_trackingdb_test.c | 8 +- ctdb/tests/src/ctdb_update_record_persistent.c | 2 +- ctdb/tests/src/ctdbd_test.c | 12 ---- ctdb/tests/src/rb_test.c | 14 ++-- ctdb/tools/ctdb.c | 10 +++- ctdb/tools/ctdb_vacuum.c | 2 +- ctdb/utils/ping_pong/ping_pong.c | 2 +- ctdb/wscript | 74 +++++++++++----------- 52 files changed, 278 insertions(+), 320 deletions(-) create mode 100644 ctdb/include/ctdb_logging.h rename ctdb/lib/{util/db_wrap.c => tdb_wrap/tdb_wrap.c} (93%) rename ctdb/lib/{util/db_wrap.h => tdb_wrap/tdb_wrap.h} (95%) create mode 100755 ctdb/lib/tdb_wrap/wscript_build delete mode 100644 ctdb/lib/util/strlist.c create mode 100755 ctdb/lib/util/wscript_build Changeset truncated at 500 lines: diff --git a/ctdb/Makefile b/ctdb/Makefile index 6d57b0c..b0912f2 100644 --- a/ctdb/Makefile +++ b/ctdb/Makefile @@ -1,6 +1,6 @@ # simple makefile wrapper to run waf -WAF=WAF_MAKE=1 PATH=../buildtools/bin:$$PATH waf +WAF=WAF_MAKE=1 PATH=buildtools/bin:../buildtools/bin:$$PATH waf all: $(WAF) build diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c index df57302..7d629db 100644 --- a/ctdb/client/ctdb_client.c +++ b/ctdb/client/ctdb_client.c @@ -19,7 +19,7 @@ */ #include "includes.h" -#include "db_wrap.h" +#include "lib/tdb_wrap/tdb_wrap.h" #include "tdb.h" #include "lib/util/dlinklist.h" #include "system/network.h" @@ -3798,7 +3798,10 @@ static struct server_id server_id_get(struct ctdb_context *ctdb, uint32_t reqid) return id; } -static bool server_id_equal(struct server_id *id1, struct server_id *id2) +/* This is basically a copy from Samba's server_id.*. However, a + * dependency chain stops us from using Samba's version, so use a + * renamed copy until a better solution is found. */ +static bool ctdb_server_id_equal(struct server_id *id1, struct server_id *id2) { if (id1->pid != id2->pid) { return false; @@ -3936,7 +3939,7 @@ again: i = 0; while (i < locks->num) { - if (server_id_equal(&locks->lock[i].id, &id)) { + if (ctdb_server_id_equal(&locks->lock[i].id, &id)) { /* Internal error */ talloc_free(h); return false; @@ -4024,7 +4027,7 @@ static bool g_lock_unlock(TALLOC_CTX *mem_ctx, id = server_id_get(ctdb_db->ctdb, reqid); for (i=0; i<locks->num; i++) { - if (server_id_equal(&locks->lock[i].id, &id)) { + if (ctdb_server_id_equal(&locks->lock[i].id, &id)) { if (i < locks->num-1) { locks->lock[i] = locks->lock[locks->num-1]; } diff --git a/ctdb/common/cmdline.c b/ctdb/common/cmdline.c index cd59d84..ebe68e4 100644 --- a/ctdb/common/cmdline.c +++ b/ctdb/common/cmdline.c @@ -25,6 +25,8 @@ #include "../common/rb_tree.h" #include <ctype.h> +#include "internal/cmdline.h" + /* Handle common command line options for ctdb test progs */ diff --git a/ctdb/common/ctdb_logging.c b/ctdb/common/ctdb_logging.c index 6dd1a38..5390156 100644 --- a/ctdb/common/ctdb_logging.c +++ b/ctdb/common/ctdb_logging.c @@ -25,6 +25,7 @@ int LogLevel = DEBUG_NOTICE; int this_log_level = 0; +const char *debug_extra = ""; int log_ringbuf_size; diff --git a/ctdb/common/ctdb_ltdb.c b/ctdb/common/ctdb_ltdb.c index 103d89b..f4d571e 100644 --- a/ctdb/common/ctdb_ltdb.c +++ b/ctdb/common/ctdb_ltdb.c @@ -23,7 +23,7 @@ #include "system/network.h" #include "system/filesys.h" #include "../include/ctdb_private.h" -#include "db_wrap.h" +#include "lib/tdb_wrap/tdb_wrap.h" #include "lib/util/dlinklist.h" /* diff --git a/ctdb/common/system_common.c b/ctdb/common/system_common.c index 01ac2bf..899f3b5 100644 --- a/ctdb/common/system_common.c +++ b/ctdb/common/system_common.c @@ -21,6 +21,8 @@ #include "includes.h" #include "system/network.h" +#include "ctdb_private.h" + /* uint16 checksum for n bytes */ diff --git a/ctdb/common/system_util.c b/ctdb/common/system_util.c index 344e7d7..692bc25 100644 --- a/ctdb/common/system_util.c +++ b/ctdb/common/system_util.c @@ -24,6 +24,7 @@ #include <libgen.h> +#include "ctdb_private.h" #if HAVE_SCHED_H #include <sched.h> diff --git a/ctdb/configure b/ctdb/configure index 5357de4..e8d0157 100755 --- a/ctdb/configure +++ b/ctdb/configure @@ -2,7 +2,8 @@ PREVPATH=`dirname $0` -WAF=../buildtools/bin/waf +WAF=buildtools/bin/waf +[ -x "$WAF" ] || WAF=../buildtools/bin/waf # using JOBS=1 gives maximum compatibility with # systems like AIX which have broken threading in python diff --git a/ctdb/configure.rpm b/ctdb/configure.rpm index 9cecb86..32e6673 100755 --- a/ctdb/configure.rpm +++ b/ctdb/configure.rpm @@ -1,9 +1,17 @@ +#!/bin/sh + +if gcc -dM -E - </dev/null | grep -Eq '__(x86_64|powerpc64)__' ; then + _libdir=/usr/lib64 +else + _libdir=/usr/lib +fi CFLAGS="-Wall -g -D_GNU_SOURCE" ./configure \ --builtin-libraries=replace,popt \ --bundled-libraries=!talloc,!tevent,!tdb \ --minimum-library-version=talloc:2.0.8,tdb:1.2.11,tevent:0.9.16 \ --prefix=/usr \ + --libdir=${_libdir} \ --sysconfdir=/etc \ --mandir=/usr/man \ --localstatedir=/var \ diff --git a/ctdb/include/ctdb_logging.h b/ctdb/include/ctdb_logging.h new file mode 100644 index 0000000..710864e --- /dev/null +++ b/ctdb/include/ctdb_logging.h @@ -0,0 +1,42 @@ +/* + ctdb logging code + + Copyright (C) Andrew Tridgell 2008 + + 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_LOGGING_H_ +#define _CTDB_LOGGING_H_ + +extern int LogLevel; +extern int this_log_level; +extern const char *debug_extra; + +enum debug_level { + DEBUG_EMERG = -3, + DEBUG_ALERT = -2, + DEBUG_CRIT = -1, + DEBUG_ERR = 0, + DEBUG_WARNING = 1, + DEBUG_NOTICE = 2, + DEBUG_INFO = 3, + DEBUG_DEBUG = 4, +}; + +#define DEBUGLVL(lvl) ((lvl) <= LogLevel) +#define DEBUG(lvl, x) do { this_log_level = (lvl); if ((lvl) < DEBUG_DEBUG) { log_ringbuffer x; } if ((lvl) <= LogLevel) { do_debug x; }} while (0) +#define DEBUGADD(lvl, x) do { if ((lvl) <= LogLevel) { this_log_level = (lvl); do_debug_add x; }} while (0) + +#endif /* _CTDB_LOGGING_H_ */ diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index ef9bd89..285e13c 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -1076,6 +1076,8 @@ void ctdb_disable_monitoring(struct ctdb_context *ctdb); void ctdb_enable_monitoring(struct ctdb_context *ctdb); void ctdb_stop_monitoring(struct ctdb_context *ctdb); void ctdb_wait_for_first_recovery(struct ctdb_context *ctdb); +int ctdb_tcp_init(struct ctdb_context *ctdb); +int ctdb_ibw_init(struct ctdb_context *ctdb); void ctdb_start_tcp_tickle_update(struct ctdb_context *ctdb); void ctdb_send_keepalive(struct ctdb_context *ctdb, uint32_t destnode); void ctdb_start_keepalive(struct ctdb_context *ctdb); @@ -1494,8 +1496,6 @@ int ctdb_recheck_persistent_health(struct ctdb_context *ctdb); void ctdb_run_notification_script(struct ctdb_context *ctdb, const char *event); -void ctdb_fault_setup(void); - int verify_remote_ip_allocation(struct ctdb_context *ctdb, struct ctdb_all_public_ips *ips, uint32_t pnn); diff --git a/ctdb/include/internal/includes.h b/ctdb/include/internal/includes.h index 05f2488..e3e153b 100644 --- a/ctdb/include/internal/includes.h +++ b/ctdb/include/internal/includes.h @@ -18,23 +18,7 @@ #include "tevent.h" -extern int LogLevel; -extern int this_log_level; - -enum debug_level { - DEBUG_EMERG = -3, - DEBUG_ALERT = -2, - DEBUG_CRIT = -1, - DEBUG_ERR = 0, - DEBUG_WARNING = 1, - DEBUG_NOTICE = 2, - DEBUG_INFO = 3, - DEBUG_DEBUG = 4, -}; - -#define DEBUGLVL(lvl) ((lvl) <= LogLevel) -#define DEBUG(lvl, x) do { this_log_level = (lvl); if ((lvl) < DEBUG_DEBUG) { log_ringbuffer x; } if ((lvl) <= LogLevel) { do_debug x; }} while (0) -#define DEBUGADD(lvl, x) do { if ((lvl) <= LogLevel) { this_log_level = (lvl); do_debug_add x; }} while (0) +#include "ctdb_logging.h" #ifndef _PUBLIC_ #define _PUBLIC_ @@ -63,11 +47,8 @@ struct timeval timeval_until(const struct timeval *tv1, const struct timeval *tv2); _PUBLIC_ struct timeval timeval_current_ofs(uint32_t secs, uint32_t usecs); double timeval_elapsed(struct timeval *tv); -double timeval_delta(struct timeval *tv2, struct timeval *tv); -char **file_lines_load(const char *fname, int *numlines, TALLOC_CTX *mem_ctx); +char **file_lines_load(const char *fname, int *numlines, size_t maxsize, TALLOC_CTX *mem_ctx); char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_t len); -uint8_t *hex_decode_talloc(TALLOC_CTX *mem_ctx, const char *hex_in, size_t *len); -_PUBLIC_ const char **str_list_add(const char **list, const char *s); _PUBLIC_ int set_blocking(int fd, bool set); #include "lib/util/debug.h" diff --git a/ctdb/lib/util/db_wrap.c b/ctdb/lib/tdb_wrap/tdb_wrap.c similarity index 93% rename from ctdb/lib/util/db_wrap.c rename to ctdb/lib/tdb_wrap/tdb_wrap.c index 1b2bf7e..f39ac7a 100644 --- a/ctdb/lib/util/db_wrap.c +++ b/ctdb/lib/tdb_wrap/tdb_wrap.c @@ -1,20 +1,20 @@ -/* +/* Unix SMB/CIFS implementation. database wrap functions Copyright (C) Andrew Tridgell 2004 - + 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/>. */ @@ -26,10 +26,13 @@ of talloc destructors to ensure that only a single open is done */ -#include "includes.h" +#include "replace.h" #include "lib/util/dlinklist.h" -#include "tdb.h" -#include "db_wrap.h" +#include "lib/util/debug.h" + +#include "ctdb_logging.h" + +#include "tdb_wrap.h" static struct tdb_wrap *tdb_list; @@ -41,14 +44,14 @@ static int tdb_wrap_destructor(struct tdb_wrap *w) tdb_close(w->tdb); DLIST_REMOVE(tdb_list, w); return 0; -} +} static void log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const char *fmt, ...) { if (level <= TDB_DEBUG_ERROR) { va_list ap; - this_log_level = level; char newfmt[strlen(tdb_name(tdb)) + 1 + strlen(fmt) + 1]; + this_log_level = level; sprintf(newfmt, "%s:%s", tdb_name(tdb), fmt); va_start(ap, fmt); do_debug_v(newfmt, ap); @@ -88,7 +91,7 @@ struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, return NULL; } - w->tdb = tdb_open_ex(name, hash_size, tdb_flags, + w->tdb = tdb_open_ex(name, hash_size, tdb_flags, open_flags, mode, &log_ctx, NULL); if (w->tdb == NULL) { talloc_free(w); diff --git a/ctdb/lib/util/db_wrap.h b/ctdb/lib/tdb_wrap/tdb_wrap.h similarity index 95% rename from ctdb/lib/util/db_wrap.h rename to ctdb/lib/tdb_wrap/tdb_wrap.h index 5ae5fd1..026e6ba 100644 --- a/ctdb/lib/util/db_wrap.h +++ b/ctdb/lib/tdb_wrap/tdb_wrap.h @@ -1,20 +1,20 @@ -/* +/* Unix SMB/CIFS implementation. database wrap headers Copyright (C) Andrew Tridgell 2004 - + 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/>. */ @@ -22,6 +22,9 @@ #ifndef _DB_WRAP_H #define _DB_WRAP_H +#include <talloc.h> +#include <tdb.h> + struct tdb_wrap { struct tdb_context *tdb; diff --git a/ctdb/lib/tdb_wrap/wscript_build b/ctdb/lib/tdb_wrap/wscript_build new file mode 100755 index 0000000..39a128a --- /dev/null +++ b/ctdb/lib/tdb_wrap/wscript_build @@ -0,0 +1,7 @@ +#!/usr/bin/python + +bld.SAMBA_SUBSYSTEM('tdb-wrap', + source='tdb_wrap.c', + deps='tdb talloc', + local_include=False + ) diff --git a/ctdb/lib/util/debug.c b/ctdb/lib/util/debug.c index e9365d8..40dda1a 100644 --- a/ctdb/lib/util/debug.c +++ b/ctdb/lib/util/debug.c @@ -50,7 +50,6 @@ static void _do_debug_v(const char *format, va_list ap) /* default logging function */ void (*do_debug_v)(const char *, va_list ap) = _do_debug_v; -const char *debug_extra = ""; void do_debug(const char *format, ...) { diff --git a/ctdb/lib/util/debug.h b/ctdb/lib/util/debug.h index d5a215a..4902352 100644 --- a/ctdb/lib/util/debug.h +++ b/ctdb/lib/util/debug.h @@ -20,9 +20,8 @@ #ifndef UTIL_DEBUG_H #define UTIL_DEBUG_H -void (*do_debug_v)(const char *, va_list ap); -const char *debug_extra; -void (*do_debug_add_v)(const char *, va_list ap); +extern void (*do_debug_v)(const char *, va_list ap); +extern void (*do_debug_add_v)(const char *, va_list ap); void log_ringbuffer(const char *format, ...); void do_debug(const char *format, ...) PRINTF_ATTRIBUTE(1, 2); void do_debug_add(const char *format, ...) PRINTF_ATTRIBUTE(1, 2); diff --git a/ctdb/lib/util/fault.c b/ctdb/lib/util/fault.c index 3dddd0e..d53eecd 100644 --- a/ctdb/lib/util/fault.c +++ b/ctdb/lib/util/fault.c @@ -197,11 +197,8 @@ _NORETURN_ static void sig_fault(int sig) /** setup our fault handlers **/ -_PUBLIC_ void fault_setup(const char *pname) +_PUBLIC_ void fault_setup(void) { - if (progname == NULL) { - progname = pname; - } #ifdef SIGSEGV CatchSignal(SIGSEGV, sig_fault); #endif diff --git a/ctdb/lib/util/strlist.c b/ctdb/lib/util/strlist.c deleted file mode 100644 index 48a6e45..0000000 --- a/ctdb/lib/util/strlist.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - Copyright (C) Andrew Tridgell 2005 - Copyright (C) Jelmer Vernooij 2005 - - 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/>. -*/ - -#include "includes.h" -#include "system/locale.h" - -/** - return the number of elements in a string list -*/ -_PUBLIC_ size_t str_list_length(const char **list) -{ - size_t ret; - for (ret=0;list && list[ret];ret++) /* noop */ ; - return ret; -} - - -/** - add an entry to a string list -*/ -_PUBLIC_ const char **str_list_add(const char **list, const char *s) -{ - size_t len = str_list_length(list); - const char **ret; - - ret = talloc_realloc(NULL, list, const char *, len+2); - if (ret == NULL) return NULL; - - ret[len] = talloc_strdup(ret, s); - if (ret[len] == NULL) return NULL; - - ret[len+1] = NULL; - - return ret; -} diff --git a/ctdb/lib/util/util.h b/ctdb/lib/util/util.h -- Samba Shared Repository