Re: Fwd: Port GlusterFS as a GSoC 2013 project

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/26/2013 08:33 AM, John Mark Walker wrote:
I would personally very much like to see this.

The people who might be able to assist you are Emmanual Dreyfus, CC'd, the NetBSD maintainer, and Kaleb, who has lots of free time on his hands ;)

I jest - I know Kaleb is pretty busy. Hopefully he can spare a few cycles for mentorship.


I'd like to see it done as well. I say go for it. I'd wager that doing this will go a long way to making it work on Mac OS X again too.

FWIW, I have looked at this from time to time. It seems that a fusefs-kmod pkg for 9.1-release finally materialized a couple weeks ago. That has been the major impediment to a port to 9.1 anyway, although a port to earlier FreeBSD releases maybe have been possible before now.

Attached is a short patch against master/HEAD that I spent a couple hours creating this morning. It should get you off to a good start. I left contrib/fuse-util as an exercise. ;-) With my patch, everything configured out of the box¹ compiles, except for contrib/fuse-util, which I have left as an exercise.

As far as what remains to be done then, my list would be:
1. port contrib/fuse-util.
2. of the pieces that don't currently auto-configure, explore whether any of them can or should
3. evaluate whether the changes in my patch are actually correct.
4. write /etc/rc.d/ script
4. package it all
5. submit changes in gerrit and get them through review.
6. put a package or set of packages up for download/distribution on ftp.freebsd.org

Regards

--

Kaleb

¹ Here's what I get by default when I run configure:
  GlusterFS configure summary
  ===========================
  FUSE client          : no
  Infiniband verbs     : no
  epoll IO multiplex   : no
  argp-standalone      : yes
  fusermount           : yes
  readline             : yes
  georeplication       : no
  Linux-AIO            : no
  Enable Debug         : no
  systemtap            : yes
  Block Device backend : no

Here's the list of packages I had to install in order to build:
  autoconf-2.69
  autoconf-wrapper-20101119
  automake-1.12.4
  automake-wrapper-20101119
  bison-2.5.1,1
  ca_root_nss-3.14
  curl-7.24.0_1
  cvsps-2.1_1
  expat-2.0.1_2
  flex-2.5.37
  fusefs-kmod-0.3.9.p1.20080208_11
  gettext-0.18.1.1
  git-1.8.0
  libiconv-1.14
  libtool-2.4.2
  libxml2-2.7.8_5
  m4-1.4.16_1,1
  p5-Error-0.17018
  p5-Net-SMTP-SSL-1.01_1
  perl-5.14.2_2
  pkgconf-0.8.9
  python27-2.7.3_3

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 <errno.h>
 #include <dirent.h>
 #include <signal.h>
-#ifndef __NetBSD__
+#ifndef GF_BSD_HOST_OS
 #include <mntent.h>
-#endif /* __NetBSD__ */
+#endif /* GF_BSD_HOST_OS */
 #include <sys/stat.h>
 #include <sys/poll.h>
 #include <sys/un.h>
 #include <sys/wait.h>
 #include <sys/mount.h>
 
+#ifdef GF_BSD_HOST_OS
 #ifdef __NetBSD__
 #include <perfuse.h>
+#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 <config.h>
 
 #include "mount_util.h"
+#include "../fuse-lib/mount-gluster-compat.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -20,7 +21,9 @@
 #include <fcntl.h>
 #include <pwd.h>
 #include <limits.h>
+#ifdef GF_LINUX_HOST_OS
 #include <mntent.h>
+#endif
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <sys/mount.h>
@@ -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 <sys/procfs.h>
+#elif defined(GF_BSD_HOST_OS)
+#include <sys/user.h>
 #else
 #include <sys/sysctl.h>
 #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 <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
@@ -25,6 +24,7 @@
 #include "posix.h"
 #include "xlator.h"
 #include "syscall.h"
+#include "compat-errno.h"
 
 
 #define HANDLE_PFX ".glusterfs"

[Index of Archives]     [Gluster Users]     [Ceph Users]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux