summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/Makefile.am44
-rw-r--r--libglusterfs/src/common-utils.h2
-rw-r--r--libglusterfs/src/compat-uuid.h78
-rw-r--r--libglusterfs/src/gfdb/Makefile.am17
-rw-r--r--libglusterfs/src/gfdb/gfdb_data_store_types.h1
-rw-r--r--libglusterfs/src/iatt.h2
-rw-r--r--libglusterfs/src/inode.h2
-rw-r--r--libglusterfs/src/xlator.h1
8 files changed, 110 insertions, 37 deletions
diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am
index 33de0a287c7..09341d164dd 100644
--- a/libglusterfs/src/Makefile.am
+++ b/libglusterfs/src/Makefile.am
@@ -1,13 +1,13 @@
-libglusterfs_la_CFLAGS = -Wall $(GF_CFLAGS) $(GF_DARWIN_LIBGLUSTERFS_CFLAGS) \
+libglusterfs_la_CFLAGS = $(GF_CFLAGS) $(GF_DARWIN_LIBGLUSTERFS_CFLAGS) \
-DDATADIR=\"$(localstatedir)\"
libglusterfs_la_CPPFLAGS = $(GF_CPPFLAGS) -D__USE_FILE_OFFSET64 \
-DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\" \
-I$(top_srcdir)/rpc/rpc-lib/src/ -I$(CONTRIBDIR)/rbtree \
-I$(CONTRIBDIR)/libexecinfo ${ARGP_STANDALONE_CPPFLAGS} \
- -DSBIN_DIR=\"$(sbindir)\" -lm
+ -DSBIN_DIR=\"$(sbindir)\"
-libglusterfs_la_LIBADD = @LEXLIB@ $(ZLIB_LIBS) $(MATH_LIB)
+libglusterfs_la_LIBADD = @LEXLIB@ $(ZLIB_LIBS) $(MATH_LIB) $(UUID_LIBS)
libglusterfs_la_LDFLAGS = -version-info $(LIBGLUSTERFS_LT_VERSION)
lib_LTLIBRARIES = libglusterfs.la
@@ -20,19 +20,14 @@ libglusterfs_la_SOURCES = dict.c xlator.c logging.c \
compat.c fd.c compat-errno.c event.c mem-pool.c gf-dirent.c syscall.c \
iobuf.c globals.c statedump.c stack.c checksum.c daemon.c timespec.c \
$(CONTRIBDIR)/rbtree/rb.c rbthash.c store.c latency.c \
- graph.c $(CONTRIBDIR)/uuid/clear.c $(CONTRIBDIR)/uuid/copy.c \
- $(CONTRIBDIR)/uuid/gen_uuid.c $(CONTRIBDIR)/uuid/pack.c \
- $(CONTRIBDIR)/uuid/parse.c $(CONTRIBDIR)/uuid/unparse.c \
- $(CONTRIBDIR)/uuid/uuid_time.c $(CONTRIBDIR)/uuid/compare.c \
- $(CONTRIBDIR)/uuid/isnull.c $(CONTRIBDIR)/uuid/unpack.c syncop.c \
- graph-print.c trie.c run.c options.c fd-lk.c circ-buff.c \
- event-history.c gidcache.c ctx.c client_t.c event-poll.c event-epoll.c \
- syncop-utils.c \
- $(CONTRIBDIR)/libgen/basename_r.c $(CONTRIBDIR)/libgen/dirname_r.c \
- $(CONTRIBDIR)/stdlib/gf_mkostemp.c strfd.c parse-utils.c \
- $(CONTRIBDIR)/mount/mntent.c $(CONTRIBDIR)/libexecinfo/execinfo.c\
- quota-common-utils.c rot-buffs.c $(CONTRIBDIR)/timer-wheel/timer-wheel.c \
- $(CONTRIBDIR)/timer-wheel/find_last_bit.c
+ graph.c syncop.c graph-print.c trie.c run.c options.c fd-lk.c \
+ circ-buff.c event-history.c gidcache.c ctx.c client_t.c event-poll.c \
+ event-epoll.c syncop-utils.c $(CONTRIBDIR)/libgen/basename_r.c \
+ $(CONTRIBDIR)/libgen/dirname_r.c $(CONTRIBDIR)/stdlib/gf_mkostemp.c \
+ strfd.c parse-utils.c $(CONTRIBDIR)/mount/mntent.c \
+ $(CONTRIBDIR)/libexecinfo/execinfo.c quota-common-utils.c rot-buffs.c \
+ $(CONTRIBDIR)/timer-wheel/timer-wheel.c \
+ $(CONTRIBDIR)/timer-wheel/find_last_bit.c
nodist_libglusterfs_la_SOURCES = y.tab.c graph.lex.c
@@ -43,16 +38,24 @@ noinst_HEADERS = common-utils.h defaults.h dict.h glusterfs.h hashfn.h timespec.
fd.h revision.h compat-errno.h event.h mem-pool.h byte-order.h \
gf-dirent.h locking.h syscall.h iobuf.h globals.h statedump.h \
checksum.h daemon.h $(CONTRIBDIR)/rbtree/rb.h store.h\
- rbthash.h iatt.h latency.h mem-types.h $(CONTRIBDIR)/uuid/uuidd.h \
- $(CONTRIBDIR)/uuid/uuid.h $(CONTRIBDIR)/uuid/uuidP.h \
- $(CONTRIB_BUILDDIR)/uuid/uuid_types.h syncop.h graph-utils.h trie.h \
+ rbthash.h iatt.h latency.h mem-types.h syncop.h graph-utils.h trie.h \
run.h options.h lkowner.h fd-lk.h circ-buff.h event-history.h \
gidcache.h client_t.h glusterfs-acl.h glfs-message-id.h \
template-component-messages.h strfd.h syncop-utils.h parse-utils.h \
$(CONTRIBDIR)/mount/mntent_compat.h lvm-defaults.h \
$(CONTRIBDIR)/libexecinfo/execinfo_compat.h \
unittest/unittest.h quota-common-utils.h rot-buffs.h \
- $(CONTRIBDIR)/timer-wheel/timer-wheel.h
+ $(CONTRIBDIR)/timer-wheel/timer-wheel.h compat-uuid.h
+
+if !HAVE_LIBUUID
+# FIXME: unbundle libuuid, see compat-uuid.h.
+libglusterfs_la_SOURCES += $(CONTRIBDIR)/uuid/clear.c \
+ $(CONTRIBDIR)/uuid/copy.c $(CONTRIBDIR)/uuid/gen_uuid.c \
+ $(CONTRIBDIR)/uuid/pack.c $(CONTRIBDIR)/uuid/parse.c \
+ $(CONTRIBDIR)/uuid/unparse.c $(CONTRIBDIR)/uuid/uuid_time.c \
+ $(CONTRIBDIR)/uuid/compare.c $(CONTRIBDIR)/uuid/isnull.c \
+ $(CONTRIBDIR)/uuid/unpack.c
+endif
libgfchangelog_HEADERS = changelog.h
@@ -66,7 +69,6 @@ y.tab.h: graph.y
$(YACC) -p graphyy -d $(srcdir)/graph.y
CLEANFILES = graph.lex.c y.tab.c y.tab.h
-CONFIG_CLEAN_FILES = $(CONTRIB_BUILDDIR)/uuid/uuid_types.h
if UNITTEST
CLEANFILES += *.gcda *.gcno *_xunit.xml
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index a93c6233a4e..057c4aeb8dc 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -41,7 +41,7 @@ void trap (void);
#include "glusterfs.h"
#include "locking.h"
#include "mem-pool.h"
-#include "uuid.h"
+#include "compat-uuid.h"
#define STRINGIFY(val) #val
#define TOSTRING(val) STRINGIFY(val)
diff --git a/libglusterfs/src/compat-uuid.h b/libglusterfs/src/compat-uuid.h
new file mode 100644
index 00000000000..4161b958508
--- /dev/null
+++ b/libglusterfs/src/compat-uuid.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
+ * This file is part of GlusterFS.
+ *
+ * This file is licensed to you under your choice of the GNU Lesser
+ * General Public License, version 3 or any later version (LGPLv3 or
+ * later), or the GNU General Public License, version 2 (GPLv2), in all
+ * cases as published by the Free Software Foundation.
+ */
+
+#ifndef _GF_UUID_H
+#define _GF_UUID_H
+
+#if defined(HAVE_LIBUUID) /* Linux like libuuid.so */
+
+#include <uuid.h>
+
+static inline void
+gf_uuid_clear (uuid_t uuid)
+{
+ uuid_clear (uuid);
+}
+
+static inline int
+gf_uuid_compare (uuid_t u1, uuid_t u2)
+{
+ return uuid_compare (u1, u2);
+}
+
+static inline void
+gf_uuid_copy (uuid_t dst, uuid_t src)
+{
+ uuid_copy (dst, src);
+}
+
+static inline void
+gf_uuid_generate (uuid_t uuid)
+{
+ uuid_generate (uuid);
+}
+
+static inline int
+gf_uuid_is_null (uuid_t uuid)
+{
+ return uuid_is_null (uuid);
+}
+
+static inline int
+gf_uuid_parse (const char *in, uuid_t uuid)
+{
+ return uuid_parse (in, uuid);
+}
+
+static inline void
+gf_uuid_unparse (const uuid_t uuid, char *out)
+{
+ uuid_unparse (uuid, out);
+}
+
+/* TODO: add more uuid APIs, use constructs like this:
+#elif defined(__NetBSD__) * NetBSD libc *
+
+#include <string.h>
+
+static inline void
+gf_uuid_clear (uuid_t uuid)
+{
+ memset (uuid, 0, sizeof (uuid_t));
+}
+
+*/
+
+#else /* use bundled Linux like libuuid from contrib/uuid/ */
+
+#include "uuid.h"
+
+#endif /* HAVE_UUID */
+#endif /* _GF_UUID_H */
diff --git a/libglusterfs/src/gfdb/Makefile.am b/libglusterfs/src/gfdb/Makefile.am
index fdc11bf131a..30d1b7bcdde 100644
--- a/libglusterfs/src/gfdb/Makefile.am
+++ b/libglusterfs/src/gfdb/Makefile.am
@@ -5,7 +5,8 @@ libgfdb_la_CPPFLAGS = $(GF_CPPFLAGS) -D__USE_FILE_OFFSET64 -fpic \
-I$(top_srcdir)/libglusterfs/src \
-DDATADIR=\"$(localstatedir)\"
-libgfdb_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la $(SQLITE_LIBS)
+libgfdb_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
+ $(SQLITE_LIBS) $(UUID_LIBS)
libgfdb_la_LDFLAGS = $(GF_LDFLAGS) -version-info $(LIBGLUSTERFS_LT_VERSION)
@@ -18,25 +19,15 @@ endif
CONTRIB_BUILDDIR = $(top_builddir)/contrib
libgfdb_la_SOURCES = gfdb_data_store.c gfdb_sqlite3_helper.c\
- gfdb_sqlite3.c \
- $(CONTRIBDIR)/uuid/clear.c \
- $(CONTRIBDIR)/uuid/copy.c $(CONTRIBDIR)/uuid/gen_uuid.c \
- $(CONTRIBDIR)/uuid/pack.c $(CONTRIBDIR)/uuid/parse.c \
- $(CONTRIBDIR)/uuid/unparse.c $(CONTRIBDIR)/uuid/uuid_time.c \
- $(CONTRIBDIR)/uuid/compare.c $(CONTRIBDIR)/uuid/isnull.c \
- $(CONTRIBDIR)/uuid/unpack.c
+ gfdb_sqlite3.c
noinst_HEADERS = gfdb_data_store.h gfdb_data_store_types.h gfdb_sqlite3_helper.h\
- gfdb_sqlite3.h gfdb_mem-types.h \
- $(CONTRIBDIR)/uuid/uuidd.h \
- $(CONTRIBDIR)/uuid/uuid.h $(CONTRIBDIR)/uuid/uuid.h \
- $(CONTRIB_BUILDDIR)/uuid/uuid_types.h
+ gfdb_sqlite3.h gfdb_mem-types.h
libgfdb_HEADERS = gfdb_data_store.h gfdb_data_store_types.h \
gfdb_sqlite3.h gfdb_mem-types.h gfdb_sqlite3_helper.c
CLEANFILES =
-CONFIG_CLEAN_FILES = $(CONTRIB_BUILDDIR)/uuid/uuid_types.h
$(top_builddir)/libglusterfs/src/libglusterfs.la:
$(MAKE) -C $(top_builddir)/libglusterfs/src/ all
diff --git a/libglusterfs/src/gfdb/gfdb_data_store_types.h b/libglusterfs/src/gfdb/gfdb_data_store_types.h
index 94708ac1d3b..5bd95241f06 100644
--- a/libglusterfs/src/gfdb/gfdb_data_store_types.h
+++ b/libglusterfs/src/gfdb/gfdb_data_store_types.h
@@ -21,6 +21,7 @@
#include <string.h>
#include "common-utils.h"
+#include "compat-uuid.h"
#include "gfdb_mem-types.h"
#include "dict.h"
diff --git a/libglusterfs/src/iatt.h b/libglusterfs/src/iatt.h
index da6b83dc176..a404d9c8cd0 100644
--- a/libglusterfs/src/iatt.h
+++ b/libglusterfs/src/iatt.h
@@ -22,7 +22,7 @@
#include <unistd.h>
#include "compat.h"
-#include "uuid.h"
+#include "compat-uuid.h"
typedef enum {
IA_INVAL = 0,
diff --git a/libglusterfs/src/inode.h b/libglusterfs/src/inode.h
index f7ca1925aac..50815599347 100644
--- a/libglusterfs/src/inode.h
+++ b/libglusterfs/src/inode.h
@@ -33,7 +33,7 @@ typedef struct _dentry dentry_t;
#include "list.h"
#include "xlator.h"
#include "iatt.h"
-#include "uuid.h"
+#include "compat-uuid.h"
#include "fd.h"
struct _inode_table {
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index 9bea950d720..a238913d03b 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -27,6 +27,7 @@
#include "compat.h"
#include "list.h"
#include "latency.h"
+#include "compat-uuid.h"
#define FIRST_CHILD(xl) (xl->children->xlator)
#define SECOND_CHILD(xl) (xl->children->next->xlator)