From 6edbbce887d4af28b026a43059cd339fb3674932 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 13 May 2014 23:13:13 +1000 Subject: ctdb-build: Move internal include files in a separate directory This will allow to build clustered samba with built-in ctdb tree rather than needing to install CTDB first. Signed-off-by: Amitay Isaacs Reviewed-by: Michael Adam --- ctdb/Makefile.in | 3 +- ctdb/include/cmdline.h | 7 ----- ctdb/include/idtree.h | 7 ----- ctdb/include/includes.h | 68 ---------------------------------------- ctdb/include/internal/cmdline.h | 7 +++++ ctdb/include/internal/idtree.h | 7 +++++ ctdb/include/internal/includes.h | 68 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 84 insertions(+), 83 deletions(-) delete mode 100644 ctdb/include/cmdline.h delete mode 100644 ctdb/include/idtree.h delete mode 100644 ctdb/include/includes.h create mode 100644 ctdb/include/internal/cmdline.h create mode 100644 ctdb/include/internal/idtree.h create mode 100644 ctdb/include/internal/includes.h diff --git a/ctdb/Makefile.in b/ctdb/Makefile.in index 6fa93a4d2a..f3cd70c3bd 100755 --- a/ctdb/Makefile.in +++ b/ctdb/Makefile.in @@ -62,7 +62,8 @@ ifeq ($(CC),gcc) EXTRA_CFLAGS=-Wno-format-zero-length -Wno-deprecated-declarations -fPIC endif -CFLAGS=@CPPFLAGS@ -g -I$(srcdir)/include -Iinclude -Ilib -Ilib/util -I$(srcdir) \ +CFLAGS=@CPPFLAGS@ -g -I$(srcdir)/include -I$(srcdir)/include/internal \ + -Iinclude -Ilib -Ilib/util -I$(srcdir) \ $(TALLOC_CFLAGS) $(TEVENT_CFLAGS) $(TDB_CFLAGS) -I@libreplacedir@ \ -DVARDIR=\"$(localstatedir)\" -DETCDIR=\"$(etcdir)\" \ -DCTDB_VARDIR=\"$(localstatedir)/lib/ctdb\" \ diff --git a/ctdb/include/cmdline.h b/ctdb/include/cmdline.h deleted file mode 100644 index 785595ee6c..0000000000 --- a/ctdb/include/cmdline.h +++ /dev/null @@ -1,7 +0,0 @@ - -extern struct poptOption popt_ctdb_cmdline[]; - -#define POPT_CTDB_CMDLINE { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_ctdb_cmdline, 0, "Common ctdb test options:", NULL }, - -struct ctdb_context *ctdb_cmdline_init(struct event_context *ev); - diff --git a/ctdb/include/idtree.h b/ctdb/include/idtree.h deleted file mode 100644 index 259af91005..0000000000 --- a/ctdb/include/idtree.h +++ /dev/null @@ -1,7 +0,0 @@ -struct idr_context *idr_init(TALLOC_CTX *mem_ctx); -int idr_get_new(struct idr_context *idp, void *ptr, int limit); -int idr_get_new_above(struct idr_context *idp, void *ptr, int starting_id, int limit); -int idr_get_new_random(struct idr_context *idp, void *ptr, int limit); -void *idr_find(struct idr_context *idp, int id); -int idr_remove(struct idr_context *idp, int id); - diff --git a/ctdb/include/includes.h b/ctdb/include/includes.h deleted file mode 100644 index 37471982de..0000000000 --- a/ctdb/include/includes.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef _CTDB_INCLUDES_H -#define _CTDB_INCLUDES_H - -#define HAVE_UNIXSOCKET 1 - -#include "replace.h" -#include "talloc.h" -#include "system/wait.h" -#include "system/network.h" -#include "tdb.h" -#include "idtree.h" -#include "ctdb_client.h" - -/* Allow use of deprecated function tevent_loop_allow_nesting() */ -#define TEVENT_DEPRECATED -/* Saves ctdb from massive churn. */ -#define TEVENT_COMPAT_DEFINES 1 - -#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) - -#define _PUBLIC_ -#define _NORETURN_ -#define _PURE_ - -#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x)) - -#ifndef discard_const -#define discard_const(ptr) ((void *)((intptr_t)(ptr))) -#endif - -struct timeval timeval_zero(void); -bool timeval_is_zero(const struct timeval *tv); -struct timeval timeval_current(void); -struct timeval timeval_set(uint32_t secs, uint32_t usecs); -int timeval_compare(const struct timeval *tv1, const struct timeval *tv2); -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 *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" -#include "lib/util/util.h" - -#endif /* _CTDB_INCLUDES_H */ diff --git a/ctdb/include/internal/cmdline.h b/ctdb/include/internal/cmdline.h new file mode 100644 index 0000000000..785595ee6c --- /dev/null +++ b/ctdb/include/internal/cmdline.h @@ -0,0 +1,7 @@ + +extern struct poptOption popt_ctdb_cmdline[]; + +#define POPT_CTDB_CMDLINE { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_ctdb_cmdline, 0, "Common ctdb test options:", NULL }, + +struct ctdb_context *ctdb_cmdline_init(struct event_context *ev); + diff --git a/ctdb/include/internal/idtree.h b/ctdb/include/internal/idtree.h new file mode 100644 index 0000000000..259af91005 --- /dev/null +++ b/ctdb/include/internal/idtree.h @@ -0,0 +1,7 @@ +struct idr_context *idr_init(TALLOC_CTX *mem_ctx); +int idr_get_new(struct idr_context *idp, void *ptr, int limit); +int idr_get_new_above(struct idr_context *idp, void *ptr, int starting_id, int limit); +int idr_get_new_random(struct idr_context *idp, void *ptr, int limit); +void *idr_find(struct idr_context *idp, int id); +int idr_remove(struct idr_context *idp, int id); + diff --git a/ctdb/include/internal/includes.h b/ctdb/include/internal/includes.h new file mode 100644 index 0000000000..37471982de --- /dev/null +++ b/ctdb/include/internal/includes.h @@ -0,0 +1,68 @@ +#ifndef _CTDB_INCLUDES_H +#define _CTDB_INCLUDES_H + +#define HAVE_UNIXSOCKET 1 + +#include "replace.h" +#include "talloc.h" +#include "system/wait.h" +#include "system/network.h" +#include "tdb.h" +#include "idtree.h" +#include "ctdb_client.h" + +/* Allow use of deprecated function tevent_loop_allow_nesting() */ +#define TEVENT_DEPRECATED +/* Saves ctdb from massive churn. */ +#define TEVENT_COMPAT_DEFINES 1 + +#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) + +#define _PUBLIC_ +#define _NORETURN_ +#define _PURE_ + +#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x)) + +#ifndef discard_const +#define discard_const(ptr) ((void *)((intptr_t)(ptr))) +#endif + +struct timeval timeval_zero(void); +bool timeval_is_zero(const struct timeval *tv); +struct timeval timeval_current(void); +struct timeval timeval_set(uint32_t secs, uint32_t usecs); +int timeval_compare(const struct timeval *tv1, const struct timeval *tv2); +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 *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" +#include "lib/util/util.h" + +#endif /* _CTDB_INCLUDES_H */ -- cgit