diff options
author | Harshavardhana <harsha@harshavardhana.net> | 2014-06-21 02:00:23 -0700 |
---|---|---|
committer | Harshavardhana <harsha@harshavardhana.net> | 2014-07-02 17:20:34 -0700 |
commit | 1b74cf992986287a510fe3b28a8ee7554e8b0992 (patch) | |
tree | a5fad911274080947f5874b4d90cc4f67b6f4473 /xlators/mount | |
parent | e4a3566681acbadfe0f7bd879443116885ada4eb (diff) |
porting: Port for FreeBSD rebased from Mike Ma's efforts
- Provides a working Gluster Management Daemon, CLI
- Provides a working GlusterFS server, GlusterNFS server
- Provides a working GlusterFS client
- execinfo port from FreeBSD is moved into ./contrib/libexecinfo
for ease of portability on NetBSD. (FreeBSD 10 and OSX provide
execinfo natively)
- More portability cleanups for Darwin, FreeBSD and NetBSD
- Provides a new rc script for FreeBSD
Change-Id: I8dff336f97479ca5a7f9b8c6b730051c0f8ac46f
BUG: 1111774
Original-Author: Mike Ma <mikemandarine@gmail.com>
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/8141
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators/mount')
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 2 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.h | 4 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-helpers.c | 33 | ||||
-rw-r--r-- | xlators/mount/fuse/utils/Makefile.am | 9 |
4 files changed, 26 insertions, 22 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index d5ca4d146aa..473911a2cb0 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -12,6 +12,8 @@ #include "fuse-bridge.h" #include "mount-gluster-compat.h" #include "glusterfs.h" +#include "byte-order.h" +#include "compat-errno.h" #include "glusterfs-acl.h" #ifdef __NetBSD__ diff --git a/xlators/mount/fuse/src/fuse-bridge.h b/xlators/mount/fuse/src/fuse-bridge.h index f1c4cb3f0d8..c08d55daf4b 100644 --- a/xlators/mount/fuse/src/fuse-bridge.h +++ b/xlators/mount/fuse/src/fuse-bridge.h @@ -32,8 +32,6 @@ #include "statedump.h" #ifdef GF_DARWIN_HOST_OS -/* This is MacFUSE's marker for MacFUSE-specific code */ -#define __FreeBSD__ 10 #include "fuse_kernel_macfuse.h" #else #include "fuse_kernel.h" @@ -47,7 +45,7 @@ #include "syncop.h" #include "gidcache.h" -#if defined(GF_LINUX_HOST_OS) || defined(__NetBSD__) +#if defined(GF_LINUX_HOST_OS) || defined(__FreeBSD__) || defined(__NetBSD__) #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 0936d63111a..ef9bcd4e43e 100644 --- a/xlators/mount/fuse/src/fuse-helpers.c +++ b/xlators/mount/fuse/src/fuse-helpers.c @@ -11,13 +11,17 @@ #define _KMEMUSER #endif -#include "fuse-bridge.h" #if defined(GF_SOLARIS_HOST_OS) #include <sys/procfs.h> +#elif defined(__FreeBSD__) +#include <sys/types.h> +#include <libutil.h> +#include <sys/user.h> #else #include <sys/sysctl.h> #endif +#include "fuse-bridge.h" static void fuse_resolve_wipe (fuse_resolve_t *resolve) @@ -154,7 +158,8 @@ frame_fill_groups (call_frame_t *frame) char *endptr = NULL; int ret = 0; - ret = snprintf (filename, sizeof filename, "/proc/%d/status", frame->root->pid); + ret = snprintf (filename, sizeof filename, "/proc/%d/status", + frame->root->pid); if (ret >= sizeof filename) goto out; @@ -162,8 +167,8 @@ frame_fill_groups (call_frame_t *frame) if (!fp) goto out; - if (call_stack_alloc_groups (frame->root, FUSE_MAX_AUX_GROUPS) != 0) - goto out; + if (call_stack_alloc_groups (frame->root, FUSE_MAX_AUX_GROUPS) != 0) + goto out; while ((ptr = fgets (line, sizeof line, fp))) { if (strncmp (ptr, "Groups:", 7) != 0) @@ -197,7 +202,7 @@ out: prcred_t *prcred = (prcred_t *) scratch; FILE *fp = NULL; int ret = 0; - int ngrps; + int ngrps; ret = snprintf (filename, sizeof filename, "/proc/%d/cred", frame->root->pid); @@ -207,21 +212,21 @@ out: if (fp != NULL) { if (fgets (scratch, sizeof scratch, fp) != NULL) { ngrps = MIN(prcred->pr_ngroups, - GF_MAX_AUX_GROUPS); - if (call_stack_alloc_groups (frame->root, - ngrps) != 0) - return; + FUSE_MAX_AUX_GROUPS); + if (call_stack_alloc_groups (frame->root, + ngrps) != 0) + return; } fclose (fp); } } #elif defined(CTL_KERN) /* DARWIN and *BSD */ - /* + /* N.B. CTL_KERN is an enum on Linux. (Meaning, if it's not - obvious, that it's not subject to preprocessor directives + obvious, that it's not subject to preprocessor directives like '#if defined'.) Unlike Linux, on Mac OS and the BSDs it is a #define. We - could test to see that KERN_PROC is defined, but, barring any + could test to see that KERN_PROC is defined, but, barring any evidence to the contrary, I think that's overkill. We might also test that GF_DARWIN_HOST_OS is defined, why limit this to just Mac OS. It's equally valid for the BSDs @@ -236,8 +241,8 @@ out: if (sysctl(name, namelen, &kp, &kplen, NULL, 0) != 0) return; ngroups = MIN(kp.kp_eproc.e_ucred.cr_ngroups, NGROUPS_MAX); - if (call_stack_alloc_groups (frame->root, ngroups) != 0) - return; + if (call_stack_alloc_groups (frame->root, ngroups) != 0) + return; for (i = 0; i < ngroups; i++) frame->root->groups[i] = kp.kp_eproc.e_ucred.cr_groups[i]; frame->root->ngrps = ngroups; diff --git a/xlators/mount/fuse/utils/Makefile.am b/xlators/mount/fuse/utils/Makefile.am index c626e2769fe..fdad27ad103 100644 --- a/xlators/mount/fuse/utils/Makefile.am +++ b/xlators/mount/fuse/utils/Makefile.am @@ -1,10 +1,9 @@ utildir = @mountutildir@ -if GF_DARWIN_HOST_OS -util_SCRIPTS = mount_glusterfs -else +if GF_LINUX_HOST_OS util_SCRIPTS = mount.glusterfs +else +util_SCRIPTS = mount_glusterfs endif -CLEANFILES = - +CLEANFILES = |