summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2018-10-15 08:26:32 -0400
committerAmar Tumballi <amarts@redhat.com>2018-10-16 05:04:33 +0000
commit7152ace0b3586289be068f09e2c20cf0a8d2d166 (patch)
treea4565c1cbcb1934aa6c2193b59df69dea106f486
parente627977617dd765f6b58a70882c6acda6c6aab6e (diff)
core: libuuid-devel breakage
The #include "uuid.h" left over from using .../contrib/uuid is debatably incorrect now that we use the "system header" file /usr/include/uuid/uuid.h from libuuid-devel. Unfortunately this is complicated by things like FreeBSD having its own /usr/include/uuid.h, and the e2fsprogs-libuuid uuid.h in installed - as most third-party packages in FreeBSD are - in /usr/local as /usr/local/include/uuid/uuid.h With a system header file it should at least be #include <uuid.h>, and even better as #include <uuid/uuid.h>, much like the way <sys/types.h> and <net/if.h> are included. Using #include <uuid/uuid.h> guarantees not getting the /usr/include/uuid.h on FreeBSD, but clang/cc knows to find "system" header files like this in /usr/local/include; with or without the -I/... from uuid.pc. Also using #include "uuid.h" leaves the compiler free to find a uuid.h from any -I option it might be passed. (Fortunately we don't have any at this time.) As we now require libuuid-devel or e2fsprogs-libuuid and configure will exit with an error if the uuid.pc file doesn't exist, the HAVE_LIBUUID (including the #elif FreeBSD) tests in compat-uuid.h are redundant. We are guaranteed to have it, so testing for it is a bit silly IMO. It may also break building third party configure scripts if they omit defining it. (Just how hard do we want to make things for third party developers?) Change-Id: I7317f63c806281a5d27de7d3b2208d86965545e1 updates: bz#1193929 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
-rw-r--r--libglusterfs/src/common-utils.h2
-rw-r--r--libglusterfs/src/compat-uuid.h13
2 files changed, 4 insertions, 11 deletions
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index 15ca1ef6a50..51e05515401 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -24,6 +24,7 @@
#endif
#include <limits.h>
#include <fnmatch.h>
+#include <uuid/uuid.h>
#ifndef ffsll
#define ffsll(x) __builtin_ffsll(x)
@@ -43,7 +44,6 @@ trap(void);
#include "mem-pool.h"
#include "compat-uuid.h"
#include "iatt.h"
-#include "uuid.h"
#include "libglusterfs-messages.h"
#include "protocol-common.h"
#include "iobuf.h"
diff --git a/libglusterfs/src/compat-uuid.h b/libglusterfs/src/compat-uuid.h
index 6bce6d033d0..6e7fdefbfab 100644
--- a/libglusterfs/src/compat-uuid.h
+++ b/libglusterfs/src/compat-uuid.h
@@ -11,9 +11,7 @@
#ifndef _GF_UUID_H
#define _GF_UUID_H
-#if defined(HAVE_LIBUUID) /* Linux like libuuid.so */
-
-#include <uuid.h>
+#include <uuid/uuid.h>
static inline void
gf_uuid_clear(uuid_t uuid)
@@ -57,12 +55,8 @@ gf_uuid_unparse(const uuid_t uuid, char *out)
uuid_unparse(uuid, out);
}
-#elif defined(__FreeBSD__)
-
-#error Please install e2fsprogs-libuuid for a compatible libuuid implementation.
-
/* TODO: add more uuid APIs, use constructs like this:
-#elif defined(__NetBSD__) * NetBSD libc *
+#if defined(__NetBSD__) * NetBSD libc *
#include <string.h>
@@ -71,8 +65,7 @@ gf_uuid_clear (uuid_t uuid)
{
memset (uuid, 0, sizeof (uuid_t));
}
-
+#endif
*/
-#endif /* HAVE_UUID */
#endif /* _GF_UUID_H */