summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/compat.h
diff options
context:
space:
mode:
authorHarshavardhana <harsha@harshavardhana.net>2014-04-17 15:54:34 -0700
committerAnand Avati <avati@redhat.com>2014-04-24 14:41:48 -0700
commita3cb38e3edf005bef73da4c9cfd958474a14d50f (patch)
treea406029332a9eb096c14d441160bb670a42df8cb /libglusterfs/src/compat.h
parent9c13471b109587a639662fc690384285bee02bc6 (diff)
downloadglusterfs-a3cb38e3edf005bef73da4c9cfd958474a14d50f.tar.gz
glusterfs-a3cb38e3edf005bef73da4c9cfd958474a14d50f.tar.xz
glusterfs-a3cb38e3edf005bef73da4c9cfd958474a14d50f.zip
build: MacOSX Porting fixes
git@forge.gluster.org:~schafdog/glusterfs-core/osx-glusterfs Working functionality on MacOSX - GlusterD (management daemon) - GlusterCLI (management cli) - GlusterFS FUSE (using OSXFUSE) - GlusterNFS (without NLM - issues with rpc.statd) Change-Id: I20193d3f8904388e47344e523b3787dbeab044ac BUG: 1089172 Signed-off-by: Harshavardhana <harsha@harshavardhana.net> Signed-off-by: Dennis Schafroth <dennis@schafroth.com> Tested-by: Harshavardhana <harsha@harshavardhana.net> Tested-by: Dennis Schafroth <dennis@schafroth.com> Reviewed-on: http://review.gluster.org/7503 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs/src/compat.h')
-rw-r--r--libglusterfs/src/compat.h53
1 files changed, 51 insertions, 2 deletions
diff --git a/libglusterfs/src/compat.h b/libglusterfs/src/compat.h
index 359a4a3b5c..81408dbd0a 100644
--- a/libglusterfs/src/compat.h
+++ b/libglusterfs/src/compat.h
@@ -31,11 +31,21 @@
#include <sys/un.h>
#include <linux/limits.h>
#include <sys/xattr.h>
+#include <linux/xattr.h>
#include <endian.h>
#ifdef HAVE_LINUX_FALLOC_H
#include <linux/falloc.h>
#endif
+#ifdef HAVE_ENDIAN_H
+#include <endian.h>
+#endif
+#endif /* GF_LINUX_HOST_OS */
+
+#ifdef HAVE_XATTR_H
+#include <sys/xattr.h>
+#endif
+
/*
* Define the fallocate flags in case we do not have the header. This also
* accounts for older systems that do not define FALLOC_FL_PUNCH_HOLE.
@@ -61,7 +71,29 @@
#define lsetxattr(path,key,value,size,flags) setxattr(path,key,value,size,flags)
#endif /* HAVE_LLISTXATTR */
-#endif /* GF_LINUX_HOST_OS */
+
+
+#ifdef GF_DARWIN_HOST_OS
+#include <machine/endian.h>
+#include <libkern/OSByteOrder.h>
+
+#define htobe16(x) OSSwapHostToBigInt16(x)
+#define htole16(x) OSSwapHostToLittleInt16(x)
+#define be16toh(x) OSSwapBigToHostInt16(x)
+#define le16toh(x) OSSwapLittleToHostInt16(x)
+
+#define htobe32(x) OSSwapHostToBigInt32(x)
+#define htole32(x) OSSwapHostToLittleInt32(x)
+#define be32toh(x) OSSwapBigToHostInt32(x)
+#define le32toh(x) OSSwapLittleToHostInt32(x)
+
+#define htobe64(x) OSSwapHostToBigInt64(x)
+#define htole64(x) OSSwapHostToLittleInt64(x)
+#define be64toh(x) OSSwapBigToHostInt64(x)
+#define le64toh(x) OSSwapLittleToHostInt64(x)
+
+#endif
+
#ifdef GF_BSD_HOST_OS
/* In case of FreeBSD and NetBSD */
@@ -125,12 +157,29 @@ enum {
#endif /* GF_BSD_HOST_OS */
#ifdef GF_DARWIN_HOST_OS
+#include <machine/endian.h>
+#include <libkern/OSByteOrder.h>
+
+#define htobe16(x) OSSwapHostToBigInt16(x)
+#define htole16(x) OSSwapHostToLittleInt16(x)
+#define be16toh(x) OSSwapBigToHostInt16(x)
+#define le16toh(x) OSSwapLittleToHostInt16(x)
+
+#define htobe32(x) OSSwapHostToBigInt32(x)
+#define htole32(x) OSSwapHostToLittleInt32(x)
+#define be32toh(x) OSSwapBigToHostInt32(x)
+#define le32toh(x) OSSwapLittleToHostInt32(x)
+
+#define htobe64(x) OSSwapHostToBigInt64(x)
+#define htole64(x) OSSwapHostToLittleInt64(x)
+#define be64toh(x) OSSwapBigToHostInt64(x)
+#define le64toh(x) OSSwapLittleToHostInt64(x)
#define UNIX_PATH_MAX 104
+#define AT_SYMLINK_NOFOLLOW 0x100
#include <sys/types.h>
#include <sys/un.h>
-#include <machine/endian.h>
#include <sys/xattr.h>
#include <limits.h>