diff options
| author | Harshavardhana <harsha@harshavardhana.net> | 2014-04-17 15:54:34 -0700 | 
|---|---|---|
| committer | Anand Avati <avati@redhat.com> | 2014-04-24 14:41:48 -0700 | 
| commit | a3cb38e3edf005bef73da4c9cfd958474a14d50f (patch) | |
| tree | a406029332a9eb096c14d441160bb670a42df8cb /contrib/macfuse | |
| parent | 9c13471b109587a639662fc690384285bee02bc6 (diff) | |
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 'contrib/macfuse')
| -rw-r--r-- | contrib/macfuse/fuse_param.h | 97 | ||||
| -rw-r--r-- | contrib/macfuse/mount_darwin.c | 27 | 
2 files changed, 74 insertions, 50 deletions
diff --git a/contrib/macfuse/fuse_param.h b/contrib/macfuse/fuse_param.h index 81d753c6cd7..347db9464bc 100644 --- a/contrib/macfuse/fuse_param.h +++ b/contrib/macfuse/fuse_param.h @@ -1,4 +1,9 @@  /* + * 'rebel' branch modifications: + *     Copyright (C) 2010 Tuxera. All Rights Reserved. + */ + +/*   * Copyright (C) 2006-2008 Google. All Rights Reserved.   * Amit Singh <singh@>   */ @@ -6,69 +11,81 @@  #ifndef _FUSE_PARAM_H_  #define _FUSE_PARAM_H_ -/* Compile-time tunables (M_MACFUSE*) */ - -#define M_MACFUSE_ENABLE_FIFOFS            0 -#define M_MACFUSE_ENABLE_INTERRUPT         1 -#define M_MACFUSE_ENABLE_SPECFS            0 -#define M_MACFUSE_ENABLE_TSLOCKING         0 -#define M_MACFUSE_ENABLE_UNSUPPORTED       1 -#define M_MACFUSE_ENABLE_XATTR             1 - -#if M_MACFUSE_ENABLE_UNSUPPORTED -  #define M_MACFUSE_ENABLE_DSELECT         0 -  #define M_MACFUSE_ENABLE_EXCHANGE        1 -  #define M_MACFUSE_ENABLE_KQUEUE          1 -  #define M_MACFUSE_ENABLE_KUNC            0 -#if __LP64__ -    #define M_MACFUSE_ENABLE_INTERIM_FSNODE_LOCK 1 -#endif /* __LP64__ */ -#endif /* M_MACFUSE_ENABLE_UNSUPPORTED */ - -#if M_MACFUSE_ENABLE_INTERIM_FSNODE_LOCK -#define FUSE_VNOP_EXPORT __private_extern__ +#include <AvailabilityMacros.h> + +/* Compile-time tunables (M_OSXFUSE*) */ + +#define M_OSXFUSE_ENABLE_FIFOFS                0 +#define M_OSXFUSE_ENABLE_INTERRUPT             1 +#define M_OSXFUSE_ENABLE_SPECFS                0 +#define M_OSXFUSE_ENABLE_TSLOCKING             1 +#define M_OSXFUSE_ENABLE_UNSUPPORTED           1 +#define M_OSXFUSE_ENABLE_XATTR                 1 +#define M_OSXFUSE_ENABLE_DSELECT               1 + +#if M_OSXFUSE_ENABLE_UNSUPPORTED +#  define M_OSXFUSE_ENABLE_EXCHANGE            1 +#  define M_OSXFUSE_ENABLE_KUNC                0 +#  define M_OSXFUSE_ENABLE_INTERIM_FSNODE_LOCK 1 +#endif /* M_OSXFUSE_ENABLE_UNSUPPORTED */ + +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 +#  if M_OSXFUSE_ENABLE_UNSUPPORTED +     /* +      * In Mac OS X 10.5 the file system implementation is responsible for +      * posting kqueue events. Starting with Mac OS X 10.6 VFS took over that +      * job. +      */ +#    define M_OSXFUSE_ENABLE_KQUEUE            1 +#  endif +#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */ + +#if M_OSXFUSE_ENABLE_INTERIM_FSNODE_LOCK +#  define M_OSXFUSE_ENABLE_HUGE_LOCK           0 +#  define M_OSXFUSE_ENABLE_LOCK_LOGGING        0 +#  define FUSE_VNOP_EXPORT __private_extern__  #else -#define FUSE_VNOP_EXPORT static -#endif /* M_MACFUSE_ENABLE_INTERIM_FSNODE_LOCK */ +#  define FUSE_VNOP_EXPORT static +#endif /* M_OSXFUSE_ENABLE_INTERIM_FSNODE_LOCK */  /* User Control */ -#define MACFUSE_POSTUNMOUNT_SIGNAL         SIGKILL +#define OSXFUSE_POSTUNMOUNT_SIGNAL         SIGKILL  #define MACOSX_ADMIN_GROUP_NAME            "admin" -#define SYSCTL_MACFUSE_TUNABLES_ADMIN      "macfuse.tunables.admin_group" -#define SYSCTL_MACFUSE_VERSION_NUMBER      "macfuse.version.number" +#define SYSCTL_OSXFUSE_TUNABLES_ADMIN      "osxfuse.tunables.admin_group" +#define SYSCTL_OSXFUSE_VERSION_NUMBER      "osxfuse.version.number"  /* Paths */ -#define MACFUSE_BUNDLE_PATH "/Library/Filesystems/fusefs.fs" -#define MACFUSE_KEXT        MACFUSE_BUNDLE_PATH "/Support/fusefs.kext" -#define MACFUSE_LOAD_PROG   MACFUSE_BUNDLE_PATH "/Support/load_fusefs" -#define MACFUSE_MOUNT_PROG  MACFUSE_BUNDLE_PATH "/Support/mount_fusefs" +#define OSXFUSE_BUNDLE_PATH "/Library/Filesystems/osxfusefs.fs" +#define OSXFUSE_KEXT        OSXFUSE_BUNDLE_PATH "/Support/osxfusefs.kext" +#define OSXFUSE_LOAD_PROG   OSXFUSE_BUNDLE_PATH "/Support/load_osxfusefs" +#define OSXFUSE_MOUNT_PROG  OSXFUSE_BUNDLE_PATH "/Support/mount_osxfusefs"  #define SYSTEM_KEXTLOAD     "/sbin/kextload"  #define SYSTEM_KEXTUNLOAD   "/sbin/kextunload"  /* Compatible API version */ -#define MACFUSE_MIN_USER_VERSION_MAJOR     7 -#define MACFUSE_MIN_USER_VERSION_MINOR     5 +#define OSXFUSE_MIN_USER_VERSION_MAJOR     7 +#define OSXFUSE_MIN_USER_VERSION_MINOR     5  /* Device Interface */  /* - * This is the prefix ("fuse" by default) of the name of a FUSE device node - * in devfs. The suffix is the device number. "/dev/fuse0" is the first FUSE + * This is the prefix ("osxfuse" by default) of the name of a FUSE device node + * in devfs. The suffix is the device number. "/dev/osxfuse0" is the first FUSE   * device by default. If you change the prefix from the default to something   * else, the user-space FUSE library will need to know about it too.   */ -#define MACFUSE_DEVICE_BASENAME            "fuse" +#define OSXFUSE_DEVICE_BASENAME            "osxfuse"  /* - * This is the number of /dev/fuse<n> nodes we will create. <n> goes from - * 0 to (FUSE_NDEVICES - 1). + * This is the number of /dev/osxfuse<n> nodes we will create. <n> goes from + * 0 to (OSXFUSE_NDEVICES - 1).   */ -#define MACFUSE_NDEVICES                   24 +#define OSXFUSE_NDEVICES                   24  /*   * This is the default block size of the virtual storage devices that are @@ -131,13 +148,13 @@  /* User-Kernel IPC Buffer */  #define FUSE_MIN_USERKERNEL_BUFSIZE        (128  * 1024) -#define FUSE_MAX_USERKERNEL_BUFSIZE        (4096 * 1024) +#define FUSE_MAX_USERKERNEL_BUFSIZE        (16   * 1024 * 1024)  #define FUSE_REASONABLE_XATTRSIZE          FUSE_MIN_USERKERNEL_BUFSIZE  #endif /* KERNEL */ -#define FUSE_DEFAULT_USERKERNEL_BUFSIZE    (4096 * 1024) +#define FUSE_DEFAULT_USERKERNEL_BUFSIZE    (16   * 1024 * 1024)  #define FUSE_LINK_MAX                      LINK_MAX  #define FUSE_UIO_BACKUP_MAX                8 diff --git a/contrib/macfuse/mount_darwin.c b/contrib/macfuse/mount_darwin.c index c485583e96b..cac158249aa 100644 --- a/contrib/macfuse/mount_darwin.c +++ b/contrib/macfuse/mount_darwin.c @@ -105,7 +105,7 @@ loadkmod(void)      pid = fork();      if (pid == 0) { -        execl(MACFUSE_LOAD_PROG, MACFUSE_LOAD_PROG, NULL); +        execl(OSXFUSE_LOAD_PROG, OSXFUSE_LOAD_PROG, NULL);          /* exec failed */          exit(ENOENT); @@ -133,13 +133,17 @@ Return:  }  int +gf_fuse_mount (const char *mountpoint, char *fsname, +               unsigned long mountflags, char *mnt_param, +	       pid_t *mnt_pid, int status_fd) /* Not used on OS X */ +/* int  gf_fuse_mount (const char *mountpoint, char *fsname, char *mnt_param, -               pid_t *mtab_pid /* not used on OS X */) +pid_t *mtab_pid) */  {      int fd, pid;      int result;      char *fdnam, *dev; -    const char *mountprog = MACFUSE_MOUNT_PROG; +    const char *mountprog = OSXFUSE_MOUNT_PROG;      sig_t chldf;      /* mount_fusefs should not try to spawn the daemon */ @@ -170,7 +174,8 @@ gf_fuse_mount (const char *mountpoint, char *fsname, char *mnt_param,          size_t version_len = MAXHOSTNAMELEN;          size_t version_len_desired = 0; -        result = sysctlbyname(SYSCTL_MACFUSE_VERSION_NUMBER, version, +        result = sysctlbyname(SYSCTL_OSXFUSE_VERSION_NUMBER +			      , version,                                &version_len, NULL, (size_t)0);          if (result == 0) {              /* sysctlbyname() includes the trailing '\0' in version_len */ @@ -197,10 +202,12 @@ gf_fuse_mount (const char *mountpoint, char *fsname, char *mnt_param,                  gf_log("glusterfs-fuse", GF_LOG_INFO,                         "MacFUSE kext version %s", version);          } +	// TODO Bypass version check +	result = 0;          if (result != 0) -            GFFUSE_LOGERR("MacFUSE version %s is not supported", version); +	  GFFUSE_LOGERR("MacFUSE version %s is not supported", version);      } else -        GFFUSE_LOGERR("cannot load MacFUSE kext"); +      GFFUSE_LOGERR("cannot load MacFUSE kext");      if (result != 0)          return -1; @@ -228,9 +235,9 @@ gf_fuse_mount (const char *mountpoint, char *fsname, char *mnt_param,          int r, devidx = -1;          char devpath[MAXPATHLEN]; -        for (r = 0; r < MACFUSE_NDEVICES; r++) { +        for (r = 0; r < OSXFUSE_NDEVICES; r++) {              snprintf(devpath, MAXPATHLEN - 1, -                     _PATH_DEV MACFUSE_DEVICE_BASENAME "%d", r); +                     _PATH_DEV OSXFUSE_DEVICE_BASENAME "%d", r);              fd = open(devpath, O_RDWR);              if (fd >= 0) {                  dev = devpath; @@ -336,8 +343,8 @@ gf_fuse_unmount(const char *mountpoint, int fd)      devname_r(sbuf.st_rdev, S_IFCHR, dev, 128); -    if (strncmp(dev, MACFUSE_DEVICE_BASENAME, -                sizeof(MACFUSE_DEVICE_BASENAME) - 1)) { +    if (strncmp(dev, OSXFUSE_DEVICE_BASENAME, +                sizeof(OSXFUSE_DEVICE_BASENAME) - 1)) {          return;      }  | 
