summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Somogyi <psomogyi@gamax.hu>2006-12-13 15:00:41 +0100
committerPeter Somogyi <psomogyi@gamax.hu>2006-12-13 15:00:41 +0100
commitffefb5c24fa1707a87ca5328b3f463d87f2b908f (patch)
tree6b1181b3938bc2d03e9b8e44080281e4bd63189e
parent6df8352035c81fd6921a49d07068212956ec8d9f (diff)
Made ibwrapper compilable.
Adjusted makefile to include the project. libibverbs and librdmacm has to be installed with headers. (This used to be ctdb commit 372dc670a7aeb5887c4f24bd5466aa6a77e22f1f)
-rw-r--r--ctdb/Makefile.in10
-rw-r--r--ctdb/config.h712
-rw-r--r--ctdb/config.h.in711
-rw-r--r--ctdb/ib/ibwrapper.c215
-rw-r--r--ctdb/ib/ibwrapper.h14
-rw-r--r--ctdb/ib/ibwrapper_internal.h3
6 files changed, 120 insertions, 1545 deletions
diff --git a/ctdb/Makefile.in b/ctdb/Makefile.in
index 4bb29c7440..814c107e8f 100644
--- a/ctdb/Makefile.in
+++ b/ctdb/Makefile.in
@@ -16,7 +16,7 @@ CFLAGS=-g -I$(srcdir)/include -Iinclude -I$(srcdir) \
-I@tallocdir@ -I@tdbdir@/include -I@libreplacedir@ \
-DLIBDIR=\"$(libdir)\" -DSHLIBEXT=\"@SHLIBEXT@\" -DUSE_MMAP=1 @CFLAGS@
-LIB_FLAGS=@LDFLAGS@ -Llib @LIBS@ -lpopt
+LIB_FLAGS=@LDFLAGS@ -Llib @LIBS@ -lpopt -lrdmacm -libverbs
EVENTS_OBJ = lib/events/events.o lib/events/events_standard.o
@@ -25,7 +25,9 @@ CTDB_COMMON_OBJ = common/ctdb.o common/util.o common/ctdb_util.o \
CTDB_TCP_OBJ = tcp/tcp_connect.o tcp/tcp_io.o tcp/tcp_init.o
-CTDB_OBJ = $(CTDB_COMMON_OBJ) $(CTDB_TCP_OBJ)
+CTDB_IB_OBJ = ib/ibwrapper.o
+
+CTDB_OBJ = $(CTDB_COMMON_OBJ) $(CTDB_TCP_OBJ) $(CTDB_IB_OBJ)
OBJS = @TDBOBJ@ @TALLOCOBJ@ @LIBREPLACEOBJ@ $(EXTRA_OBJ) $(EVENTS_OBJ) $(CTDB_OBJ)
@@ -53,12 +55,12 @@ bin/ctdb_test: $(OBJS) ctdb_test.o
@$(CC) $(CFLAGS) -o $@ ctdb_test.o $(OBJS) $(LIB_FLAGS)
clean:
- rm -f *.o */*.o
+ rm -f *.o */*.o */*/*.o
rm -f $(BINS)
distclean: clean
rm -f *~ */*~
- rm -rf bin lib
+ rm -rf bin
rm -f config.log config.status config.cache include/config.h
rm -f Makefile
diff --git a/ctdb/config.h b/ctdb/config.h
deleted file mode 100644
index e6c9df3027..0000000000
--- a/ctdb/config.h
+++ /dev/null
@@ -1,712 +0,0 @@
-/* config.h. Generated from config.h.in by configure. */
-/* config.h.in. Generated from configure.ac by autoheader. */
-
-/* Whether strndup is broken */
-/* #undef BROKEN_STRNDUP */
-
-/* Whether strnlen is broken */
-/* #undef BROKEN_STRNLEN */
-
-/* Define to 1 if you have the <arpa/inet.h> header file. */
-#define HAVE_ARPA_INET_H 1
-
-/* Define to 1 if you have the `asprintf' function. */
-#define HAVE_ASPRINTF 1
-
-/* Whether the bool type is available */
-#define HAVE_BOOL 1
-
-/* Define to 1 if you have the `bzero' function. */
-#define HAVE_BZERO 1
-
-/* Whether there is a C99 compliant vsnprintf */
-#define HAVE_C99_VSNPRINTF 1
-
-/* Define to 1 if you have the `chroot' function. */
-#define HAVE_CHROOT 1
-
-/* Define to 1 if you have the `chsize' function. */
-/* #undef HAVE_CHSIZE */
-
-/* Whether or not we have comparison_fn_t */
-#define HAVE_COMPARISON_FN_T 1
-
-/* Define to 1 if you have the <compat.h> header file. */
-/* #undef HAVE_COMPAT_H */
-
-/* Define to 1 if you have the <ctype.h> header file. */
-#define HAVE_CTYPE_H 1
-
-/* Define to 1 if you have the declaration of `asprintf', and to 0 if you
- don't. */
-#define HAVE_DECL_ASPRINTF 1
-
-/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
- don't. */
-#define HAVE_DECL_SNPRINTF 1
-
-/* Define to 1 if you have the declaration of `vasprintf', and to 0 if you
- don't. */
-#define HAVE_DECL_VASPRINTF 1
-
-/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
- don't. */
-#define HAVE_DECL_VSNPRINTF 1
-
-/* Define to 1 if you have the <direct.h> header file. */
-/* #undef HAVE_DIRECT_H */
-
-/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
- */
-#define HAVE_DIRENT_H 1
-
-/* Define to 1 if you have the `dlclose' function. */
-#define HAVE_DLCLOSE 1
-
-/* Define to 1 if you have the `dlerror' function. */
-#define HAVE_DLERROR 1
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define to 1 if you have the `dlopen' function. */
-#define HAVE_DLOPEN 1
-
-/* Define to 1 if you have the `dlsym' function. */
-#define HAVE_DLSYM 1
-
-/* Define to 1 if you have the `endnetgrent' function. */
-#define HAVE_ENDNETGRENT 1
-
-/* Define to 1 if you have the `epoll_create' function. */
-#define HAVE_EPOLL_CREATE 1
-
-/* Whether errno() is available */
-#define HAVE_ERRNO_DECL 1
-
-/* Define to 1 if you have the <fcntl.h> header file. */
-#define HAVE_FCNTL_H 1
-
-/* Define to 1 if you have the <fnmatch.h> header file. */
-#define HAVE_FNMATCH_H 1
-
-/* Define to 1 if you have the `ftruncate' function. */
-#define HAVE_FTRUNCATE 1
-
-/* Whether there is a __FUNCTION__ macro */
-#define HAVE_FUNCTION_MACRO 1
-
-/* Define to 1 if you have the `getdents' function. */
-/* #undef HAVE_GETDENTS */
-
-/* Define to 1 if you have the `getdirentries' function. */
-/* #undef HAVE_GETDIRENTRIES */
-
-/* Define to 1 if you have the `getnetgrent' function. */
-#define HAVE_GETNETGRENT 1
-
-/* Define to 1 if you have the <getopt.h> header file. */
-#define HAVE_GETOPT_H 1
-
-/* Define to 1 if you have the `getpagesize' function. */
-#define HAVE_GETPAGESIZE 1
-
-/* Define to 1 if you have the `getpgrp' function. */
-#define HAVE_GETPGRP 1
-
-/* Define to 1 if you have the <grp.h> header file. */
-#define HAVE_GRP_H 1
-
-/* Whether the compiler supports immediate structures */
-#define HAVE_IMMEDIATE_STRUCTURES 1
-
-/* Define to 1 if you have the `initgroups' function. */
-#define HAVE_INITGROUPS 1
-
-/* Define to 1 if you have the `innetgr' function. */
-#define HAVE_INNETGR 1
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Define to 1 if you have the <limits.h> header file. */
-#define HAVE_LIMITS_H 1
-
-/* Define to 1 if you have the <locale.h> header file. */
-#define HAVE_LOCALE_H 1
-
-/* Define to 1 if the system has the type `long long'. */
-#define HAVE_LONG_LONG 1
-
-/* Define to 1 if you have the `lstat' function. */
-#define HAVE_LSTAT 1
-
-/* Define to 1 if you have the `memcpy' function. */
-#define HAVE_MEMCPY 1
-
-/* Define to 1 if you have the `memmove' function. */
-#define HAVE_MEMMOVE 1
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if you have the `memset' function. */
-#define HAVE_MEMSET 1
-
-/* Define if target mkdir supports mode option */
-#define HAVE_MKDIR_MODE 1
-
-/* Define to 1 if you have the `mkdtemp' function. */
-#define HAVE_MKDTEMP 1
-
-/* Define to 1 if you have the `mktime' function. */
-#define HAVE_MKTIME 1
-
-/* Define to 1 if you have the `mmap' function. */
-#define HAVE_MMAP 1
-
-/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
-/* #undef HAVE_NDIR_H */
-
-/* Define to 1 if you have the <netdb.h> header file. */
-#define HAVE_NETDB_H 1
-
-/* Define to 1 if you have the <netinet/in.h> header file. */
-#define HAVE_NETINET_IN_H 1
-
-/* Define to 1 if you have the <netinet/in_ip.h> header file. */
-/* #undef HAVE_NETINET_IN_IP_H */
-
-/* Define to 1 if you have the <netinet/in_systm.h> header file. */
-#define HAVE_NETINET_IN_SYSTM_H 1
-
-/* Define to 1 if you have the <netinet/ip.h> header file. */
-#define HAVE_NETINET_IP_H 1
-
-/* Define to 1 if you have the <netinet/tcp.h> header file. */
-#define HAVE_NETINET_TCP_H 1
-
-/* usability of net/if.h */
-#define HAVE_NET_IF_H 1
-
-/* Whether the open(2) accepts O_DIRECT */
-/* #undef HAVE_OPEN_O_DIRECT */
-
-/* Define to 1 if you have the `pipe' function. */
-#define HAVE_PIPE 1
-
-/* Define to 1 if you have the `pread' function. */
-#define HAVE_PREAD 1
-
-/* Whether pread() is available */
-#define HAVE_PREAD_DECL 1
-
-/* Define to 1 if you have the `printf' function. */
-#define HAVE_PRINTF 1
-
-/* Define to 1 if you have the <pwd.h> header file. */
-#define HAVE_PWD_H 1
-
-/* Define to 1 if you have the `pwrite' function. */
-#define HAVE_PWRITE 1
-
-/* Whether pwrite() is available */
-#define HAVE_PWRITE_DECL 1
-
-/* Define to 1 if you have the `rand' function. */
-#define HAVE_RAND 1
-
-/* Define to 1 if you have the `random' function. */
-#define HAVE_RANDOM 1
-
-/* Define to 1 if you have the `rename' function. */
-#define HAVE_RENAME 1
-
-/* Whether mkstemp is secure */
-#define HAVE_SECURE_MKSTEMP 1
-
-/* Define to 1 if you have the `setbuffer' function. */
-#define HAVE_SETBUFFER 1
-
-/* Define to 1 if you have the `setegid' function. */
-#define HAVE_SETEGID 1
-
-/* Define to 1 if you have the `setenv' function. */
-#define HAVE_SETENV 1
-
-/* Define to 1 if you have the `seteuid' function. */
-#define HAVE_SETEUID 1
-
-/* Define to 1 if you have the `setlinebuf' function. */
-#define HAVE_SETLINEBUF 1
-
-/* Define to 1 if you have the `setnetgrent' function. */
-#define HAVE_SETNETGRENT 1
-
-/* Define to 1 if you have the `setresgid' function. */
-#define HAVE_SETRESGID 1
-
-/* Whether setresgid() is available */
-#define HAVE_SETRESGID_DECL 1
-
-/* Define to 1 if you have the `setresuid' function. */
-#define HAVE_SETRESUID 1
-
-/* Whether setresuid() is available */
-#define HAVE_SETRESUID_DECL 1
-
-/* Define to 1 if you have the <shadow.h> header file. */
-#define HAVE_SHADOW_H 1
-
-/* Whether we have the atomic_t variable type */
-#define HAVE_SIG_ATOMIC_T_TYPE 1
-
-/* Define to 1 if you have the `snprintf' function. */
-#define HAVE_SNPRINTF 1
-
-/* Define to 1 if you have the `socketpair' function. */
-#define HAVE_SOCKETPAIR 1
-
-/* Define to 1 if you have the `srand' function. */
-#define HAVE_SRAND 1
-
-/* Define to 1 if you have the `srandom' function. */
-#define HAVE_SRANDOM 1
-
-/* Define to 1 if you have the <standards.h> header file. */
-/* #undef HAVE_STANDARDS_H */
-
-/* Define to 1 if you have the <stdarg.h> header file. */
-#define HAVE_STDARG_H 1
-
-/* Define to 1 if you have the <stdbool.h> header file. */
-#define HAVE_STDBOOL_H 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
-
-/* Define to 1 if you have the <stdio.h> header file. */
-#define HAVE_STDIO_H 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the `strcasestr' function. */
-#define HAVE_STRCASESTR 1
-
-/* Define to 1 if you have the `strdup' function. */
-#define HAVE_STRDUP 1
-
-/* Define to 1 if you have the `strerror' function. */
-#define HAVE_STRERROR 1
-
-/* Define to 1 if you have the `strftime' function. */
-#define HAVE_STRFTIME 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the `strlcat' function. */
-/* #undef HAVE_STRLCAT */
-
-/* Define to 1 if you have the `strlcpy' function. */
-/* #undef HAVE_STRLCPY */
-
-/* Define to 1 if you have the `strndup' function. */
-#define HAVE_STRNDUP 1
-
-/* Define to 1 if you have the `strnlen' function. */
-#define HAVE_STRNLEN 1
-
-/* Define to 1 if you have the `strtok_r' function. */
-#define HAVE_STRTOK_R 1
-
-/* Define to 1 if you have the `strtoll' function. */
-#define HAVE_STRTOLL 1
-
-/* Define to 1 if you have the `strtoq' function. */
-#define HAVE_STRTOQ 1
-
-/* Define to 1 if you have the `strtoull' function. */
-#define HAVE_STRTOULL 1
-
-/* Define to 1 if you have the `strtouq' function. */
-#define HAVE_STRTOUQ 1
-
-/* Define to 1 if `st_rdev' is member of `struct stat'. */
-#define HAVE_STRUCT_STAT_ST_RDEV 1
-
-/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use
- `HAVE_STRUCT_STAT_ST_RDEV' instead. */
-#define HAVE_ST_RDEV 1
-
-/* Define to 1 if you have the `syslog' function. */
-#define HAVE_SYSLOG 1
-
-/* Define to 1 if you have the <syslog.h> header file. */
-#define HAVE_SYSLOG_H 1
-
-/* Define to 1 if you have the <sys/acl.h> header file. */
-#define HAVE_SYS_ACL_H 1
-
-/* Define to 1 if you have the <sys/capability.h> header file. */
-/* #undef HAVE_SYS_CAPABILITY_H */
-
-/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
- */
-/* #undef HAVE_SYS_DIR_H */
-
-/* Define to 1 if you have the <sys/epoll.h> header file. */
-#define HAVE_SYS_EPOLL_H 1
-
-/* Define to 1 if you have the <sys/fcntl.h> header file. */
-#define HAVE_SYS_FCNTL_H 1
-
-/* Define to 1 if you have the <sys/filio.h> header file. */
-/* #undef HAVE_SYS_FILIO_H */
-
-/* Define to 1 if you have the <sys/filsys.h> header file. */
-/* #undef HAVE_SYS_FILSYS_H */
-
-/* Define to 1 if you have the <sys/fs/s5param.h> header file. */
-/* #undef HAVE_SYS_FS_S5PARAM_H */
-
-/* Define to 1 if you have the <sys/id.h> header file. */
-/* #undef HAVE_SYS_ID_H */
-
-/* Define to 1 if you have the <sys/ioctl.h> header file. */
-#define HAVE_SYS_IOCTL_H 1
-
-/* Define to 1 if you have the <sys/ipc.h> header file. */
-#define HAVE_SYS_IPC_H 1
-
-/* Define to 1 if you have the <sys/mman.h> header file. */
-#define HAVE_SYS_MMAN_H 1
-
-/* Define to 1 if you have the <sys/mode.h> header file. */
-/* #undef HAVE_SYS_MODE_H */
-
-/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
- */
-/* #undef HAVE_SYS_NDIR_H */
-
-/* Define to 1 if you have the <sys/param.h> header file. */
-#define HAVE_SYS_PARAM_H 1
-
-/* Define to 1 if you have the <sys/priv.h> header file. */
-/* #undef HAVE_SYS_PRIV_H */
-
-/* Define to 1 if you have the <sys/resource.h> header file. */
-#define HAVE_SYS_RESOURCE_H 1
-
-/* Define to 1 if you have the <sys/security.h> header file. */
-/* #undef HAVE_SYS_SECURITY_H */
-
-/* Define to 1 if you have the <sys/select.h> header file. */
-#define HAVE_SYS_SELECT_H 1
-
-/* Define to 1 if you have the <sys/shm.h> header file. */
-#define HAVE_SYS_SHM_H 1
-
-/* Define to 1 if you have the <sys/socket.h> header file. */
-#define HAVE_SYS_SOCKET_H 1
-
-/* Define to 1 if you have the <sys/sockio.h> header file. */
-/* #undef HAVE_SYS_SOCKIO_H */
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/syslog.h> header file. */
-#define HAVE_SYS_SYSLOG_H 1
-
-/* Define to 1 if you have the <sys/termio.h> header file. */
-/* #undef HAVE_SYS_TERMIO_H */
-
-/* Define to 1 if you have the <sys/time.h> header file. */
-#define HAVE_SYS_TIME_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <sys/un.h> header file. */
-#define HAVE_SYS_UN_H 1
-
-/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
-#define HAVE_SYS_WAIT_H 1
-
-/* Define to 1 if you have the <termios.h> header file. */
-#define HAVE_TERMIOS_H 1
-
-/* Define to 1 if you have the <termio.h> header file. */
-#define HAVE_TERMIO_H 1
-
-/* Define to 1 if you have the `timegm' function. */
-#define HAVE_TIMEGM 1
-
-/* Define to 1 if you have the <time.h> header file. */
-#define HAVE_TIME_H 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define to 1 if you have the `usleep' function. */
-#define HAVE_USLEEP 1
-
-/* Define to 1 if you have the `utime' function. */
-#define HAVE_UTIME 1
-
-/* Define to 1 if you have the <utime.h> header file. */
-#define HAVE_UTIME_H 1
-
-/* Define to 1 if you have the <vararg.h> header file. */
-/* #undef HAVE_VARARG_H */
-
-/* Define to 1 if you have the `vasprintf' function. */
-#define HAVE_VASPRINTF 1
-
-/* Whether va_copy() is available */
-#define HAVE_VA_COPY 1
-
-/* Whether the C compiler understands volatile */
-#define HAVE_VOLATILE 1
-
-/* Define to 1 if you have the `vsnprintf' function. */
-#define HAVE_VSNPRINTF 1
-
-/* Define to 1 if you have the `vsyslog' function. */
-#define HAVE_VSYSLOG 1
-
-/* Define to 1 if you have the `waitpid' function. */
-#define HAVE_WAITPID 1
-
-/* Define to 1 if you have the <windows.h> header file. */
-/* #undef HAVE_WINDOWS_H */
-
-/* Define to 1 if you have the <winsock2.h> header file. */
-/* #undef HAVE_WINSOCK2_H */
-
-/* Define to 1 if you have the <ws2tcpip.h> header file. */
-/* #undef HAVE_WS2TCPIP_H */
-
-/* Whether the _Bool type is available */
-#define HAVE__Bool 1
-
-/* Whether the __VA_ARGS__ macro is available */
-#define HAVE__VA_ARGS__MACRO 1
-
-/* Define to 1 if you have the `__strtoll' function. */
-/* #undef HAVE___STRTOLL */
-
-/* Define to 1 if you have the `__strtoull' function. */
-/* #undef HAVE___STRTOULL */
-
-/* Whether __va_copy() is available */
-/* #undef HAVE___VA_COPY */
-
-/* Whether there is a __func__ macro */
-/* #undef HAVE_func_MACRO */
-
-/* Whether MMAP is broken */
-/* #undef MMAP_BLACKLIST */
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT ""
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME ""
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING ""
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME ""
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION ""
-
-/* Whether getpass should be replaced */
-/* #undef REPLACE_GETPASS */
-
-/* Whether inet_ntoa should be replaced */
-/* #undef REPLACE_INET_NTOA */
-
-/* replace readdir */
-/* #undef REPLACE_READDIR */
-
-/* replace readdir using getdents() */
-/* #undef REPLACE_READDIR_GETDENTS */
-
-/* replace readdir using getdirentries() */
-/* #undef REPLACE_READDIR_GETDIRENTRIES */
-
-/* Define as the return type of signal handlers (`int' or `void'). */
-#define RETSIGTYPE void
-
-/* Whether seekdir returns an int */
-/* #undef SEEKDIR_RETURNS_INT */
-
-/* The size of `char', as computed by sizeof. */
-#define SIZEOF_CHAR 1
-
-/* The size of `int', as computed by sizeof. */
-#define SIZEOF_INT 4
-
-/* The size of `long', as computed by sizeof. */
-#define SIZEOF_LONG 4
-
-/* The size of `long long', as computed by sizeof. */
-#define SIZEOF_LONG_LONG 8
-
-/* The size of `off_t', as computed by sizeof. */
-#define SIZEOF_OFF_T 8
-
-/* The size of `short', as computed by sizeof. */
-#define SIZEOF_SHORT 2
-
-/* The size of `size_t', as computed by sizeof. */
-#define SIZEOF_SIZE_T 4
-
-/* The size of `ssize_t', as computed by sizeof. */
-#define SIZEOF_SSIZE_T 4
-
-/* The size of `void *', as computed by sizeof. */
-#define SIZEOF_VOID_P 4
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Whether telldir takes a const pointer */
-/* #undef TELLDIR_TAKES_CONST_DIR */
-
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#define TIME_WITH_SYS_TIME 1
-
-/* Define to 1 if your processor stores words with the most significant byte
- first (like Motorola and SPARC, unlike Intel and VAX). */
-/* #undef WORDS_BIGENDIAN */
-
-/* Define to 1 if on AIX 3.
- System headers sometimes define this.
- We just want to avoid a redefinition error message. */
-#ifndef _ALL_SOURCE
-/* # undef _ALL_SOURCE */
-#endif
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-#define _FILE_OFFSET_BITS 64
-
-/* Enable GNU extensions on systems that have them. */
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE 1
-#endif
-
-/* Define for large files, on AIX-style hosts. */
-/* #undef _LARGE_FILES */
-
-/* Define to 1 if on MINIX. */
-/* #undef _MINIX */
-
-#ifndef _OSF_SOURCE
-# define _OSF_SOURCE 1
-#endif
-
-/* Define to 2 if the system does not provide POSIX.1 features except with
- this defined. */
-/* #undef _POSIX_1_SOURCE */
-
-/* Whether to enable POSIX support */
-/* #undef _POSIX_C_SOURCE */
-
-/* Define to 1 if you need to in order for `stat' and other things to work. */
-/* #undef _POSIX_SOURCE */
-
-/* Whether to enable System V compatibility */
-/* #undef _SYSV */
-
-#ifndef _XOPEN_SOURCE_EXTENDED
-# define _XOPEN_SOURCE_EXTENDED 1
-#endif
-
-/* Enable extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# define __EXTENSIONS__ 1
-#endif
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# define _POSIX_PTHREAD_SEMANTICS 1
-#endif
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-/* #undef gid_t */
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
- calls it, or to nothing if 'inline' is not supported under any name. */
-#ifndef __cplusplus
-/* #undef inline */
-#endif
-
-/* Define to `unsigned' if <sys/types.h> does not define. */
-/* #undef ino_t */
-
-/* Define to `short' if <sys/types.h> does not define. */
-/* #undef int16_t */
-
-/* Define to `long' if <sys/types.h> does not define. */
-/* #undef int32_t */
-
-/* Define to `long long' if <sys/types.h> does not define. */
-/* #undef int64_t */
-
-/* Define to `char' if <sys/types.h> does not define. */
-/* #undef int8_t */
-
-/* Define to `unsigned long long' if <sys/types.h> does not define. */
-/* #undef intptr_t */
-
-/* Define to `off_t' if <sys/types.h> does not define. */
-/* #undef loff_t */
-
-/* Define to `int' if <sys/types.h> does not define. */
-/* #undef mode_t */
-
-/* Define to `long int' if <sys/types.h> does not define. */
-/* #undef off_t */
-
-/* Define to `loff_t' if <sys/types.h> does not define. */
-#define offset_t loff_t
-
-/* Define to `int' if <sys/types.h> does not define. */
-/* #undef pid_t */
-
-/* Define to `unsigned long long' if <sys/types.h> does not define. */
-/* #undef ptrdiff_t */
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-/* #undef size_t */
-
-/* Socket length type */
-/* #undef socklen_t */
-
-/* Define to `int' if <sys/types.h> does not define. */
-/* #undef ssize_t */
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-/* #undef uid_t */
-
-/* Define to `unsigned short' if <sys/types.h> does not define. */
-/* #undef uint16_t */
-
-/* Define to `unsigned long' if <sys/types.h> does not define. */
-/* #undef uint32_t */
-
-/* Define to `unsigned long long' if <sys/types.h> does not define. */
-/* #undef uint64_t */
-
-/* Define to `unsigned char' if <sys/types.h> does not define. */
-/* #undef uint8_t */
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-#define uint_t unsigned int
diff --git a/ctdb/config.h.in b/ctdb/config.h.in
deleted file mode 100644
index 7fcc7b45dd..0000000000
--- a/ctdb/config.h.in
+++ /dev/null
@@ -1,711 +0,0 @@
-/* config.h.in. Generated from configure.ac by autoheader. */
-
-/* Whether strndup is broken */
-#undef BROKEN_STRNDUP
-
-/* Whether strnlen is broken */
-#undef BROKEN_STRNLEN
-
-/* Define to 1 if you have the <arpa/inet.h> header file. */
-#undef HAVE_ARPA_INET_H
-
-/* Define to 1 if you have the `asprintf' function. */
-#undef HAVE_ASPRINTF
-
-/* Whether the bool type is available */
-#undef HAVE_BOOL
-
-/* Define to 1 if you have the `bzero' function. */
-#undef HAVE_BZERO
-
-/* Whether there is a C99 compliant vsnprintf */
-#undef HAVE_C99_VSNPRINTF
-
-/* Define to 1 if you have the `chroot' function. */
-#undef HAVE_CHROOT
-
-/* Define to 1 if you have the `chsize' function. */
-#undef HAVE_CHSIZE
-
-/* Whether or not we have comparison_fn_t */
-#undef HAVE_COMPARISON_FN_T
-
-/* Define to 1 if you have the <compat.h> header file. */
-#undef HAVE_COMPAT_H
-
-/* Define to 1 if you have the <ctype.h> header file. */
-#undef HAVE_CTYPE_H
-
-/* Define to 1 if you have the declaration of `asprintf', and to 0 if you
- don't. */
-#undef HAVE_DECL_ASPRINTF
-
-/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
- don't. */
-#undef HAVE_DECL_SNPRINTF
-
-/* Define to 1 if you have the declaration of `vasprintf', and to 0 if you
- don't. */
-#undef HAVE_DECL_VASPRINTF
-
-/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
- don't. */
-#undef HAVE_DECL_VSNPRINTF
-
-/* Define to 1 if you have the <direct.h> header file. */
-#undef HAVE_DIRECT_H
-
-/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
- */
-#undef HAVE_DIRENT_H
-
-/* Define to 1 if you have the `dlclose' function. */
-#undef HAVE_DLCLOSE
-
-/* Define to 1 if you have the `dlerror' function. */
-#undef HAVE_DLERROR
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
-
-/* Define to 1 if you have the `dlopen' function. */
-#undef HAVE_DLOPEN
-
-/* Define to 1 if you have the `dlsym' function. */
-#undef HAVE_DLSYM
-
-/* Define to 1 if you have the `endnetgrent' function. */
-#undef HAVE_ENDNETGRENT
-
-/* Define to 1 if you have the `epoll_create' function. */
-#undef HAVE_EPOLL_CREATE
-
-/* Whether errno() is available */
-#undef HAVE_ERRNO_DECL
-
-/* Define to 1 if you have the <fcntl.h> header file. */
-#undef HAVE_FCNTL_H
-
-/* Define to 1 if you have the <fnmatch.h> header file. */
-#undef HAVE_FNMATCH_H
-
-/* Define to 1 if you have the `ftruncate' function. */
-#undef HAVE_FTRUNCATE
-
-/* Whether there is a __FUNCTION__ macro */
-#undef HAVE_FUNCTION_MACRO
-
-/* Define to 1 if you have the `getdents' function. */
-#undef HAVE_GETDENTS
-
-/* Define to 1 if you have the `getdirentries' function. */
-#undef HAVE_GETDIRENTRIES
-
-/* Define to 1 if you have the `getnetgrent' function. */
-#undef HAVE_GETNETGRENT
-
-/* Define to 1 if you have the <getopt.h> header file. */
-#undef HAVE_GETOPT_H
-
-/* Define to 1 if you have the `getpagesize' function. */
-#undef HAVE_GETPAGESIZE
-
-/* Define to 1 if you have the `getpgrp' function. */
-#undef HAVE_GETPGRP
-
-/* Define to 1 if you have the <grp.h> header file. */
-#undef HAVE_GRP_H
-
-/* Whether the compiler supports immediate structures */
-#undef HAVE_IMMEDIATE_STRUCTURES
-
-/* Define to 1 if you have the `initgroups' function. */
-#undef HAVE_INITGROUPS
-
-/* Define to 1 if you have the `innetgr' function. */
-#undef HAVE_INNETGR
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the <limits.h> header file. */
-#undef HAVE_LIMITS_H
-
-/* Define to 1 if you have the <locale.h> header file. */
-#undef HAVE_LOCALE_H
-
-/* Define to 1 if the system has the type `long long'. */
-#undef HAVE_LONG_LONG
-
-/* Define to 1 if you have the `lstat' function. */
-#undef HAVE_LSTAT
-
-/* Define to 1 if you have the `memcpy' function. */
-#undef HAVE_MEMCPY
-
-/* Define to 1 if you have the `memmove' function. */
-#undef HAVE_MEMMOVE
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the `memset' function. */
-#undef HAVE_MEMSET
-
-/* Define if target mkdir supports mode option */
-#undef HAVE_MKDIR_MODE
-
-/* Define to 1 if you have the `mkdtemp' function. */
-#undef HAVE_MKDTEMP
-
-/* Define to 1 if you have the `mktime' function. */
-#undef HAVE_MKTIME
-
-/* Define to 1 if you have the `mmap' function. */
-#undef HAVE_MMAP
-
-/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
-#undef HAVE_NDIR_H
-
-/* Define to 1 if you have the <netdb.h> header file. */
-#undef HAVE_NETDB_H
-
-/* Define to 1 if you have the <netinet/in.h> header file. */
-#undef HAVE_NETINET_IN_H
-
-/* Define to 1 if you have the <netinet/in_ip.h> header file. */
-#undef HAVE_NETINET_IN_IP_H
-
-/* Define to 1 if you have the <netinet/in_systm.h> header file. */
-#undef HAVE_NETINET_IN_SYSTM_H
-
-/* Define to 1 if you have the <netinet/ip.h> header file. */
-#undef HAVE_NETINET_IP_H
-
-/* Define to 1 if you have the <netinet/tcp.h> header file. */
-#undef HAVE_NETINET_TCP_H
-
-/* usability of net/if.h */
-#undef HAVE_NET_IF_H
-
-/* Whether the open(2) accepts O_DIRECT */
-#undef HAVE_OPEN_O_DIRECT
-
-/* Define to 1 if you have the `pipe' function. */
-#undef HAVE_PIPE
-
-/* Define to 1 if you have the `pread' function. */
-#undef HAVE_PREAD
-
-/* Whether pread() is available */
-#undef HAVE_PREAD_DECL
-
-/* Define to 1 if you have the `printf' function. */
-#undef HAVE_PRINTF
-
-/* Define to 1 if you have the <pwd.h> header file. */
-#undef HAVE_PWD_H
-
-/* Define to 1 if you have the `pwrite' function. */
-#undef HAVE_PWRITE
-
-/* Whether pwrite() is available */
-#undef HAVE_PWRITE_DECL
-
-/* Define to 1 if you have the `rand' function. */
-#undef HAVE_RAND
-
-/* Define to 1 if you have the `random' function. */
-#undef HAVE_RANDOM
-
-/* Define to 1 if you have the `rename' function. */
-#undef HAVE_RENAME
-
-/* Whether mkstemp is secure */
-#undef HAVE_SECURE_MKSTEMP
-
-/* Define to 1 if you have the `setbuffer' function. */
-#undef HAVE_SETBUFFER
-
-/* Define to 1 if you have the `setegid' function. */
-#undef HAVE_SETEGID
-
-/* Define to 1 if you have the `setenv' function. */
-#undef HAVE_SETENV
-
-/* Define to 1 if you have the `seteuid' function. */
-#undef HAVE_SETEUID
-
-/* Define to 1 if you have the `setlinebuf' function. */
-#undef HAVE_SETLINEBUF
-
-/* Define to 1 if you have the `setnetgrent' function. */
-#undef HAVE_SETNETGRENT
-
-/* Define to 1 if you have the `setresgid' function. */
-#undef HAVE_SETRESGID
-
-/* Whether setresgid() is available */
-#undef HAVE_SETRESGID_DECL
-
-/* Define to 1 if you have the `setresuid' function. */
-#undef HAVE_SETRESUID
-
-/* Whether setresuid() is available */
-#undef HAVE_SETRESUID_DECL
-
-/* Define to 1 if you have the <shadow.h> header file. */
-#undef HAVE_SHADOW_H
-
-/* Whether we have the atomic_t variable type */
-#undef HAVE_SIG_ATOMIC_T_TYPE
-
-/* Define to 1 if you have the `snprintf' function. */
-#undef HAVE_SNPRINTF
-
-/* Define to 1 if you have the `socketpair' function. */
-#undef HAVE_SOCKETPAIR
-
-/* Define to 1 if you have the `srand' function. */
-#undef HAVE_SRAND
-
-/* Define to 1 if you have the `srandom' function. */
-#undef HAVE_SRANDOM
-
-/* Define to 1 if you have the <standards.h> header file. */
-#undef HAVE_STANDARDS_H
-
-/* Define to 1 if you have the <stdarg.h> header file. */
-#undef HAVE_STDARG_H
-
-/* Define to 1 if you have the <stdbool.h> header file. */
-#undef HAVE_STDBOOL_H
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdio.h> header file. */
-#undef HAVE_STDIO_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the `strcasestr' function. */
-#undef HAVE_STRCASESTR
-
-/* Define to 1 if you have the `strdup' function. */
-#undef HAVE_STRDUP
-
-/* Define to 1 if you have the `strerror' function. */
-#undef HAVE_STRERROR
-
-/* Define to 1 if you have the `strftime' function. */
-#undef HAVE_STRFTIME
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the `strlcat' function. */
-#undef HAVE_STRLCAT
-
-/* Define to 1 if you have the `strlcpy' function. */
-#undef HAVE_STRLCPY
-
-/* Define to 1 if you have the `strndup' function. */
-#undef HAVE_STRNDUP
-
-/* Define to 1 if you have the `strnlen' function. */
-#undef HAVE_STRNLEN
-
-/* Define to 1 if you have the `strtok_r' function. */
-#undef HAVE_STRTOK_R
-
-/* Define to 1 if you have the `strtoll' function. */
-#undef HAVE_STRTOLL
-
-/* Define to 1 if you have the `strtoq' function. */
-#undef HAVE_STRTOQ
-
-/* Define to 1 if you have the `strtoull' function. */
-#undef HAVE_STRTOULL
-
-/* Define to 1 if you have the `strtouq' function. */
-#undef HAVE_STRTOUQ
-
-/* Define to 1 if `st_rdev' is member of `struct stat'. */
-#undef HAVE_STRUCT_STAT_ST_RDEV
-
-/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use
- `HAVE_STRUCT_STAT_ST_RDEV' instead. */
-#undef HAVE_ST_RDEV
-
-/* Define to 1 if you have the `syslog' function. */
-#undef HAVE_SYSLOG
-
-/* Define to 1 if you have the <syslog.h> header file. */
-#undef HAVE_SYSLOG_H
-
-/* Define to 1 if you have the <sys/acl.h> header file. */
-#undef HAVE_SYS_ACL_H
-
-/* Define to 1 if you have the <sys/capability.h> header file. */
-#undef HAVE_SYS_CAPABILITY_H
-
-/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
- */
-#undef HAVE_SYS_DIR_H
-
-/* Define to 1 if you have the <sys/epoll.h> header file. */
-#undef HAVE_SYS_EPOLL_H
-
-/* Define to 1 if you have the <sys/fcntl.h> header file. */
-#undef HAVE_SYS_FCNTL_H
-
-/* Define to 1 if you have the <sys/filio.h> header file. */
-#undef HAVE_SYS_FILIO_H
-
-/* Define to 1 if you have the <sys/filsys.h> header file. */
-#undef HAVE_SYS_FILSYS_H
-
-/* Define to 1 if you have the <sys/fs/s5param.h> header file. */
-#undef HAVE_SYS_FS_S5PARAM_H
-
-/* Define to 1 if you have the <sys/id.h> header file. */
-#undef HAVE_SYS_ID_H
-
-/* Define to 1 if you have the <sys/ioctl.h> header file. */
-#undef HAVE_SYS_IOCTL_H
-
-/* Define to 1 if you have the <sys/ipc.h> header file. */
-#undef HAVE_SYS_IPC_H
-
-/* Define to 1 if you have the <sys/mman.h> header file. */
-#undef HAVE_SYS_MMAN_H
-
-/* Define to 1 if you have the <sys/mode.h> header file. */
-#undef HAVE_SYS_MODE_H
-
-/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
- */
-#undef HAVE_SYS_NDIR_H
-
-/* Define to 1 if you have the <sys/param.h> header file. */
-#undef HAVE_SYS_PARAM_H
-
-/* Define to 1 if you have the <sys/priv.h> header file. */
-#undef HAVE_SYS_PRIV_H
-
-/* Define to 1 if you have the <sys/resource.h> header file. */
-#undef HAVE_SYS_RESOURCE_H
-
-/* Define to 1 if you have the <sys/security.h> header file. */
-#undef HAVE_SYS_SECURITY_H
-
-/* Define to 1 if you have the <sys/select.h> header file. */
-#undef HAVE_SYS_SELECT_H
-
-/* Define to 1 if you have the <sys/shm.h> header file. */
-#undef HAVE_SYS_SHM_H
-
-/* Define to 1 if you have the <sys/socket.h> header file. */
-#undef HAVE_SYS_SOCKET_H
-
-/* Define to 1 if you have the <sys/sockio.h> header file. */
-#undef HAVE_SYS_SOCKIO_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/syslog.h> header file. */
-#undef HAVE_SYS_SYSLOG_H
-
-/* Define to 1 if you have the <sys/termio.h> header file. */
-#undef HAVE_SYS_TERMIO_H
-
-/* Define to 1 if you have the <sys/time.h> header file. */
-#undef HAVE_SYS_TIME_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <sys/un.h> header file. */
-#undef HAVE_SYS_UN_H
-
-/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
-#undef HAVE_SYS_WAIT_H
-
-/* Define to 1 if you have the <termios.h> header file. */
-#undef HAVE_TERMIOS_H
-
-/* Define to 1 if you have the <termio.h> header file. */
-#undef HAVE_TERMIO_H
-
-/* Define to 1 if you have the `timegm' function. */
-#undef HAVE_TIMEGM
-
-/* Define to 1 if you have the <time.h> header file. */
-#undef HAVE_TIME_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define to 1 if you have the `usleep' function. */
-#undef HAVE_USLEEP
-
-/* Define to 1 if you have the `utime' function. */
-#undef HAVE_UTIME
-
-/* Define to 1 if you have the <utime.h> header file. */
-#undef HAVE_UTIME_H
-
-/* Define to 1 if you have the <vararg.h> header file. */
-#undef HAVE_VARARG_H
-
-/* Define to 1 if you have the `vasprintf' function. */
-#undef HAVE_VASPRINTF
-
-/* Whether va_copy() is available */
-#undef HAVE_VA_COPY
-
-/* Whether the C compiler understands volatile */
-#undef HAVE_VOLATILE
-
-/* Define to 1 if you have the `vsnprintf' function. */
-#undef HAVE_VSNPRINTF
-
-/* Define to 1 if you have the `vsyslog' function. */
-#undef HAVE_VSYSLOG
-
-/* Define to 1 if you have the `waitpid' function. */
-#undef HAVE_WAITPID
-
-/* Define to 1 if you have the <windows.h> header file. */
-#undef HAVE_WINDOWS_H
-
-/* Define to 1 if you have the <winsock2.h> header file. */
-#undef HAVE_WINSOCK2_H
-
-/* Define to 1 if you have the <ws2tcpip.h> header file. */
-#undef HAVE_WS2TCPIP_H
-
-/* Whether the _Bool type is available */
-#undef HAVE__Bool
-
-/* Whether the __VA_ARGS__ macro is available */
-#undef HAVE__VA_ARGS__MACRO
-
-/* Define to 1 if you have the `__strtoll' function. */
-#undef HAVE___STRTOLL
-
-/* Define to 1 if you have the `__strtoull' function. */
-#undef HAVE___STRTOULL
-
-/* Whether __va_copy() is available */
-#undef HAVE___VA_COPY
-
-/* Whether there is a __func__ macro */
-#undef HAVE_func_MACRO
-
-/* Whether MMAP is broken */
-#undef MMAP_BLACKLIST
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Whether getpass should be replaced */
-#undef REPLACE_GETPASS
-
-/* Whether inet_ntoa should be replaced */
-#undef REPLACE_INET_NTOA
-
-/* replace readdir */
-#undef REPLACE_READDIR
-
-/* replace readdir using getdents() */
-#undef REPLACE_READDIR_GETDENTS
-
-/* replace readdir using getdirentries() */
-#undef REPLACE_READDIR_GETDIRENTRIES
-
-/* Define as the return type of signal handlers (`int' or `void'). */
-#undef RETSIGTYPE
-
-/* Whether seekdir returns an int */
-#undef SEEKDIR_RETURNS_INT
-
-/* The size of `char', as computed by sizeof. */
-#undef SIZEOF_CHAR
-
-/* The size of `int', as computed by sizeof. */
-#undef SIZEOF_INT
-
-/* The size of `long', as computed by sizeof. */
-#undef SIZEOF_LONG
-
-/* The size of `long long', as computed by sizeof. */
-#undef SIZEOF_LONG_LONG
-
-/* The size of `off_t', as computed by sizeof. */
-#undef SIZEOF_OFF_T
-
-/* The size of `short', as computed by sizeof. */
-#undef SIZEOF_SHORT
-
-/* The size of `size_t', as computed by sizeof. */
-#undef SIZEOF_SIZE_T
-
-/* The size of `ssize_t', as computed by sizeof. */
-#undef SIZEOF_SSIZE_T
-
-/* The size of `void *', as computed by sizeof. */
-#undef SIZEOF_VOID_P
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Whether telldir takes a const pointer */
-#undef TELLDIR_TAKES_CONST_DIR
-
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
-
-/* Define to 1 if your processor stores words with the most significant byte
- first (like Motorola and SPARC, unlike Intel and VAX). */
-#undef WORDS_BIGENDIAN
-
-/* Define to 1 if on AIX 3.
- System headers sometimes define this.
- We just want to avoid a redefinition error message. */
-#ifndef _ALL_SOURCE
-# undef _ALL_SOURCE
-#endif
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-#undef _FILE_OFFSET_BITS
-
-/* Enable GNU extensions on systems that have them. */
-#ifndef _GNU_SOURCE
-# undef _GNU_SOURCE
-#endif
-
-/* Define for large files, on AIX-style hosts. */
-#undef _LARGE_FILES
-
-/* Define to 1 if on MINIX. */
-#undef _MINIX
-
-#ifndef _OSF_SOURCE
-# define _OSF_SOURCE 1
-#endif
-
-/* Define to 2 if the system does not provide POSIX.1 features except with
- this defined. */
-#undef _POSIX_1_SOURCE
-
-/* Whether to enable POSIX support */
-#undef _POSIX_C_SOURCE
-
-/* Define to 1 if you need to in order for `stat' and other things to work. */
-#undef _POSIX_SOURCE
-
-/* Whether to enable System V compatibility */
-#undef _SYSV
-
-#ifndef _XOPEN_SOURCE_EXTENDED
-# define _XOPEN_SOURCE_EXTENDED 1
-#endif
-
-/* Enable extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-#undef gid_t
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
- calls it, or to nothing if 'inline' is not supported under any name. */
-#ifndef __cplusplus
-#undef inline
-#endif
-
-/* Define to `unsigned' if <sys/types.h> does not define. */
-#undef ino_t
-
-/* Define to `short' if <sys/types.h> does not define. */
-#undef int16_t
-
-/* Define to `long' if <sys/types.h> does not define. */
-#undef int32_t
-
-/* Define to `long long' if <sys/types.h> does not define. */
-#undef int64_t
-
-/* Define to `char' if <sys/types.h> does not define. */
-#undef int8_t
-
-/* Define to `unsigned long long' if <sys/types.h> does not define. */
-#undef intptr_t
-
-/* Define to `off_t' if <sys/types.h> does not define. */
-#undef loff_t
-
-/* Define to `int' if <sys/types.h> does not define. */
-#undef mode_t
-
-/* Define to `long int' if <sys/types.h> does not define. */
-#undef off_t
-
-/* Define to `loff_t' if <sys/types.h> does not define. */
-#undef offset_t
-
-/* Define to `int' if <sys/types.h> does not define. */
-#undef pid_t
-
-/* Define to `unsigned long long' if <sys/types.h> does not define. */
-#undef ptrdiff_t
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-#undef size_t
-
-/* Socket length type */
-#undef socklen_t
-
-/* Define to `int' if <sys/types.h> does not define. */
-#undef ssize_t
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-#undef uid_t
-
-/* Define to `unsigned short' if <sys/types.h> does not define. */
-#undef uint16_t
-
-/* Define to `unsigned long' if <sys/types.h> does not define. */
-#undef uint32_t
-
-/* Define to `unsigned long long' if <sys/types.h> does not define. */
-#undef uint64_t
-
-/* Define to `unsigned char' if <sys/types.h> does not define. */
-#undef uint8_t
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-#undef uint_t
diff --git a/ctdb/ib/ibwrapper.c b/ctdb/ib/ibwrapper.c
index 268469d9e1..998a0167d7 100644
--- a/ctdb/ib/ibwrapper.c
+++ b/ctdb/ib/ibwrapper.c
@@ -21,8 +21,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "ibwrapper.h"
-
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@@ -32,9 +30,15 @@
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
+#include <malloc.h>
+#include <assert.h>
+#include <unistd.h>
-#include <rdma/rdma_cma.h>
+#include "includes.h"
#include "lib/events/events.h"
+#include "ibwrapper.h"
+
+#include <rdma/rdma_cma.h>
#include "ibwrapper_internal.h"
#include "lib/util/dlinklist.h"
@@ -44,6 +48,8 @@ static char ibw_lasterr[IBW_LASTERR_BUFSIZE];
static void ibw_event_handler_verbs(struct event_context *ev,
struct fd_event *fde, uint16_t flags, void *private_data);
+static int ibw_fill_cq(struct ibw_conn *conn);
+
static int ibw_init_memory(struct ibw_conn *conn)
{
@@ -53,7 +59,7 @@ static int ibw_init_memory(struct ibw_conn *conn)
int i;
struct ibw_wr *p;
- pconn->buf = memalign(pctx->page_size, pctx->max_msg_size);
+ pconn->buf = memalign(pctx->pagesize, pctx->max_msg_size);
if (!pconn->buf) {
sprintf(ibw_lasterr, "couldn't allocate work buf\n");
return -1;
@@ -72,17 +78,14 @@ static int ibw_init_memory(struct ibw_conn *conn)
p->msg = pconn->buf + (i * pctx->max_msg_size);
p->wr_id = i;
- DLIST_ADD(pconn->mr_list_avail, p);
+ DLIST_ADD(pconn->wr_list_avail, p);
}
return 0;
}
-static int ibw_ctx_priv_destruct(void *ptr)
+static int ibw_ctx_priv_destruct(struct ibw_ctx_priv *pctx)
{
- struct ibw_ctx *pctx = talloc_get_type(ctx->internal, struct ibw_ctx_priv);
- assert(pctx!=NULL);
-
if (pctx->pd) {
ibv_dealloc_pd(pctx->pd);
pctx->pd = NULL;
@@ -102,21 +105,17 @@ static int ibw_ctx_priv_destruct(void *ptr)
rdma_destroy_id(pctx->cm_id);
pctx->cm_id = NULL;
}
+
+ return 0;
}
-static int ibw_ctx_destruct(void *ptr)
+static int ibw_ctx_destruct(struct ibw_ctx *ctx)
{
- struct ibw_ctx *ctx = talloc_get_type(ptr, struct ibw_ctx);
- assert(ctx!=NULL);
-
return 0;
}
-static int ibw_conn_priv_destruct(void *ptr)
+static int ibw_conn_priv_destruct(struct ibw_conn_priv *pconn)
{
- struct ibw_conn *pconn = talloc_get_type(ptr, struct ibw_conn_priv);
- assert(pconn!=NULL);
-
/* free memory regions */
if (pconn->mr) {
ibv_dereg_mr(pconn->mr);
@@ -132,8 +131,8 @@ static int ibw_conn_priv_destruct(void *ptr)
/* destroy verbs */
if (pconn->cm_id->qp) {
- ibv_destroy_qp(pconn->qp);
- pconn->qp = NULL;
+ ibv_destroy_qp(pconn->cm_id->qp);
+ pconn->cm_id->qp = NULL;
}
if (pconn->cq) {
ibv_destroy_cq(pconn->cq);
@@ -149,21 +148,16 @@ static int ibw_conn_priv_destruct(void *ptr)
pconn->verbs_channel_event = NULL;
}
if (pconn->cm_id) {
- rdma_destroy_id(pctx->cm_id);
- pctx->cm_id = NULL;
+ rdma_destroy_id(pconn->cm_id);
+ pconn->cm_id = NULL;
}
+ return 0;
}
-static int ibw_conn_destruct(void *ptr)
+static int ibw_conn_destruct(struct ibw_conn *conn)
{
- struct ibw_conn *conn = talloc_get_type(ptr, struct ibw_conn);
- struct ibw_ctx *ctx;
-
- assert(conn!=NULL);
- ctx = ibw_conn->ctx;
- assert(ctx!=NULL);
-
- DLIST_REMOVE(ctx->conn_list, conn);
+ /* important here: ctx is a talloc _parent_ */
+ DLIST_REMOVE(conn->ctx->conn_list, conn);
return 0;
}
@@ -174,11 +168,11 @@ static struct ibw_conn *ibw_conn_new(struct ibw_ctx *ctx)
conn = talloc_zero(ctx, struct ibw_conn);
assert(conn!=NULL);
- talloc_set_destructor(conn, struct ibw_conn_destruct);
+ talloc_set_destructor(conn, ibw_conn_destruct);
pconn = talloc_zero(ctx, struct ibw_conn_priv);
assert(pconn!=NULL);
- talloc_set_destructor(pconn, struct ibw_conn_priv_destruct);
+ talloc_set_destructor(pconn, ibw_conn_priv_destruct);
conn->ctx = ctx;
@@ -202,17 +196,17 @@ static int ibw_setup_cq_qp(struct ibw_conn *conn)
pconn->verbs_channel = ibv_create_comp_channel(pconn->cm_id->verbs);
if (!pconn->verbs_channel) {
sprintf(ibw_lasterr, "ibv_create_comp_channel failed %d\n", errno);
- goto cleanup;
+ return -1;
}
- DEBUG(10, "created channel %p\n", pconn->channel);
+ DEBUG(10, ("created channel %p\n", pconn->verbs_channel));
pconn->verbs_channel_event = event_add_fd(pctx->ectx, conn,
pconn->verbs_channel->fd, EVENT_FD_READ, ibw_event_handler_verbs, conn);
/* init cq */
- pconn->cq = ibv_create_cq(conn->cm_id->verbs, pctx->qsize,
+ pconn->cq = ibv_create_cq(pconn->cm_id->verbs, pctx->qsize,
conn, pconn->verbs_channel, 0);
- if (cq==NULL) {
+ if (pconn->cq==NULL) {
sprintf(ibw_lasterr, "ibv_create_cq failed\n");
return -1;
}
@@ -233,21 +227,21 @@ static int ibw_setup_cq_qp(struct ibw_conn *conn)
init_attr.send_cq = pconn->cq;
init_attr.recv_cq = pconn->cq;
- rc = rdma_create_qp(conn->cm_id, pctx->pd, &init_attr);
+ rc = rdma_create_qp(pconn->cm_id, pctx->pd, &init_attr);
if (rc) {
- sprintf(ibw_lasterr, "rdma_create_qp (%d) failed with %d\n", is_server, rc);
+ sprintf(ibw_lasterr, "rdma_create_qp failed with %d\n", rc);
return rc;
}
/* elase result is in pconn->cm_id->qp */
- return rc;
+ return ibw_fill_cq(conn);
}
static int ibw_refill_cq_recv(struct ibw_conn *conn)
{
struct ibw_ctx_priv *pctx = talloc_get_type(conn->ctx->internal, struct ibw_ctx_priv);
struct ibw_conn_priv *pconn = talloc_get_type(conn->internal, struct ibw_conn_priv);
- int i, rc;
+ int rc;
struct ibv_sge list = {
.addr = (uintptr_t) NULL,
.length = pctx->max_msg_size,
@@ -262,19 +256,19 @@ static int ibw_refill_cq_recv(struct ibw_conn *conn)
struct ibw_wr *p = pconn->wr_list_avail;
if (p==NULL) {
- sprintf(ibw_last_err, "out of wr_list_avail");
- DEBUG(0, ibw_last_err);
+ sprintf(ibw_lasterr, "out of wr_list_avail");
+ DEBUG(0, (ibw_lasterr));
return -1;
}
DLIST_REMOVE(pconn->wr_list_avail, p);
DLIST_ADD(pconn->wr_list_used, p);
- list.addr = p->msg;
+ list.addr = (uintptr_t) p->msg;
wr.wr_id = p->wr_id;
- rc = ibv_post_recv(pconn->qp, &wr, &bad_wr);
+ rc = ibv_post_recv(pconn->cm_id->qp, &wr, &bad_wr);
if (rc) {
sprintf(ibw_lasterr, "ibv_post_recv failed with %d\n", rc);
- DEBUG(0, ibw_last_err);
+ DEBUG(0, (ibw_lasterr));
return -2;
}
@@ -302,19 +296,19 @@ static int ibw_fill_cq(struct ibw_conn *conn)
for(i = pctx->opts.max_recv_wr; i!=0; i--) {
p = pconn->wr_list_avail;
if (p==NULL) {
- sprintf(ibw_last_err, "out of wr_list_avail");
- DEBUG(0, ibw_last_err);
+ sprintf(ibw_lasterr, "out of wr_list_avail");
+ DEBUG(0, (ibw_lasterr));
return -1;
}
DLIST_REMOVE(pconn->wr_list_avail, p);
DLIST_ADD(pconn->wr_list_used, p);
- list.addr = p->msg;
+ list.addr = (uintptr_t) p->msg;
wr.wr_id = p->wr_id;
- rc = ibv_post_recv(pconn->qp, &wr, &bad_wr);
+ rc = ibv_post_recv(pconn->cm_id->qp, &wr, &bad_wr);
if (rc) {
sprintf(ibw_lasterr, "ibv_post_recv failed with %d\n", rc);
- DEBUG(0, ibw_last_err);
+ DEBUG(0, (ibw_lasterr));
return -2;
}
}
@@ -365,15 +359,14 @@ static void ibw_event_handler_cm(struct event_context *ev,
}
cma_id = event->id;
- DEBUG(10, "cma_event type %d cma_id %p (%s)\n", event->event, id,
- (cma_id == ctx->cm_id) ? "parent" : "child");
+ DEBUG(10, ("cma_event type %d cma_id %p (%s)\n", event->event, cma_id,
+ (cma_id == pctx->cm_id) ? "parent" : "child"));
switch (event->event) {
case RDMA_CM_EVENT_ADDR_RESOLVED:
/* continuing from ibw_connect ... */
rc = rdma_resolve_route(cma_id, 2000);
if (rc) {
- ctx->state = ERROR;
sprintf(ibw_lasterr, "rdma_resolve_route error %d\n", rc);
goto error;
}
@@ -397,7 +390,7 @@ static void ibw_event_handler_cm(struct event_context *ev,
pconn = talloc_get_type(conn->internal, struct ibw_conn_priv);
pconn->cm_id = cma_id; /* !!! event will be freed but id not */
cma_id->context = (void *)conn;
- DEBUG(10, "pconn->cm_id %p\n", pconn->cm_id);
+ DEBUG(10, ("pconn->cm_id %p\n", pconn->cm_id));
conn->state = IBWC_INIT;
pctx->connstate_func(ctx, conn);
@@ -405,9 +398,9 @@ static void ibw_event_handler_cm(struct event_context *ev,
/* continued at ibw_accept when invoked by the func above */
if (!pconn->is_accepted) {
talloc_free(conn);
- DEBUG(10, "pconn->cm_id %p wasn't accepted\n", pconn->cm_id);
+ DEBUG(10, ("pconn->cm_id %p wasn't accepted\n", pconn->cm_id));
} else {
- if (ibw_setup_cq_qp(ctx, conn))
+ if (ibw_setup_cq_qp(conn))
goto error;
}
@@ -420,7 +413,7 @@ static void ibw_event_handler_cm(struct event_context *ev,
case RDMA_CM_EVENT_ESTABLISHED:
/* expected after ibw_accept and ibw_connect[not directly] */
- DEBUG(0, "ESTABLISHED (conn: %u)\n", cma_id->context);
+ DEBUG(0, ("ESTABLISHED (conn: %u)\n", (unsigned int)cma_id->context));
conn = talloc_get_type(cma_id->context, struct ibw_conn);
assert(conn!=NULL); /* important assumption */
@@ -440,8 +433,8 @@ static void ibw_event_handler_cm(struct event_context *ev,
goto error;
case RDMA_CM_EVENT_DISCONNECTED:
- if (cma_id!=ctx->cm_id) {
- DEBUG(0, "client DISCONNECT event\n");
+ if (cma_id!=pctx->cm_id) {
+ DEBUG(0, ("client DISCONNECT event\n"));
conn = talloc_get_type(cma_id->context, struct ibw_conn);
conn->state = IBWC_DISCONNECTED;
pctx->connstate_func(NULL, conn);
@@ -450,9 +443,9 @@ static void ibw_event_handler_cm(struct event_context *ev,
/* if we are the last... */
if (ctx->conn_list==NULL)
- rdma_disconnect(ctx->cm_id);
+ rdma_disconnect(pctx->cm_id);
} else {
- DEBUG(0, "server DISCONNECT event\n");
+ DEBUG(0, ("server DISCONNECT event\n"));
ctx->state = IBWS_STOPPED; /* ??? TODO: try it... */
/* talloc_free(ctx) should be called within or after this func */
pctx->connstate_func(ctx, NULL);
@@ -469,14 +462,14 @@ static void ibw_event_handler_cm(struct event_context *ev,
}
if ((rc=rdma_ack_cm_event(event))) {
- sprintf(ibw_lasterr, "rdma_ack_cm_event failed with %d\n");
+ sprintf(ibw_lasterr, "rdma_ack_cm_event failed with %d\n", rc);
goto error;
}
return;
error:
- DEBUG(0, "cm event handler: %s", ibw_lasterr);
- if (cma_id!=ctx->cm_id) {
+ DEBUG(0, ("cm event handler: %s", ibw_lasterr));
+ if (cma_id!=pctx->cm_id) {
conn = talloc_get_type(cma_id->context, struct ibw_conn);
if (conn)
conn->state = IBWC_ERROR;
@@ -490,14 +483,14 @@ error:
static void ibw_event_handler_verbs(struct event_context *ev,
struct fd_event *fde, uint16_t flags, void *private_data)
{
- struct ibw_ctx *conn = talloc_get_type(private_data, struct ibw_conn);
- struct ibw_ctx_priv *pconn = talloc_get_type(conn->internal, struct ibw_ctx_priv);
- struct ibw_ctx *pctx = talloc_get_type(conn->ctx->internal, struct ibw_ctx_priv);
+ struct ibw_conn *conn = talloc_get_type(private_data, struct ibw_conn);
+ struct ibw_conn_priv *pconn = talloc_get_type(conn->internal, struct ibw_conn_priv);
+ struct ibw_ctx_priv *pctx = talloc_get_type(conn->ctx->internal, struct ibw_ctx_priv);
struct ibv_wc wc;
int rc;
- rc = ibv_poll_cq(conn->cq, 1, &wc);
+ rc = ibv_poll_cq(pconn->cq, 1, &wc);
if (rc!=1) {
sprintf(ibw_lasterr, "ibv_poll_cq error %d\n", rc);
goto error;
@@ -513,8 +506,8 @@ static void ibw_event_handler_verbs(struct event_context *ev,
{
struct ibw_wr *p;
- DEBUG(10, "send completion\n");
- assert(pconn->qp->qp_num==wc.qp_num);
+ DEBUG(10, ("send completion\n"));
+ assert(pconn->cm_id->qp->qp_num==wc.qp_num);
assert(wc.wr_id < pctx->qsize);
p = pconn->wr_index[wc.wr_id];
DLIST_REMOVE(pconn->wr_list_used, p);
@@ -523,25 +516,25 @@ static void ibw_event_handler_verbs(struct event_context *ev,
break;
case IBV_WC_RDMA_WRITE:
- DEBUG(10, "rdma write completion\n");
+ DEBUG(10, ("rdma write completion\n"));
break;
case IBV_WC_RDMA_READ:
- DEBUG(10, "rdma read completion\n");
+ DEBUG(10, ("rdma read completion\n"));
break;
case IBV_WC_RECV:
{
struct ibw_wr *p;
- assert(pconn->qp->qp_num==wc.qp_num);
+ assert(pconn->cm_id->qp->qp_num==wc.qp_num);
assert(wc.wr_id < pctx->qsize);
p = pconn->wr_index[wc.wr_id];
DLIST_REMOVE(pconn->wr_list_used, p);
DLIST_ADD(pconn->wr_list_avail, p);
- DEBUG(10, "recv completion\n");
+ DEBUG(10, ("recv completion\n"));
assert(wc.byte_len <= pctx->max_msg_size);
pctx->receive_func(conn, p->msg, wc.byte_len);
@@ -557,15 +550,15 @@ static void ibw_event_handler_verbs(struct event_context *ev,
return;
error:
- DEBUG(0, ibw_lasterr);
- conn->status = IBWC_ERROR;
+ DEBUG(0, (ibw_lasterr));
+ conn->state = IBWC_ERROR;
pctx->connstate_func(NULL, conn);
}
static int ibw_process_init_attrs(struct ibw_initattr *attr, int nattr, struct ibw_opts *opts)
{
- int i, mtu;
- char *name, *value;
+ int i;
+ const char *name, *value;
opts->max_send_wr = 256;
opts->max_recv_wr = 1024;
@@ -591,7 +584,7 @@ struct ibw_ctx *ibw_init(struct ibw_initattr *attr, int nattr,
void *ctx_userdata,
ibw_connstate_fn_t ibw_connstate,
ibw_receive_fn_t ibw_receive,
- event_content *ectx,
+ struct event_context *ectx,
int max_msg_size)
{
struct ibw_ctx *ctx = talloc_zero(NULL, struct ibw_ctx);
@@ -604,7 +597,7 @@ struct ibw_ctx *ibw_init(struct ibw_initattr *attr, int nattr,
assert(ctx!=NULL);
ibw_lasterr[0] = '\0';
talloc_set_destructor(ctx, ibw_ctx_destruct);
- ctx->userdata = userdata;
+ ctx->ctx_userdata = ctx_userdata;
pctx = talloc_zero(ctx, struct ibw_ctx_priv);
talloc_set_destructor(pctx, ibw_ctx_priv_destruct);
@@ -617,7 +610,7 @@ struct ibw_ctx *ibw_init(struct ibw_initattr *attr, int nattr,
pctx->ectx = ectx;
/* process attributes */
- if (ibw_process_init_attrs(attr, nattr, pctx->opts))
+ if (ibw_process_init_attrs(attr, nattr, &pctx->opts))
goto cleanup;
/* init cm */
@@ -636,15 +629,15 @@ struct ibw_ctx *ibw_init(struct ibw_initattr *attr, int nattr,
sprintf(ibw_lasterr, "rdma_create_id error %d\n", rc);
goto cleanup;
}
- DEBUG(10, "created cm_id %p\n", pctx->cm_id);
+ DEBUG(10, ("created cm_id %p\n", pctx->cm_id));
/* init verbs */
- pctx->pd = ibv_alloc_pd(pctx->cmid->verbs);
+ pctx->pd = ibv_alloc_pd(pctx->cm_id->verbs);
if (!pctx->pd) {
sprintf(ibw_lasterr, "ibv_alloc_pd failed %d\n", errno);
goto cleanup;
}
- DEBUG(10, "created pd %p\n", pctx->pd);
+ DEBUG(10, ("created pd %p\n", pctx->pd));
pctx->pagesize = sysconf(_SC_PAGESIZE);
pctx->qsize = pctx->opts.max_send_wr + pctx->opts.max_recv_wr;
@@ -653,7 +646,7 @@ struct ibw_ctx *ibw_init(struct ibw_initattr *attr, int nattr,
return ctx;
/* don't put code here */
cleanup:
- DEBUG(0, ibw_lasterr);
+ DEBUG(0, (ibw_lasterr));
if (ctx)
talloc_free(ctx);
@@ -663,7 +656,6 @@ cleanup:
int ibw_stop(struct ibw_ctx *ctx)
{
- struct ibw_ctx_priv *pctx = (struct ibw_ctx_priv *)ctx->internal;
struct ibw_conn *p;
for(p=ctx->conn_list; p!=NULL; p=p->next) {
@@ -684,10 +676,10 @@ int ibw_bind(struct ibw_ctx *ctx, struct sockaddr_in *my_addr)
rc = rdma_bind_addr(pctx->cm_id, (struct sockaddr *) my_addr);
if (rc) {
sprintf(ibw_lasterr, "rdma_bind_addr error %d\n", rc);
- DEBUG(0, ibw_lasterr);
+ DEBUG(0, (ibw_lasterr));
return rc;
}
- DEBUG(10, "rdma_bind_addr successful\n");
+ DEBUG(10, ("rdma_bind_addr successful\n"));
return 0;
}
@@ -697,11 +689,11 @@ int ibw_listen(struct ibw_ctx *ctx, int backlog)
struct ibw_ctx_priv *pctx = talloc_get_type(ctx->internal, struct ibw_ctx_priv);
int rc;
- DEBUG_LOG("rdma_listen...\n");
+ DEBUG(10, ("rdma_listen...\n"));
rc = rdma_listen(pctx->cm_id, backlog);
if (rc) {
- sprintf(ibw_lasterr, "rdma_listen failed: %d\n", ret);
- DEBUG(0, ibw_lasterr);
+ sprintf(ibw_lasterr, "rdma_listen failed: %d\n", rc);
+ DEBUG(0, (ibw_lasterr));
return rc;
}
@@ -710,9 +702,9 @@ int ibw_listen(struct ibw_ctx *ctx, int backlog)
int ibw_accept(struct ibw_ctx *ctx, struct ibw_conn *conn, void *conn_userdata)
{
- struct ibw_ctx_priv *pctx = talloc_get_type(ctx->internal, struct ibw_ctx_priv);
struct ibw_conn_priv *pconn = talloc_get_type(conn->internal, struct ibw_conn_priv);
struct rdma_conn_param conn_param;
+ int rc;
conn->conn_userdata = conn_userdata;
@@ -722,7 +714,7 @@ int ibw_accept(struct ibw_ctx *ctx, struct ibw_conn *conn, void *conn_userdata)
rc = rdma_accept(pconn->cm_id, &conn_param);
if (rc) {
sprintf(ibw_lasterr, "rdma_accept failed %d\n", rc);
- DEBUG(0, ibw_lasterr);
+ DEBUG(0, (ibw_lasterr));
return -1;;
}
@@ -737,6 +729,7 @@ int ibw_connect(struct ibw_ctx *ctx, struct sockaddr_in *serv_addr, void *conn_u
{
struct ibw_ctx_priv *pctx = talloc_get_type(ctx->internal, struct ibw_ctx_priv);
struct ibw_conn *conn = NULL;
+ struct ibw_conn_priv *pconn = NULL;
int rc;
conn = ibw_conn_new(ctx);
@@ -755,7 +748,7 @@ int ibw_connect(struct ibw_ctx *ctx, struct sockaddr_in *serv_addr, void *conn_u
rc = rdma_resolve_addr(pconn->cm_id, NULL, (struct sockaddr *) &serv_addr, 2000);
if (rc) {
sprintf(ibw_lasterr, "rdma_resolve_addr error %d\n", rc);
- DEBUG(0, ibw_lasterr);
+ DEBUG(0, (ibw_lasterr));
return -1;
}
@@ -764,13 +757,17 @@ int ibw_connect(struct ibw_ctx *ctx, struct sockaddr_in *serv_addr, void *conn_u
return 0;
}
-void ibw_disconnect(struct ibw_conn *conn)
+int ibw_disconnect(struct ibw_conn *conn)
{
- struct ibw_conn_priv *pconn = talloc_get_type(conn->internal, struct ibw_conn_priv);
- struct ibw_ctx *ctx = conn->ctx;
- struct ibw_ctx_priv *pctx = talloc_get_type(ctx->internal);
+ int rc;
+ struct ibw_ctx_priv *pctx = talloc_get_type(conn->ctx->internal, struct ibw_ctx_priv);
- rdma_disconnect(pctx->cm_id);
+ rc = rdma_disconnect(pctx->cm_id);
+ if (rc) {
+ sprintf(ibw_lasterr, "ibw_disconnect failed with %d", rc);
+ DEBUG(0, (ibw_lasterr));
+ return rc;
+ }
/* continued at RDMA_CM_EVENT_DISCONNECTED */
@@ -780,31 +777,31 @@ void ibw_disconnect(struct ibw_conn *conn)
int ibw_alloc_send_buf(struct ibw_conn *conn, void **buf, void **key)
{
struct ibw_conn_priv *pconn = talloc_get_type(conn->internal, struct ibw_conn_priv);
- struct ibw_ctx_priv *pctx = talloc_get_type(conn->ctx->internal, struct ibw_ctx_priv);
- struct ibw_wr *p = pctx->wr_list_avail;
+ struct ibw_wr *p = pconn->wr_list_avail;
if (p==NULL) {
- sprintf(ibw_last_err, "insufficient wr chunks\n");
+ sprintf(ibw_lasterr, "insufficient wr chunks\n");
return -1;
}
- DLIST_REMOVE(pctx->wr_list_avail, p);
- DLIST_ADD(pctx->wr_list_used, p);
+ DLIST_REMOVE(pconn->wr_list_avail, p);
+ DLIST_ADD(pconn->wr_list_used, p);
*buf = (void *)p->msg;
*key = (void *)p;
- return pctx->buf;
+ return 0;
}
int ibw_send(struct ibw_conn *conn, void *buf, void *key, int n)
{
- struct ibw_ctx_priv pctx = talloc_get_type(conn->ctx->internal, struct ibw_ctx_priv);
+ struct ibw_ctx_priv *pctx = talloc_get_type(conn->ctx->internal, struct ibw_ctx_priv);
+ struct ibw_conn_priv *pconn = talloc_get_type(conn->internal, struct ibw_conn_priv);
struct ibw_wr *p = talloc_get_type(key, struct ibw_wr);
struct ibv_sge list = {
.addr = (uintptr_t) p->msg,
.length = n,
- .lkey = pctx->mr->lkey
+ .lkey = pconn->mr->lkey
};
struct ibv_send_wr wr = {
.wr_id = p->wr_id,
@@ -818,10 +815,10 @@ int ibw_send(struct ibw_conn *conn, void *buf, void *key, int n)
assert(p->msg==(char *)buf);
assert(n<=pctx->max_msg_size);
- return ibv_post_send(conn->qp, &wr, &bad_wr);
+ return ibv_post_send(pconn->cm_id->qp, &wr, &bad_wr);
}
-const char *ibw_getLastError()
+const char *ibw_getLastError(void)
{
return ibw_lasterr;
}
diff --git a/ctdb/ib/ibwrapper.h b/ctdb/ib/ibwrapper.h
index da80705696..31f7a4f170 100644
--- a/ctdb/ib/ibwrapper.h
+++ b/ctdb/ib/ibwrapper.h
@@ -32,10 +32,10 @@ enum ibw_state_ctx {
};
/* Connection state */
-typedef struct ibw_ctx {
+struct ibw_ctx {
void *ctx_userdata; /* see ibw_init */
- struct ibw_state_ctx state;
+ enum ibw_state_ctx state;
void *internal;
struct ibw_conn *conn_list; /* 1st elem of double linked list */
@@ -50,12 +50,12 @@ enum ibw_state_conn {
struct ibw_conn {
struct ibw_ctx *ctx;
- struct ibw_state_conn state;
+ enum ibw_state_conn state;
void *conn_userdata; /* see ibw_connect and ibw_accept */
void *internal;
- struct ibw_conn *prev, next;
+ struct ibw_conn *prev, *next;
};
/*
@@ -73,7 +73,7 @@ struct ibw_initattr {
* Both <conn> and <ctx> can be NULL if their state didn't change.
* Return nonzero on error.
*/
-typedef int (*ibw_connstate_fn_t)(ibw_ctx *ctx, ibw_conn *conn);
+typedef int (*ibw_connstate_fn_t)(struct ibw_ctx *ctx, struct ibw_conn *conn);
/*
* Callback function definition which should process incoming packets
@@ -174,7 +174,7 @@ int ibw_connect(struct ibw_ctx *ctx, struct sockaddr_in *serv_addr, void *conn_u
* You mustn't talloc_free <conn> yet right after this,
* first wait for IBWC_DISCONNECTED.
*/
-void ibw_disconnect(struct ibw_conn *conn);
+int ibw_disconnect(struct ibw_conn *conn);
/************ Infiniband specific event loop wrapping ******************/
@@ -202,4 +202,4 @@ int ibw_send(struct ibw_conn *conn, void *buf, void *key, int n);
* Retrieves the last error
* result: always non-zero, mustn't be freed (static)
*/
-const char *ibw_getLastError();
+const char *ibw_getLastError(void);
diff --git a/ctdb/ib/ibwrapper_internal.h b/ctdb/ib/ibwrapper_internal.h
index b6d8eb2bc2..04d82f9565 100644
--- a/ctdb/ib/ibwrapper_internal.h
+++ b/ctdb/ib/ibwrapper_internal.h
@@ -29,7 +29,7 @@ struct ibw_opts {
struct ibw_wr {
char *msg; /* initialized in ibw_init_memory once per connection */
int wr_id; /* position in wr_index list; also used as wr id */
- struct _ibw_wr *next, *prev; /* in wr_list_avail or wr_list_used */
+ struct ibw_wr *next, *prev; /* in wr_list_avail or wr_list_used */
};
struct ibw_ctx_priv {
@@ -43,7 +43,6 @@ struct ibw_ctx_priv {
struct fd_event *cm_channel_event;
struct ibv_pd *pd;
- enum iwint_state_ctx state2;
ibw_connstate_fn_t connstate_func; /* see ibw_init */
ibw_receive_fn_t receive_func; /* see ibw_init */