diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index 61c524e..d745a6a 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -12,6 +12,7 @@ #include "glfs-internal.h" #include "glfs-mem-types.h" #include "syncop.h" +#include "compat-errno.h" #include "glfs.h" diff --git a/configure.ac b/configure.ac index 6357b19..91642f0 100644 --- a/configure.ac +++ b/configure.ac @@ -578,7 +578,12 @@ case $host_os in GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -O0" GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME" GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME" + GF_CFLAGS="${GF_CFLAGS} -D_LIBGEN_H_" + GF_CFLAGS="${GF_CFLAGS} -DO_DSYNC=0" + GF_CFLAGS="${GF_CFLAGS} -Dxdr_quad_t=xdr_longlong_t" + GF_CFLAGS="${GF_CFLAGS} -Dxdr_u_quad_t=xdr_u_longlong_t" GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}" + GF_FUSE_CFLAGS="-DFUSERMOUNT_DIR=\\\"\$(sbindir)\\\"" GF_LDADD="${ARGP_STANDALONE_LDADD}" if test "x$ac_cv_header_execinfo_h" = "xyes"; then GF_GLUSTERFS_LIBS="-lexecinfo" diff --git a/contrib/fuse-lib/mount-common.c b/contrib/fuse-lib/mount-common.c index fd6cce4..f519abb 100644 --- a/contrib/fuse-lib/mount-common.c +++ b/contrib/fuse-lib/mount-common.c @@ -23,7 +23,7 @@ * see the commit log and per-function comments. */ -#ifndef __NetBSD__ +#ifndef GF_BSD_HOST_OS /* FUSE: cherry-picked bd99f9cf */ static int mtab_needs_update (const char *mnt) diff --git a/contrib/fuse-lib/mount-gluster-compat.h b/contrib/fuse-lib/mount-gluster-compat.h index 4fc2062..cf06a8a 100644 --- a/contrib/fuse-lib/mount-gluster-compat.h +++ b/contrib/fuse-lib/mount-gluster-compat.h @@ -21,22 +21,24 @@ #include #include #include -#ifndef __NetBSD__ +#ifndef GF_BSD_HOST_OS #include -#endif /* __NetBSD__ */ +#endif /* GF_BSD_HOST_OS */ #include #include #include #include #include +#ifdef GF_BSD_HOST_OS #ifdef __NetBSD__ #include +#endif #define umount2(dir, flags) unmount(dir, ((flags) != 0) ? MNT_FORCE : 0) #define MS_RDONLY MNT_RDONLY #endif -#ifdef linux +#ifdef GF_LINUX_HOST_OS #define _PATH_MOUNT "/bin/mount" #else /* NetBSD, MacOS X */ #define _PATH_MOUNT "/sbin/mount" diff --git a/contrib/fuse-lib/mount.c b/contrib/fuse-lib/mount.c index a222aac..2769713 100644 --- a/contrib/fuse-lib/mount.c +++ b/contrib/fuse-lib/mount.c @@ -188,8 +188,12 @@ fuse_mount_sys (const char *mountpoint, char *fsname, goto out; } +#ifdef GF_LINUX_HOST_OS ret = mount (source, mountpoint, fstype, mountflags, mnt_param_mnt); +#else + ret = mount (fstype, mountpoint, mountflags, mnt_param_mnt); +#endif if (ret == -1 && errno == ENODEV) { /* fs subtype support was added by 79c0b2df aka v2.6.21-3159-g79c0b2d. Probably we have an @@ -201,8 +205,12 @@ fuse_mount_sys (const char *mountpoint, char *fsname, goto out; } +#ifdef GF_LINUX_HOST_OS ret = mount (source, mountpoint, fstype, 0, mnt_param_mnt); +#else + ret = mount (fstype, mountpoint, 0, mnt_param_mnt); +#endif } if (ret == -1) goto out; diff --git a/contrib/fuse-util/fusermount.c b/contrib/fuse-util/fusermount.c index 0ff8d90..9cd0a64 100644 --- a/contrib/fuse-util/fusermount.c +++ b/contrib/fuse-util/fusermount.c @@ -10,6 +10,7 @@ #include #include "mount_util.h" +#include "../fuse-lib/mount-gluster-compat.h" #include #include #include @@ -20,7 +21,9 @@ #include #include #include +#ifdef GF_LINUX_HOST_OS #include +#endif #include #include #include @@ -791,7 +794,11 @@ static int do_mount(const char *mnt, char **typep, mode_t rootmode, else strcpy(source, subtype ? subtype : dev); +#ifdef GF_LINUX_HOST_OS res = mount(source, mnt, type, flags, optbuf); +#else + res = mount(type, mnt, flags, optbuf); +#endif if (res == -1 && errno == ENODEV && subtype) { /* Probably missing subtype support */ strcpy(type, blkdev ? "fuseblk" : "fuse"); @@ -801,8 +808,11 @@ static int do_mount(const char *mnt, char **typep, mode_t rootmode, } else { strcpy(source, type); } - +#ifdef GF_LINUX_HOST_OS res = mount(source, mnt, type, flags, optbuf); +#else + res = mount(type, mnt, flags, optbuf); +#endif } if (res == -1 && errno == EINVAL) { /* It could be an old version not supporting group_id */ diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index 78127cd..0d40dfd 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -752,7 +752,7 @@ __socket_keepalive (int fd, int family, int keepalive_intvl, int keepalive_idle) goto done; #if !defined(GF_LINUX_HOST_OS) && !defined(__NetBSD__) -#ifdef GF_SOLARIS_HOST_OS +#if defined(GF_SOLARIS_HOST_OS) || defined(__FreeBSD__) ret = setsockopt (fd, SOL_SOCKET, SO_KEEPALIVE, &keepalive_intvl, sizeof (keepalive_intvl)); #else diff --git a/xlators/features/protect/src/prot_client.c b/xlators/features/protect/src/prot_client.c index a27216d..ad0aa49 100644 --- a/xlators/features/protect/src/prot_client.c +++ b/xlators/features/protect/src/prot_client.c @@ -7,6 +7,8 @@ later), or the GNU General Public License, version 2 (GPLv2), in all cases as published by the Free Software Foundation. */ +#ifndef __FreeBSD__ + #ifndef _CONFIG_H #define _CONFIG_H #include "config.h" @@ -213,3 +215,4 @@ struct xlator_cbks cbks = { struct volume_options options[] = { { .key = {NULL} }, }; +#endif diff --git a/xlators/mount/fuse/src/fuse-bridge.h b/xlators/mount/fuse/src/fuse-bridge.h index d90b85e..ac1a6d9 100644 --- a/xlators/mount/fuse/src/fuse-bridge.h +++ b/xlators/mount/fuse/src/fuse-bridge.h @@ -24,6 +24,7 @@ #include "config.h" #endif /* _CONFIG_H */ +#include "compat-errno.h" #include "glusterfs.h" #include "logging.h" #include "xlator.h" @@ -47,7 +48,7 @@ #include "syncop.h" #include "gidcache.h" -#if defined(GF_LINUX_HOST_OS) || defined(__NetBSD__) +#if defined(GF_LINUX_HOST_OS) || defined(GF_BSD_HOST_OS) #define FUSE_OP_HIGH (FUSE_READDIRPLUS + 1) #endif #ifdef GF_DARWIN_HOST_OS diff --git a/xlators/mount/fuse/src/fuse-helpers.c b/xlators/mount/fuse/src/fuse-helpers.c index d4dcc2e..488736f 100644 --- a/xlators/mount/fuse/src/fuse-helpers.c +++ b/xlators/mount/fuse/src/fuse-helpers.c @@ -10,6 +10,8 @@ #include "fuse-bridge.h" #if defined(GF_SOLARIS_HOST_OS) #include +#elif defined(GF_BSD_HOST_OS) +#include #else #include #endif diff --git a/xlators/storage/posix/src/posix-handle.c b/xlators/storage/posix/src/posix-handle.c index 219a582..b2c1046 100644 --- a/xlators/storage/posix/src/posix-handle.c +++ b/xlators/storage/posix/src/posix-handle.c @@ -12,7 +12,6 @@ #include "config.h" #endif -#include #include #include #include @@ -25,6 +24,7 @@ #include "posix.h" #include "xlator.h" #include "syscall.h" +#include "compat-errno.h" #define HANDLE_PFX ".glusterfs"