summaryrefslogtreecommitdiff
path: root/filesystems
diff options
context:
space:
mode:
authormanu <manu>2012-10-19 04:15:21 +0000
committermanu <manu>2012-10-19 04:15:21 +0000
commit792ee517e8b9302f36ce3a359ea97a7446378969 (patch)
tree15464581aab6b22996c61f6368adfa7ff07f3ada /filesystems
parent0d7b488adaabba7c818677ae60ce335f9e6856a8 (diff)
downloadpkgsrc-792ee517e8b9302f36ce3a359ea97a7446378969.tar.gz
Bump to glusterfs-3.3.1, which brings
- unified file and object storage - storage for Hadoop (not tested here) - proactive self-healing - much better performance
Diffstat (limited to 'filesystems')
-rw-r--r--filesystems/glusterfs/MESSAGE.NetBSD30
-rw-r--r--filesystems/glusterfs/Makefile17
-rw-r--r--filesystems/glusterfs/PLIST102
-rw-r--r--filesystems/glusterfs/PLIST.georeplication6
-rw-r--r--filesystems/glusterfs/distinfo41
-rwxr-xr-xfilesystems/glusterfs/files/glusterd.sh12
-rw-r--r--filesystems/glusterfs/files/ssl.patch1231
-rw-r--r--filesystems/glusterfs/options.mk18
-rw-r--r--filesystems/glusterfs/patches/patch-aa16
-rw-r--r--filesystems/glusterfs/patches/patch-ab51
-rw-r--r--filesystems/glusterfs/patches/patch-ac18
-rw-r--r--filesystems/glusterfs/patches/patch-ae101
-rw-r--r--filesystems/glusterfs/patches/patch-af16
-rw-r--r--filesystems/glusterfs/patches/patch-an62
-rw-r--r--filesystems/glusterfs/patches/patch-ao180
-rw-r--r--filesystems/glusterfs/patches/patch-ar16
-rw-r--r--filesystems/glusterfs/patches/patch-as17
-rw-r--r--filesystems/glusterfs/patches/patch-ax16
-rw-r--r--filesystems/glusterfs/patches/patch-bb60
-rw-r--r--filesystems/glusterfs/patches/patch-be421
-rw-r--r--filesystems/glusterfs/patches/patch-bf57
-rw-r--r--filesystems/glusterfs/patches/patch-bh39
-rw-r--r--filesystems/glusterfs/patches/patch-bj15
-rw-r--r--filesystems/glusterfs/patches/patch-bk171
-rw-r--r--filesystems/glusterfs/patches/patch-bl16
-rw-r--r--filesystems/glusterfs/patches/patch-bm17
-rw-r--r--filesystems/glusterfs/patches/patch-bn38
-rw-r--r--filesystems/glusterfs/patches/patch-bo16
-rw-r--r--filesystems/glusterfs/patches/patch-bp19
-rw-r--r--filesystems/glusterfs/patches/patch-bq92
-rw-r--r--filesystems/glusterfs/patches/patch-br119
-rw-r--r--filesystems/glusterfs/patches/patch-bs83
-rw-r--r--filesystems/glusterfs/patches/patch-bt27
-rw-r--r--filesystems/glusterfs/patches/patch-bv24
-rw-r--r--filesystems/glusterfs/patches/patch-bw23
-rw-r--r--filesystems/glusterfs/patches/patch-bx18
-rw-r--r--filesystems/glusterfs/patches/patch-ca25
-rw-r--r--filesystems/glusterfs/patches/patch-ce75
-rw-r--r--filesystems/glusterfs/patches/patch-cf16
-rw-r--r--filesystems/glusterfs/patches/patch-da26
-rw-r--r--filesystems/glusterfs/patches/patch-db39
41 files changed, 153 insertions, 3233 deletions
diff --git a/filesystems/glusterfs/MESSAGE.NetBSD b/filesystems/glusterfs/MESSAGE.NetBSD
index b2c63b58426..637934a2858 100644
--- a/filesystems/glusterfs/MESSAGE.NetBSD
+++ b/filesystems/glusterfs/MESSAGE.NetBSD
@@ -1,13 +1,8 @@
===========================================================================
-$NetBSD: MESSAGE.NetBSD,v 1.12 2011/11/12 06:01:28 manu Exp $
+$NetBSD: MESSAGE.NetBSD,v 1.13 2012/10/19 04:15:21 manu Exp $
*** GlusterFS clients ***
-You need a kernel with the following options (not present in netbsd-5 GENERIC)
- file-system PUFFS
- pseudo-device putter
- pseudo-device pud
-
-This is required in /etc/sysctl.conf in order to avoid hangs on I/O operations:
+This is required in /etc/sysctl.conf in order to avoid hangs on I/O operations
kern.sbmax=4194304
net.inet.tcp.sendbuf_max=1048576
net.inet.tcp.recvbuf_max=1048576
@@ -15,18 +10,25 @@ This is required in /etc/sysctl.conf in order to avoid hangs on I/O operations:
In order to use mount -t glusterfs, please install this link
ln -s ${PREFIX}/sbin/mount.glusterfs /sbin/mount_glusterfs
+* Only for netbsd-5 branch (later NetBSD GENERIC kernels have it enabled):
+A kernel with the following option is required:
+ file-system PUFFS
+ pseudo-device putter
+ pseudo-device pud
+
*** GlusterFS servers ***
glusterfs servers will need extended attributes in exported filesystems.
-On netbsd-5 branch, this means UFS1 and a kernel with the following options:
+This require a kernel with the following options:
options UFS_EXTATTR
- options UFS_EXTATTR_AUTOSTART
- options UFS_EXTATTR_AUTOCREATE=1024
-
-On NetBSD-current, UFS_EXTATTR_AUTOSTART and UFS_EXTATTR_AUTOCREATE are not
-options anymore, but you need to mount the filesystem with -o extattr
-You will also need to create theses directories on exported filesystems' roots:
+You will need to create the directories below on exported filesystems' roots,
+and then mount with -o extattr
.attribute/system
.attribute/user
+* Only for netbsd-5 branch (later NetBSD version do not need that)
+mount -o extattr shall not be used, but the kernel needs options below:
+ options UFS_EXTATTR_AUTOSTART
+ options UFS_EXTATTR_AUTOCREATE=1024
+
===========================================================================
diff --git a/filesystems/glusterfs/Makefile b/filesystems/glusterfs/Makefile
index 4e5893cf47a..f6a2b87a041 100644
--- a/filesystems/glusterfs/Makefile
+++ b/filesystems/glusterfs/Makefile
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.32 2012/10/03 16:08:33 asau Exp $
+# $NetBSD: Makefile,v 1.33 2012/10/19 04:15:21 manu Exp $
#
-DISTNAME= glusterfs-3.2.7
+DISTNAME= glusterfs-3.3.1
CATEGORIES= filesystems
-MASTER_SITES= http://download.gluster.com/pub/gluster/glusterfs/3.2/3.2.7/
+MASTER_SITES= http://download.gluster.org/pub/gluster/glusterfs/3.3/3.3.1/
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://www.gluster.org/
@@ -15,7 +15,6 @@ USE_LIBTOOL= yes
USE_TOOLS+= flex bison
CONFIGURE_ARGS+= --localstatedir=${VARBASE}
-CONFIGURE_ARGS+= CFLAGS=${CFLAGS:M*:Q}\ -D_INCOMPLETE_XOPEN_C063
CONFIGURE_ARGS+= CFLAGS=${CFLAGS:M*:Q}\ -DDEBUG
# Make sure we do not attept to link with -lfl
@@ -62,8 +61,6 @@ SUBST_SED.vol= -e "s/glusterd.vol/glusterd.vol.sample/g"
REPLACE_PYTHON+= ${WRKSRC}/extras/volgen/glusterfs-volgen
EGDIR= ${PREFIX}/etc/glusterfs
-CONF_FILES+= ${EGDIR}/glusterfs.vol.sample ${EGDIR}/glusterfs.vol
-CONF_FILES+= ${EGDIR}/glusterfsd.vol.sample ${EGDIR}/glusterfsd.vol
CONF_FILES+= ${EGDIR}/glusterd.vol.sample ${EGDIR}/glusterd.vol
OWN_DIRS+= ${VARBASE}/log/glusterfs
BUILD_DEFS+= VARBASE
@@ -71,6 +68,8 @@ BUILD_DEFS+= VARBASE
RCD_SCRIPTS= glusterfsd glusterd
PLIST_SRC= ${PLIST_SRC_DFLT}
+PLIST_SUBST+= VARBASE=${VARBASE}
+PLIST_SUBST+= PKG_SYSCONFDIR=${PKG_SYSCONFDIR}
MESSAGE_SRC= ${PKGDIR}/MESSAGE.${OPSYS}
@@ -79,9 +78,7 @@ post-build:
post-install:
${INSTALL_SCRIPT} ${DESTDIR}/sbin/mount.glusterfs \
- ${DESTDIR}/${PREFIX}/sbin/
- ${INSTALL_SCRIPT} ${FILESDIR}/xattr-init.sh \
- ${DESTDIR}/${PREFIX}/etc/glusterfs/
+ ${DESTDIR}/${PREFIX}/sbin/mount.glusterfs
# Debug
CFLAGS+= -g
@@ -92,7 +89,7 @@ INSTALL_UNSTRIPPED= yes
.include "../../mk/bsd.prefs.mk"
.include "../../lang/python/application.mk"
.if ${OPSYS} == "NetBSD"
-.include "../../filesystems/perfuse/buildlink3.mk"
+#.include "../../filesystems/perfuse/buildlink3.mk"
.endif
.include "../../mk/bsd.pkg.mk"
diff --git a/filesystems/glusterfs/PLIST b/filesystems/glusterfs/PLIST
index 794848ca5fd..73c9b775cb0 100644
--- a/filesystems/glusterfs/PLIST
+++ b/filesystems/glusterfs/PLIST
@@ -1,74 +1,53 @@
-@comment $NetBSD: PLIST,v 1.12 2012/06/16 01:47:33 manu Exp $
-etc/glusterfs/xattr-init.sh
-etc/glusterfs/glusterfs.vol.sample
-etc/glusterfs/glusterfsd.vol.sample
etc/glusterfs/glusterd.vol.sample
-etc/glusterfs/xattr-init.sh
lib/libglusterfs.la
lib/libgfrpc.la
lib/libgfxdr.la
-lib/glusterfs/3.2.7/auth/addr.la
-lib/glusterfs/3.2.7/auth/login.la
-lib/glusterfs/3.2.7/rpc-transport/socket.la
-lib/glusterfs/3.2.7/xlator/cluster/afr.la
-lib/glusterfs/3.2.7/xlator/cluster/dht.la
-lib/glusterfs/3.2.7/xlator/cluster/distribute.so
-lib/glusterfs/3.2.7/xlator/cluster/nufa.la
-lib/glusterfs/3.2.7/xlator/cluster/pump.la
-lib/glusterfs/3.2.7/xlator/cluster/replicate.so
-lib/glusterfs/3.2.7/xlator/cluster/stripe.la
-lib/glusterfs/3.2.7/xlator/cluster/switch.la
-lib/glusterfs/3.2.7/xlator/debug/error-gen.la
-lib/glusterfs/3.2.7/xlator/debug/io-stats.la
-lib/glusterfs/3.2.7/xlator/debug/trace.la
-lib/glusterfs/3.2.7/xlator/encryption/rot-13.la
-lib/glusterfs/3.2.7/xlator/features/access-control.so
-lib/glusterfs/3.2.7/xlator/features/locks.la
-lib/glusterfs/3.2.7/xlator/features/mac-compat.la
-lib/glusterfs/3.2.7/xlator/features/marker.la
-lib/glusterfs/3.2.7/xlator/features/posix-locks.so
-lib/glusterfs/3.2.7/xlator/features/quiesce.la
-lib/glusterfs/3.2.7/xlator/features/quota.la
-lib/glusterfs/3.2.7/xlator/features/read-only.la
-lib/glusterfs/3.2.7/xlator/mgmt/glusterd.la
-lib/glusterfs/3.2.7/xlator/mount/fuse.la
-lib/glusterfs/3.2.7/xlator/nfs/server.la
-lib/glusterfs/3.2.7/xlator/performance/io-cache.la
-lib/glusterfs/3.2.7/xlator/performance/io-threads.la
-lib/glusterfs/3.2.7/xlator/performance/quick-read.la
-lib/glusterfs/3.2.7/xlator/performance/read-ahead.la
-lib/glusterfs/3.2.7/xlator/performance/stat-prefetch.la
-lib/glusterfs/3.2.7/xlator/performance/write-behind.la
-lib/glusterfs/3.2.7/xlator/protocol/client.la
-lib/glusterfs/3.2.7/xlator/protocol/server.la
-lib/glusterfs/3.2.7/xlator/storage/posix.la
-lib/glusterfs/3.2.7/xlator/system/posix-acl.la
-lib/glusterfs/3.2.7/xlator/testing/features/trash.la
-lib/glusterfs/3.2.7/xlator/testing/performance/symlink-cache.la
-man/man8/glusterfs.8
-man/man8/mount.glusterfs.8
+lib/glusterfs/3.3.1/auth/addr.la
+lib/glusterfs/3.3.1/auth/login.la
+lib/glusterfs/3.3.1/rpc-transport/socket.la
+lib/glusterfs/3.3.1/xlator/cluster/afr.la
+lib/glusterfs/3.3.1/xlator/cluster/dht.la
+lib/glusterfs/3.3.1/xlator/cluster/distribute.so
+lib/glusterfs/3.3.1/xlator/cluster/nufa.la
+lib/glusterfs/3.3.1/xlator/cluster/pump.la
+lib/glusterfs/3.3.1/xlator/cluster/replicate.so
+lib/glusterfs/3.3.1/xlator/cluster/stripe.la
+lib/glusterfs/3.3.1/xlator/cluster/switch.la
+lib/glusterfs/3.3.1/xlator/debug/error-gen.la
+lib/glusterfs/3.3.1/xlator/debug/io-stats.la
+lib/glusterfs/3.3.1/xlator/debug/trace.la
+lib/glusterfs/3.3.1/xlator/encryption/rot-13.la
+lib/glusterfs/3.3.1/xlator/features/access-control.so
+lib/glusterfs/3.3.1/xlator/features/index.la
+lib/glusterfs/3.3.1/xlator/features/locks.la
+lib/glusterfs/3.3.1/xlator/features/mac-compat.la
+lib/glusterfs/3.3.1/xlator/features/marker.la
+lib/glusterfs/3.3.1/xlator/features/posix-locks.so
+lib/glusterfs/3.3.1/xlator/features/quiesce.la
+lib/glusterfs/3.3.1/xlator/features/quota.la
+lib/glusterfs/3.3.1/xlator/features/read-only.la
+lib/glusterfs/3.3.1/xlator/features/worm.la
+lib/glusterfs/3.3.1/xlator/mgmt/glusterd.la
+lib/glusterfs/3.3.1/xlator/mount/fuse.la
+lib/glusterfs/3.3.1/xlator/nfs/server.la
+lib/glusterfs/3.3.1/xlator/performance/io-cache.la
+lib/glusterfs/3.3.1/xlator/performance/io-threads.la
+lib/glusterfs/3.3.1/xlator/performance/md-cache.la
+lib/glusterfs/3.3.1/xlator/performance/quick-read.la
+lib/glusterfs/3.3.1/xlator/performance/read-ahead.la
+lib/glusterfs/3.3.1/xlator/performance/stat-prefetch.so
+lib/glusterfs/3.3.1/xlator/performance/write-behind.la
+lib/glusterfs/3.3.1/xlator/protocol/client.la
+lib/glusterfs/3.3.1/xlator/protocol/server.la
+lib/glusterfs/3.3.1/xlator/storage/posix.la
+lib/glusterfs/3.3.1/xlator/system/posix-acl.la
+lib/glusterfs/3.3.1/xlator/testing/performance/symlink-cache.la
man/man8/gluster.8
-man/man8/glusterd.8
-man/man8/glusterfsd.8
sbin/glusterd
sbin/glusterfs
sbin/glusterfsd
sbin/gluster
sbin/mount.glusterfs
-share/doc/glusterfs/examples/README
-share/doc/glusterfs/examples/unify.vol
-share/doc/glusterfs/examples/replicate.vol
-share/doc/glusterfs/examples/stripe.vol
-share/doc/glusterfs/examples/protocol-client.vol
-share/doc/glusterfs/examples/protocol-server.vol
-share/doc/glusterfs/examples/posix-locks.vol
-share/doc/glusterfs/examples/trash.vol
-share/doc/glusterfs/examples/write-behind.vol
-share/doc/glusterfs/examples/io-threads.vol
-share/doc/glusterfs/examples/io-cache.vol
-share/doc/glusterfs/examples/read-ahead.vol
-share/doc/glusterfs/examples/filter.vol
-share/doc/glusterfs/examples/trace.vol
share/doc/glusterfs/benchmarking/rdd.c
share/doc/glusterfs/benchmarking/glfs-bm.c
share/doc/glusterfs/benchmarking/README
@@ -78,3 +57,4 @@ share/doc/glusterfs/glusterfs-mode.el
share/doc/glusterfs/glusterfs.vim
share/examples/rc.d/glusterfsd
share/examples/rc.d/glusterd
+@exec test -d ${PKG_SYSCONFDIR}/glusterd -a ! -d ${VARBASE}/lib/glusterd && ${MKDIR} -p ${VARBASE}/lib/ && mv ${PKG_SYSCONFDIR}/glusterd ${VARBASE}/lib/glusterd && ${LN} -s ${VARBASE}/lib/glusterd ${PKG_SYSCONFDIR}/glusterd
diff --git a/filesystems/glusterfs/PLIST.georeplication b/filesystems/glusterfs/PLIST.georeplication
index 14e94fd7aee..86d4f6e4c49 100644
--- a/filesystems/glusterfs/PLIST.georeplication
+++ b/filesystems/glusterfs/PLIST.georeplication
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST.georeplication,v 1.4 2011/09/27 12:45:02 manu Exp $
+@comment $NetBSD: PLIST.georeplication,v 1.5 2012/10/19 04:15:21 manu Exp $
libexec/glusterfs/python/syncdaemon/README.md
libexec/glusterfs/python/syncdaemon/__init__.py
libexec/glusterfs/python/syncdaemon/__init__.pyc
@@ -12,6 +12,9 @@ libexec/glusterfs/python/syncdaemon/gconf.pyo
libexec/glusterfs/python/syncdaemon/gsyncd.py
libexec/glusterfs/python/syncdaemon/gsyncd.pyc
libexec/glusterfs/python/syncdaemon/gsyncd.pyo
+libexec/glusterfs/python/syncdaemon/ipaddr.py
+libexec/glusterfs/python/syncdaemon/ipaddr.pyc
+libexec/glusterfs/python/syncdaemon/ipaddr.pyo
libexec/glusterfs/python/syncdaemon/libcxattr.py
libexec/glusterfs/python/syncdaemon/libcxattr.pyc
libexec/glusterfs/python/syncdaemon/libcxattr.pyo
@@ -30,4 +33,3 @@ libexec/glusterfs/python/syncdaemon/resource.pyo
libexec/glusterfs/python/syncdaemon/syncdutils.py
libexec/glusterfs/python/syncdaemon/syncdutils.pyc
libexec/glusterfs/python/syncdaemon/syncdutils.pyo
-libexec/glusterfs/gsyncd
diff --git a/filesystems/glusterfs/distinfo b/filesystems/glusterfs/distinfo
index 645accca10e..daeb9c3077d 100644
--- a/filesystems/glusterfs/distinfo
+++ b/filesystems/glusterfs/distinfo
@@ -1,36 +1,7 @@
-$NetBSD: distinfo,v 1.25 2012/06/16 01:47:33 manu Exp $
+$NetBSD: distinfo,v 1.26 2012/10/19 04:15:21 manu Exp $
-SHA1 (glusterfs-3.2.7.tar.gz) = 13873edece614ecdbb75953daefaf76c4fd2ca3b
-RMD160 (glusterfs-3.2.7.tar.gz) = 8ecc90a0bf852a57db33d15480b494926abe2abe
-Size (glusterfs-3.2.7.tar.gz) = 2424292 bytes
-SHA1 (patch-aa) = bfd1dbcb6945dd387d88bd96616e4bc29c3e0628
-SHA1 (patch-ab) = d240bfd8bd8e5994f612a3387cd75f30bb91c8d7
-SHA1 (patch-ac) = 21d86775c2174ea630404a1a329dfd49c7f493d9
-SHA1 (patch-ae) = d5d0dce5cb82c61fbb02289123d0be34ce835e18
-SHA1 (patch-af) = ac9333cc55ad0cf42233e3c69b32e22c483c077a
-SHA1 (patch-an) = 21f56d5379023bd2ea3432b4e3e3f9a0979c496f
-SHA1 (patch-ao) = 26e350655e276c8cb3ecb3cc9b7c0a4e7ab2ff7b
-SHA1 (patch-ar) = 27d0288083d06623a328e851a776095aa1f1d2df
-SHA1 (patch-as) = a2c637bf52151e85969927f281e432693ac539ba
-SHA1 (patch-ax) = 054942de06c3df60ffc0c190dd2702f77edd9ec6
-SHA1 (patch-bb) = f7b79676322064396242b0f3e6cd81c180c7dd8e
-SHA1 (patch-be) = f178ee8106c349354f7f21bc37fca3ca47ca9e44
-SHA1 (patch-bf) = 0f182ccd632b5e622237bd95c9978c113f8ce531
-SHA1 (patch-bh) = d88d4e8b863f36b2c27c4f5eff2fdc235ef76fd8
-SHA1 (patch-bj) = 9b8b2374d4c197e60a1990b09be1117bf0c0a552
-SHA1 (patch-bk) = 3464ae85a444f5dc8adf2262b3bc25d88a531bb8
-SHA1 (patch-bl) = 4e61aef116ce34907f7a93beaa9ad7a3c49751a9
-SHA1 (patch-bm) = 401fe1c2bbf71474e2238c3e6c3fe5a5c614c4f5
-SHA1 (patch-bn) = 98ce48be2239f42edc4ef8e26644305f6aa0a5eb
-SHA1 (patch-bo) = be0dcdcc0acb6a5e54664372c34a28f1307fbd00
-SHA1 (patch-bp) = 77463ea7d739d532e20dbe5bd66d58c22ba0c248
-SHA1 (patch-bq) = 083f22383b88890f9e6f2c90a4435657ccd10579
-SHA1 (patch-br) = 153aa644c306407e3135620f31d0ff918bfdb1e5
-SHA1 (patch-bs) = d2f79ef19143f74f5a12187ea2dfd9e1ed92b726
-SHA1 (patch-bt) = 58f8e5ce66e6b691dd9972bd649dc18f7d5a258a
-SHA1 (patch-bv) = 2c3b654e5858bf0948307ca6ae7048e276fca9ef
-SHA1 (patch-bw) = dca12eb81163fd1a0ada13165e990ddcb8fefbf2
-SHA1 (patch-bx) = b2aca473091bb64d14c6da046379d33ca8a5785e
-SHA1 (patch-ca) = 7b87f5b1a34eaa9a74f21bc40c794585817070ae
-SHA1 (patch-ce) = a1bfec3d057a27cefc4eb70d46a42202637d973f
-SHA1 (patch-cf) = 6d615a6a48f14f7e08c6b034d73ce441c26d0105
+SHA1 (glusterfs-3.3.1.tar.gz) = c29632e4938533069c4c0206fb1c32de8443168d
+RMD160 (glusterfs-3.3.1.tar.gz) = 667bac9362aab01ab04f9119e399b8d955e01135
+Size (glusterfs-3.3.1.tar.gz) = 2636698 bytes
+SHA1 (patch-da) = 312a8c73c1a22058dc43cf5f957380c42a5a23e4
+SHA1 (patch-db) = a97ac1bea9be2a9d7162eb495cb9b3c741d70e34
diff --git a/filesystems/glusterfs/files/glusterd.sh b/filesystems/glusterfs/files/glusterd.sh
index b52c991b459..d9b4d31fc64 100755
--- a/filesystems/glusterfs/files/glusterd.sh
+++ b/filesystems/glusterfs/files/glusterd.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: glusterd.sh,v 1.9 2011/12/09 16:57:44 manu Exp $
+# $NetBSD: glusterd.sh,v 1.10 2012/10/19 04:15:21 manu Exp $
#
# PROVIDE: glusterd
@@ -9,12 +9,22 @@
$_rc_subr_loaded . /etc/rc.subr
+glusterd_precmd()
+{
+ test -d @VARBASE@/lib/glusterd && return
+ test -d @PREFIX@/etc/glusterd || return
+ mv @PREFIX@/etc/glusterd @VARBASE@/lib/glusterd && \
+ ln -s @VARBASE@/lib/glusterd @PREFIX@/etc/glusterd
+}
+
name="glusterd"
rcvar=$name
command="@PREFIX@/sbin/${name}"
+start_precmd="glusterd_precmd"
pidfile="/var/run/${name}.pid"
command_args="-p ${pidfile}"
required_files="@PREFIX@/etc/glusterfs/${name}.vol"
load_rc_config $name
run_rc_command "$1"
+
diff --git a/filesystems/glusterfs/files/ssl.patch b/filesystems/glusterfs/files/ssl.patch
deleted file mode 100644
index eb598906ad4..00000000000
--- a/filesystems/glusterfs/files/ssl.patch
+++ /dev/null
@@ -1,1231 +0,0 @@
-$NetBSD: ssl.patch,v 1.2 2011/12/16 05:40:46 manu Exp $
-
-SSL support pulled from not yet committed upstream patch
-http://review.gluster.com/#change,362
-
---- ./xlators/performance/write-behind/src/write-behind.c.orig 2011-11-14 14:46:02.000000000 +0100
-+++ ./xlators/performance/write-behind/src/write-behind.c 2011-12-15 03:22:43.000000000 +0100
-@@ -371,8 +371,13 @@
-
- local = frame->local;
- winds = &local->winds;
-
-+ /*
-+ * I don't know how we get here without "local" being valid, but we
-+ * do sometimes during disconnect processing.
-+ */
-+ GF_VALIDATE_OR_GOTO (this->name, local, out);
- file = local->file;
- GF_VALIDATE_OR_GOTO (this->name, file, out);
-
- LOCK (&file->lock);
---- ./xlators/mgmt/glusterd/src/glusterd-volgen.c.orig 2011-11-14 14:46:02.000000000 +0100
-+++ ./xlators/mgmt/glusterd/src/glusterd-volgen.c 2011-12-14 20:47:10.000000000 +0100
-@@ -187,8 +187,12 @@
-
- {VKEY_FEATURES_QUOTA, "features/marker", "quota", "off", NO_DOC, OPT_FLAG_FORCE},
- {VKEY_FEATURES_LIMIT_USAGE, "features/quota", "limit-set", NULL, NO_DOC, 0},
- {"features.quota-timeout", "features/quota", "timeout", "0", DOC, 0},
-+ { "server.ssl", "protocol/server",
-+"transport.socket.ssl-enabled", NULL, NO_DOC, 0},
-+ { "client.ssl", "protocol/client",
-+"transport.socket.ssl-enabled", NULL, NO_DOC, 0},
- {NULL, }
- };
-
-
---- ./xlators/mgmt/glusterd/src/glusterd.c.orig 2011-12-15 03:16:25.000000000 +0100
-+++ ./xlators/mgmt/glusterd/src/glusterd.c 2011-12-15 03:17:31.000000000 +0100
-@@ -691,16 +691,21 @@
- ret = configure_syncdaemon (conf);
- if (ret)
- goto out;
-
-- ret = glusterd_restore ();
-- if (ret < 0)
-- goto out;
-
- glusterd_friend_sm_init ();
- glusterd_op_sm_init ();
- glusterd_opinfo_init ();
-
-+ /*
-+ * This uses some of the fields initialized in glusterd_*_init, so
-+ * do it *after* those.
-+ */
-+ ret = glusterd_restore ();
-+ if (ret < 0)
-+ goto out;
-+
- ret = glusterd_handle_upgrade_downgrade (this->options, conf);
- if (ret)
- goto out;
-
---- ./xlators/protocol/server/src/server3_1-fops.c.orig 2011-11-14 14:46:03.000000000 +0100
-+++ ./xlators/protocol/server/src/server3_1-fops.c 2011-12-14 20:47:10.000000000 +0100
-@@ -3129,8 +3129,13 @@
- goto out;
- }
-
- conn = req->trans->xl_private;
-+ if (!conn) {
-+ /* Handshake is not complete yet. */
-+ req->rpc_err = SYSTEM_ERR;
-+ goto out;
-+ }
- gf_fd_put (conn->fdtable, args.fd);
-
- server_submit_reply (NULL, req, &rsp, NULL, 0, NULL,
- xdr_serialize_common_rsp);
---- ./rpc/rpc-transport/socket/src/Makefile.am.orig 2011-11-14 14:46:00.000000000 +0100
-+++ ./rpc/rpc-transport/socket/src/Makefile.am 2011-12-14 20:47:10.000000000 +0100
-@@ -2,9 +2,9 @@
-
- rpctransport_LTLIBRARIES = socket.la
- rpctransportdir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/rpc-transport
-
--socket_la_LDFLAGS = -module -avoidversion
-+socket_la_LDFLAGS = -module -avoidversion -lssl
-
- socket_la_SOURCES = socket.c name.c
- socket_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
-
---- ./rpc/rpc-transport/socket/src/Makefile.in.orig 2011-11-14 14:46:14.000000000 +0100
-+++ ./rpc/rpc-transport/socket/src/Makefile.in 2011-12-14 20:47:10.000000000 +0100
-@@ -226,9 +226,9 @@
- target_alias = @target_alias@
- noinst_HEADERS = socket.h name.h
- rpctransport_LTLIBRARIES = socket.la
- rpctransportdir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/rpc-transport
--socket_la_LDFLAGS = -module -avoidversion
-+socket_la_LDFLAGS = -module -avoidversion -lssl
- socket_la_SOURCES = socket.c name.c
- socket_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
- AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall -D$(GF_HOST_OS)\
- -I$(top_srcdir)/libglusterfs/src -I$(top_srcdir)/rpc/rpc-lib/src/ \
---- ./rpc/rpc-transport/socket/src/socket.c.orig 2011-12-14 20:46:23.000000000 +0100
-+++ ./rpc/rpc-transport/socket/src/socket.c 2011-12-15 03:31:03.000000000 +0100
-@@ -42,12 +42,35 @@
- #include <fcntl.h>
- #include <errno.h>
- #include <netinet/tcp.h>
- #include <rpc/xdr.h>
--
-+#include <sys/ioctl.h>
- #define GF_LOG_ERRNO(errno) ((errno == ENOTCONN) ? GF_LOG_DEBUG : GF_LOG_ERROR)
- #define SA(ptr) ((struct sockaddr *)ptr)
-
-+#define SSL_ENABLED_OPT "transport.socket.ssl-enabled"
-+#define SSL_OWN_CERT_OPT "transport.socket.ssl-own-cert"
-+#define SSL_PRIVATE_KEY_OPT "transport.socket.ssl-private-key"
-+#define SSL_CA_LIST_OPT "transport.socket.ssl-ca-list"
-+#define OWN_THREAD_OPT "transport.socket.own-thread"
-+
-+/* TBD: do automake substitutions etc. (ick) to set these. */
-+#if !defined(DEFAULT_CERT_PATH)
-+#define DEFAULT_CERT_PATH "/etc/ssl/glusterfs.pem"
-+#endif
-+#if !defined(DEFAULT_KEY_PATH)
-+#define DEFAULT_KEY_PATH "/etc/ssl/glusterfs.key"
-+#endif
-+#if !defined(DEFAULT_CA_PATH)
-+#define DEFAULT_CA_PATH "/etc/ssl/glusterfs.ca"
-+#endif
-+
-+#define POLL_MASK_INPUT (POLLIN | POLLPRI)
-+#define POLL_MASK_OUTPUT (POLLOUT)
-+#define POLL_MASK_ERROR (POLLERR | POLLHUP | POLLNVAL)
-+
-+typedef int SSL_unary_func (SSL *);
-+typedef int SSL_trinary_func (SSL *, void *, int);
-
- #define __socket_proto_reset_pending(priv) do { \
- memset (&priv->incoming.frag.vector, 0, \
- sizeof (priv->incoming.frag.vector)); \
-@@ -132,11 +155,158 @@
- } \
- __socket_proto_update_priv_after_read (priv, ret, bytes_read); \
- }
-
--
- int socket_init (rpc_transport_t *this);
-
-+void
-+ssl_dump_error_stack (const char *caller)
-+{
-+ unsigned long errnum = 0;
-+ char errbuf[120] = {0,};
-+
-+ /* OpenSSL docs explicitly give 120 as the error-string length. */
-+
-+ while ((errnum = ERR_get_error())) {
-+ ERR_error_string(errnum,errbuf);
-+ gf_log(caller,GF_LOG_ERROR," %s",errbuf);
-+ }
-+}
-+
-+int
-+ssl_do (rpc_transport_t *this, void *buf, size_t len, SSL_trinary_func *func)
-+{
-+ int r = (-1);
-+ struct pollfd pfd = {-1,};
-+ socket_private_t *priv = NULL;
-+
-+ GF_VALIDATE_OR_GOTO(this->name,this->private,out);
-+ priv = this->private;
-+
-+ for (;;) {
-+ if (buf) {
-+ if (priv->connected == -1) {
-+ /*
-+ * Fields in the SSL structure (especially
-+ * the BIO pointers) are not valid at this
-+ * point, so we'll segfault if we pass them
-+ * to SSL_read/SSL_write.
-+ */
-+ gf_log(this->name,GF_LOG_INFO,
-+ "lost connection in %s", __func__);
-+ break;
-+ }
-+ r = func(priv->ssl_ssl,buf,len);
-+ }
-+ else {
-+ /*
-+ * We actually need these functions to get to
-+ * priv->connected == 1.
-+ */
-+ r = ((SSL_unary_func *)func)(priv->ssl_ssl);
-+ }
-+ switch (SSL_get_error(priv->ssl_ssl,r)) {
-+ case SSL_ERROR_NONE:
-+ return r;
-+ case SSL_ERROR_WANT_READ:
-+ pfd.fd = priv->sock;
-+ pfd.events = POLLIN;
-+ if (poll(&pfd,1,-1) < 0) {
-+ gf_log(this->name,GF_LOG_ERROR,"poll error %d",
-+ errno);
-+ }
-+ break;
-+ case SSL_ERROR_WANT_WRITE:
-+ pfd.fd = priv->sock;
-+ pfd.events = POLLOUT;
-+ if (poll(&pfd,1,-1) < 0) {
-+ gf_log(this->name,GF_LOG_ERROR,"poll error %d",
-+ errno);
-+ }
-+ break;
-+ case SSL_ERROR_SYSCALL:
-+ /* This is what we get when remote disconnects. */
-+ gf_log(this->name,GF_LOG_DEBUG,
-+ "syscall error (probably remote disconnect)");
-+ errno = ENODATA;
-+ goto out;
-+ default:
-+ errno = EIO;
-+ goto out; /* "break" would just loop again */
-+ }
-+ }
-+out:
-+ return -1;
-+}
-+
-+#define ssl_connect_one(t) ssl_do((t),NULL,0,(SSL_trinary_func *)SSL_connect)
-+#define ssl_accept_one(t) ssl_do((t),NULL,0,(SSL_trinary_func *)SSL_accept)
-+#define ssl_read_one(t,b,l) ssl_do((t),(b),(l),(SSL_trinary_func *)SSL_read)
-+#define ssl_write_one(t,b,l) ssl_do((t),(b),(l),(SSL_trinary_func *)SSL_write)
-+
-+int
-+ssl_setup_connection (rpc_transport_t *this, int server)
-+{
-+ X509 *peer = NULL;
-+ char peer_CN[256] = "";
-+ int ret = -1;
-+ socket_private_t *priv = NULL;
-+
-+ GF_VALIDATE_OR_GOTO(this->name,this->private,done);
-+ priv = this->private;
-+
-+ priv->ssl_ssl = SSL_new(priv->ssl_ctx);
-+ if (!priv->ssl_ssl) {
-+ gf_log(this->name,GF_LOG_ERROR,"SSL_new failed");
-+ ssl_dump_error_stack(this->name);
-+ goto done;
-+ }
-+ priv->ssl_sbio = BIO_new_socket(priv->sock,BIO_NOCLOSE);
-+ if (!priv->ssl_sbio) {
-+ gf_log(this->name,GF_LOG_ERROR,"BIO_new_socket failed");
-+ ssl_dump_error_stack(this->name);
-+ goto free_ssl;
-+ }
-+ SSL_set_bio(priv->ssl_ssl,priv->ssl_sbio,priv->ssl_sbio);
-+
-+ if (server) {
-+ ret = ssl_accept_one(this);
-+ }
-+ else {
-+ ret = ssl_connect_one(this);
-+ }
-+
-+ /* Make sure _the call_ succeeded. */
-+ if (ret < 0) {
-+ goto ssl_error;
-+ }
-+
-+ /* Make sure _SSL verification_ succeeded, yielding an identity. */
-+ if (SSL_get_verify_result(priv->ssl_ssl) != X509_V_OK) {
-+ goto ssl_error;
-+ }
-+ peer = SSL_get_peer_certificate(priv->ssl_ssl);
-+ if (!peer) {
-+ goto ssl_error;
-+ }
-+
-+ /* Finally, everything seems OK. */
-+ X509_NAME_get_text_by_NID(X509_get_subject_name(peer),
-+ NID_commonName, peer_CN, sizeof(peer_CN)-1);
-+ peer_CN[sizeof(peer_CN)-1] = '\0';
-+ gf_log(this->name,GF_LOG_INFO,"peer CN = %s", peer_CN);
-+ return 0;
-+
-+ /* Error paths. */
-+ssl_error:
-+ gf_log(this->name,GF_LOG_ERROR,"SSL connect error");
-+ ssl_dump_error_stack(this->name);
-+free_ssl:
-+ SSL_free(priv->ssl_ssl);
-+done:
-+ return ret;
-+}
-+
- /*
- * return value:
- * 0 = success (completed)
- * -1 = error
-@@ -167,19 +337,43 @@
- if (bytes != NULL) {
- *bytes = 0;
- }
-
-- while (opcount) {
-+ while (opcount > 0) {
-+ if (opvector->iov_len == 0) {
-+ gf_log(this->name,GF_LOG_DEBUG,
-+ "would have passed zero length to read/write");
-+ ++opvector;
-+ --opcount;
-+ continue;
-+ }
- if (write) {
-- ret = writev (sock, opvector, opcount);
-+ if (priv->use_ssl) {
-+ ret = ssl_write_one(this,
-+ opvector->iov_base, opvector->iov_len);
-+ }
-+ else {
-+ ret = writev (sock, opvector, opcount);
-+ }
-
- if (ret == 0 || (ret == -1 && errno == EAGAIN)) {
- /* done for now */
- break;
- }
- this->total_bytes_write += ret;
- } else {
-- ret = readv (sock, opvector, opcount);
-+ if (priv->use_ssl) {
-+ ret = ssl_read_one(this,
-+ opvector->iov_base, opvector->iov_len);
-+ }
-+ else {
-+ ret = readv (sock, opvector, opcount);
-+ }
-+ if (ret == 0) {
-+ gf_log(this->name,GF_LOG_DEBUG,"EOF on socket");
-+ errno = ENODATA;
-+ ret = -1;
-+ }
- if (ret == -1 && errno == EAGAIN) {
- /* done for now */
- break;
- }
-@@ -201,8 +395,11 @@
-
- gf_log (this->name, GF_LOG_WARNING,
- "%s failed (%s)", write ? "writev" : "readv",
- strerror (errno));
-+ if (priv->use_ssl) {
-+ ssl_dump_error_stack(this->name);
-+ }
- opcount = -1;
- break;
- }
-
-@@ -212,8 +409,19 @@
-
- moved = 0;
-
- while (moved < ret) {
-+ if (!opcount) {
-+ gf_log(this->name,GF_LOG_DEBUG,
-+ "ran out of iov, moved %d/%d",
-+ moved, ret);
-+ goto ran_out;
-+ }
-+ if (!opvector[0].iov_len) {
-+ opvector++;
-+ opcount--;
-+ continue;
-+ }
- if ((ret - moved) >= opvector[0].iov_len) {
- moved += opvector[0].iov_len;
- opvector++;
- opcount--;
-@@ -221,15 +429,13 @@
- opvector[0].iov_len -= (ret - moved);
- opvector[0].iov_base += (ret - moved);
- moved += (ret - moved);
- }
-- while (opcount && !opvector[0].iov_len) {
-- opvector++;
-- opcount--;
-- }
- }
- }
-
-+ran_out:
-+
- if (pending_vector)
- *pending_vector = opvector;
-
- if (pending_count)
-@@ -287,8 +493,22 @@
- gf_log (this->name, GF_LOG_DEBUG,
- "shutdown() returned %d. %s",
- ret, strerror (errno));
- }
-+ if (priv->use_ssl) {
-+ SSL_shutdown(priv->ssl_ssl);
-+ SSL_clear(priv->ssl_ssl);
-+ SSL_free(priv->ssl_ssl);
-+ }
-+ if (priv->own_thread) {
-+ /*
-+ * Without this, reconnect (= disconnect + connect)
-+ * won't work except by accident.
-+ */
-+ close(priv->sock);
-+ priv->sock = -1;
-+ ++(priv->socket_gen);
-+ }
- }
-
- out:
- return ret;
-@@ -364,9 +584,8 @@
-
- return ret;
- }
-
--
- int
- __socket_nodelay (int fd)
- {
- int on = 1;
-@@ -620,11 +839,13 @@
- }
-
-
- int
--__socket_ioq_churn_entry (rpc_transport_t *this, struct ioq *entry)
-+__socket_ioq_churn_entry (rpc_transport_t *this, struct ioq *entry, int direct)
- {
-- int ret = -1;
-+ int ret = -1;
-+ socket_private_t *priv = NULL;
-+ char a_byte = 0;
-
- ret = __socket_writev (this, entry->pending_vector,
- entry->pending_count,
- &entry->pending_vector,
-@@ -633,8 +854,20 @@
- if (ret == 0) {
- /* current entry was completely written */
- GF_ASSERT (entry->pending_count == 0);
- __socket_ioq_entry_free (entry);
-+ priv = this->private;
-+ if (priv->own_thread) {
-+ /*
-+ * The pipe should only remain readable if there are
-+ * more entries after this, so drain the byte
-+ * representing this entry.
-+ */
-+ if (!direct && read(priv->pipe[0],&a_byte,1) < 1) {
-+ gf_log(this->name,GF_LOG_WARNING,
-+ "read error on pipe");
-+ }
-+ }
- }
-
- return ret;
- }
-@@ -655,15 +888,15 @@
- while (!list_empty (&priv->ioq)) {
- /* pick next entry */
- entry = priv->ioq_next;
-
-- ret = __socket_ioq_churn_entry (this, entry);
-+ ret = __socket_ioq_churn_entry (this, entry, 0);
-
- if (ret != 0)
- break;
- }
-
-- if (list_empty (&priv->ioq)) {
-+ if (!priv->own_thread && list_empty (&priv->ioq)) {
- /* all pending writes done, not interested in POLLOUT */
- priv->idx = event_select_on (this->ctx->event_pool,
- priv->sock, priv->idx, -1, 0);
- }
-@@ -1645,9 +1878,8 @@
-
- if (pollin != NULL) {
- ret = rpc_transport_notify (this, RPC_TRANSPORT_MSG_RECEIVED,
- pollin);
--
- rpc_transport_pollin_destroy (pollin);
- }
-
- return ret;
-@@ -1668,9 +1900,9 @@
- priv = this->private;
-
- pthread_mutex_lock (&priv->lock);
- {
-- if (priv->connected)
-+ if (priv->connected != 0)
- goto unlock;
-
- ret = __socket_connect_finish (priv->sock);
-
-@@ -1730,11 +1962,11 @@
- int
- socket_event_handler (int fd, int idx, void *data,
- int poll_in, int poll_out, int poll_err)
- {
-- rpc_transport_t *this = NULL;
-+ rpc_transport_t *this = NULL;
- socket_private_t *priv = NULL;
-- int ret = 0;
-+ int ret = -1;
-
- this = data;
- GF_VALIDATE_OR_GOTO ("socket", this, out);
- GF_VALIDATE_OR_GOTO ("socket", this->private, out);
-@@ -1742,18 +1974,15 @@
-
- THIS = this->xl;
- priv = this->private;
-
--
- pthread_mutex_lock (&priv->lock);
- {
- priv->idx = idx;
- }
- pthread_mutex_unlock (&priv->lock);
-
-- if (!priv->connected) {
-- ret = socket_connect_finish (this);
-- }
-+ ret = (priv->connected == 1) ? 0 : socket_connect_finish(this);
-
- if (!ret && poll_out) {
- ret = socket_event_poll_out (this);
- }
-@@ -1767,15 +1996,114 @@
- gf_log ("transport", ((ret >= 0) ? GF_LOG_INFO : GF_LOG_DEBUG),
- "disconnecting now");
- socket_event_poll_err (this);
- rpc_transport_unref (this);
-- }
-+ }
-
- out:
-- return 0;
-+ return ret;
-+}
-+
-+
-+void *
-+socket_poller (void *ctx)
-+{
-+ rpc_transport_t *this = ctx;
-+ socket_private_t *priv = this->private;
-+ struct pollfd pfd[2] = {{0,},};
-+ gf_boolean_t to_write = _gf_false;
-+ int ret = 0;
-+ int orig_gen;
-+
-+ orig_gen = ++(priv->socket_gen);
-+
-+ if (priv->connected == 0) {
-+ THIS = this->xl;
-+ ret = socket_connect_finish (this);
-+ }
-+
-+ for (;;) {
-+ if (priv->socket_gen != orig_gen) {
-+ gf_log(this->name,GF_LOG_DEBUG,
-+ "redundant poller exiting");
-+ return NULL;
-+ }
-+ pthread_mutex_lock(&priv->lock);
-+ to_write = !list_empty(&priv->ioq);
-+ pthread_mutex_unlock(&priv->lock);
-+ pfd[0].fd = priv->pipe[0];
-+ pfd[0].events = POLL_MASK_ERROR;
-+ pfd[0].revents = 0;
-+ pfd[1].fd = priv->sock;
-+ pfd[1].events = POLL_MASK_INPUT | POLL_MASK_ERROR;
-+ pfd[1].revents = 0;
-+ if (to_write) {
-+ pfd[1].events |= POLL_MASK_OUTPUT;
-+ }
-+ else {
-+ pfd[0].events |= POLL_MASK_INPUT;
-+ }
-+ if (poll(pfd,2,-1) < 0) {
-+ gf_log(this->name,GF_LOG_ERROR,"poll failed");
-+ break;
-+ }
-+ if (pfd[0].revents & POLL_MASK_ERROR) {
-+ gf_log(this->name,GF_LOG_ERROR,
-+ "poll error on pipe");
-+ break;
-+ }
-+ /* Only glusterd actually seems to need this. */
-+ THIS = this->xl;
-+ if (pfd[1].revents & POLL_MASK_INPUT) {
-+ ret = socket_event_poll_in(this);
-+ if (ret >= 0) {
-+ /* Suppress errors while making progress. */
-+ pfd[1].revents &= ~POLL_MASK_ERROR;
-+ }
-+ else if (errno == ENOTCONN) {
-+ ret = 0;
-+ }
-+ }
-+ else if (pfd[1].revents & POLL_MASK_OUTPUT) {
-+ ret = socket_event_poll_out(this);
-+ if (ret >= 0) {
-+ /* Suppress errors while making progress. */
-+ pfd[1].revents &= ~POLL_MASK_ERROR;
-+ }
-+ else if (errno == ENOTCONN) {
-+ ret = 0;
-+ }
-+ }
-+ else {
-+ /*
-+ * This usually means that we left poll() because
-+ * somebody pushed a byte onto our pipe. That wakeup
-+ * is why the pipe is there, but once awake we can do
-+ * all the checking we need on the next iteration.
-+ */
-+ ret = 0;
-+ }
-+ if (pfd[1].revents & POLL_MASK_ERROR) {
-+ gf_log(this->name,GF_LOG_ERROR,
-+ "poll error on socket");
-+ break;
-+ }
-+ if (ret < 0) {
-+ gf_log(this->name,GF_LOG_ERROR,
-+ "error in polling loop");
-+ break;
-+ }
-+ }
-+
-+ /* All (and only) I/O errors should come here. */
-+ __socket_disconnect (this);
-+ rpc_transport_notify (this, RPC_TRANSPORT_DISCONNECT, this);
-+ rpc_transport_unref (this);
-+ return NULL;
- }
-
-
-+
- int
- socket_server_event_handler (int fd, int idx, void *data,
- int poll_in, int poll_out, int poll_err)
- {
-@@ -1812,21 +2140,8 @@
- priv->sock, strerror (errno));
- goto unlock;
- }
-
-- if (!priv->bio) {
-- ret = __socket_nonblock (new_sock);
--
-- if (ret == -1) {
-- gf_log (this->name, GF_LOG_WARNING,
-- "NBIO on %d failed (%s)",
-- new_sock, strerror (errno));
--
-- close (new_sock);
-- goto unlock;
-- }
-- }
--
- if (priv->nodelay) {
- ret = __socket_nodelay (new_sock);
- if (ret == -1) {
- gf_log (this->name, GF_LOG_WARNING,
-@@ -1871,9 +2186,13 @@
- goto unlock;
- }
-
- get_transport_identifiers (new_trans);
-- socket_init (new_trans);
-+ ret = socket_init (new_trans);
-+ if (ret != 0) {
-+ close(new_sock);
-+ goto unlock;
-+ }
- new_trans->ops = this->ops;
- new_trans->init = this->init;
- new_trans->fini = this->fini;
- new_trans->ctx = ctx;
-@@ -1882,22 +2201,63 @@
- new_trans->notify = this->notify;
- new_trans->listener = this;
- new_priv = new_trans->private;
-
-+ new_priv->use_ssl = priv->use_ssl;
-+ new_priv->sock = new_sock;
-+ new_priv->own_thread = priv->own_thread;
-+
-+ if (priv->use_ssl) {
-+ new_priv->ssl_ctx = priv->ssl_ctx;
-+ if (ssl_setup_connection(new_trans,1) < 0) {
-+ gf_log(this->name,GF_LOG_ERROR,
-+ "server setup failed");
-+ close(new_sock);
-+ goto unlock;
-+ }
-+ }
-+
-+ if (!priv->bio) {
-+ ret = __socket_nonblock (new_sock);
-+
-+ if (ret == -1) {
-+ gf_log (this->name, GF_LOG_WARNING,
-+ "NBIO on %d failed (%s)",
-+ new_sock, strerror (errno));
-+
-+ close (new_sock);
-+ goto unlock;
-+ }
-+ }
-+
- pthread_mutex_lock (&new_priv->lock);
- {
-- new_priv->sock = new_sock;
- new_priv->connected = 1;
- rpc_transport_ref (new_trans);
-
-- new_priv->idx =
-- event_register (ctx->event_pool,
-- new_sock,
-- socket_event_handler,
-- new_trans, 1, 0);
-+ if (new_priv->own_thread) {
-+ if (pipe(new_priv->pipe) < 0) {
-+ gf_log(this->name,GF_LOG_ERROR,
-+ "could not create pipe");
-+ }
-+ if (pthread_create(&new_priv->thread,
-+ NULL, socket_poller,
-+ new_trans) != 0) {
-+ gf_log(this->name,GF_LOG_ERROR,
-+ "could not create poll thread");
-+ }
-+ }
-+ else {
-+ new_priv->idx =
-+ event_register (ctx->event_pool,
-+ new_sock,
-+ socket_event_handler,
-+ new_trans,
-+ 1, 0);
-+ if (new_priv->idx == -1)
-+ ret = -1;
-+ }
-
-- if (new_priv->idx == -1)
-- ret = -1;
- }
- pthread_mutex_unlock (&new_priv->lock);
- if (ret == -1) {
- gf_log ("", GF_LOG_WARNING,
-@@ -1984,8 +2344,24 @@
-
- if (port > 0)
- ((struct sockaddr_in *) (&sockaddr))->sin_port = htons (port);
-
-+ if (ntohs(((struct sockaddr_in *) (&sockaddr))->sin_port) ==
-+ GF_DEFAULT_SOCKET_LISTEN_PORT) {
-+ if (priv->use_ssl) {
-+ gf_log(this->name,GF_LOG_DEBUG,
-+ "disabling SSL for portmapper connection");
-+ priv->use_ssl = _gf_false;
-+ }
-+ }
-+ else {
-+ if (priv->ssl_enabled && !priv->use_ssl) {
-+ gf_log(this->name,GF_LOG_DEBUG,
-+ "re-enabling SSL for I/O connection");
-+ priv->use_ssl = _gf_true;
-+ }
-+ }
-+
- pthread_mutex_lock (&priv->lock);
- {
- if (priv->sock != -1) {
- gf_log (this->name, GF_LOG_TRACE,
-@@ -2034,21 +2410,8 @@
- strerror (errno));
- }
- }
-
-- if (!priv->bio) {
-- ret = __socket_nonblock (priv->sock);
--
-- if (ret == -1) {
-- gf_log (this->name, GF_LOG_ERROR,
-- "NBIO on %d failed (%s)",
-- priv->sock, strerror (errno));
-- close (priv->sock);
-- priv->sock = -1;
-- goto unlock;
-- }
-- }
--
- if (priv->keepalive) {
- ret = __socket_keepalive (priv->sock,
- priv->keepaliveintvl,
- priv->keepaliveidle);
-@@ -2082,19 +2445,58 @@
- priv->sock = -1;
- goto unlock;
- }
-
-- priv->connected = 0;
-+ if (priv->use_ssl) {
-+ ret = ssl_setup_connection(this,0);
-+ if (ret < 0) {
-+ gf_log(this->name,GF_LOG_ERROR,
-+ "client setup failed");
-+ close(priv->sock);
-+ priv->sock = -1;
-+ goto unlock;
-+ }
-+ }
-+
-+ if (!priv->bio) {
-+ ret = __socket_nonblock (priv->sock);
-+
-+ if (ret == -1) {
-+ gf_log (this->name, GF_LOG_ERROR,
-+ "NBIO on %d failed (%s)",
-+ priv->sock, strerror (errno));
-+ close (priv->sock);
-+ priv->sock = -1;
-+ goto unlock;
-+ }
-+ }
-+
-+ priv->connected = 0;
-+ rpc_transport_ref (this);
-+
-+ if (priv->own_thread) {
-+ if (pipe(priv->pipe) < 0) {
-+ gf_log(this->name,GF_LOG_ERROR,
-+ "could not create pipe");
-+ }
-+
-+ if (pthread_create(&priv->thread,NULL,
-+ socket_poller, this) != 0) {
-+ gf_log(this->name,GF_LOG_ERROR,
-+ "could not create poll thread");
-+ }
-+ }
-+ else {
-+ priv->idx = event_register (ctx->event_pool, priv->sock,
-+ socket_event_handler,
-+ this, 1, 1);
-+ if (priv->idx == -1) {
-+ gf_log ("", GF_LOG_WARNING,
-+ "failed to register the event");
-+ ret = -1;
-+ }
-+ }
-
-- rpc_transport_ref (this);
--
-- priv->idx = event_register (ctx->event_pool, priv->sock,
-- socket_event_handler, this, 1, 1);
-- if (priv->idx == -1) {
-- gf_log ("", GF_LOG_WARNING,
-- "failed to register the event");
-- ret = -1;
-- }
- }
- unlock:
- pthread_mutex_unlock (&priv->lock);
-
-@@ -2258,8 +2660,9 @@
- char need_poll_out = 0;
- char need_append = 1;
- struct ioq *entry = NULL;
- glusterfs_ctx_t *ctx = NULL;
-+ char a_byte = 'j';
-
- GF_VALIDATE_OR_GOTO ("socket", this, out);
- GF_VALIDATE_OR_GOTO ("socket", this->private, out);
-
-@@ -2283,23 +2686,33 @@
- if (!entry)
- goto unlock;
-
- if (list_empty (&priv->ioq)) {
-- ret = __socket_ioq_churn_entry (this, entry);
-+ ret = __socket_ioq_churn_entry (this, entry, 1);
-
-- if (ret == 0)
-+ if (ret == 0) {
- need_append = 0;
--
-- if (ret > 0)
-+ }
-+ if (ret > 0) {
- need_poll_out = 1;
-+ }
- }
-
- if (need_append) {
- list_add_tail (&entry->list, &priv->ioq);
-+ if (priv->own_thread) {
-+ /*
-+ * Make sure the polling thread wakes up, by
-+ * writing a byte to represent this entry.
-+ */
-+ if (write(priv->pipe[1],&a_byte,1) < 1) {
-+ gf_log(this->name,GF_LOG_WARNING,
-+ "write error on pipe");
-+ }
-+ }
- ret = 0;
- }
--
-- if (need_poll_out) {
-+ if (!priv->own_thread && need_poll_out) {
- /* first entry to wait. continue writing on POLLOUT */
- priv->idx = event_select_on (ctx->event_pool,
- priv->sock,
- priv->idx, -1, 1);
-@@ -2321,8 +2734,9 @@
- char need_poll_out = 0;
- char need_append = 1;
- struct ioq *entry = NULL;
- glusterfs_ctx_t *ctx = NULL;
-+ char a_byte = 'd';
-
- GF_VALIDATE_OR_GOTO ("socket", this, out);
- GF_VALIDATE_OR_GOTO ("socket", this->private, out);
-
-@@ -2339,35 +2753,46 @@
- priv->submit_log = 1;
- }
- goto unlock;
- }
-+
- priv->submit_log = 0;
- entry = __socket_ioq_new (this, &reply->msg);
- if (!entry)
- goto unlock;
-+
- if (list_empty (&priv->ioq)) {
-- ret = __socket_ioq_churn_entry (this, entry);
-+ ret = __socket_ioq_churn_entry (this, entry, 1);
-
-- if (ret == 0)
-+ if (ret == 0) {
- need_append = 0;
--
-- if (ret > 0)
-+ }
-+ if (ret > 0) {
- need_poll_out = 1;
-+ }
- }
-
- if (need_append) {
- list_add_tail (&entry->list, &priv->ioq);
-+ if (priv->own_thread) {
-+ /*
-+ * Make sure the polling thread wakes up, by
-+ * writing a byte to represent this entry.
-+ */
-+ if (write(priv->pipe[1],&a_byte,1) < 1) {
-+ gf_log(this->name,GF_LOG_WARNING,
-+ "write error on pipe");
-+ }
-+ }
- ret = 0;
- }
--
-- if (need_poll_out) {
-+ if (!priv->own_thread && need_poll_out) {
- /* first entry to wait. continue writing on POLLOUT */
- priv->idx = event_select_on (ctx->event_pool,
- priv->sock,
- priv->idx, -1, 1);
- }
- }
--
- unlock:
- pthread_mutex_unlock (&priv->lock);
-
- out:
-@@ -2513,8 +2938,9 @@
- uint64_t windowsize = GF_DEFAULT_SOCKET_WINDOW_SIZE;
- char *optstr = NULL;
- uint32_t keepalive = 0;
- uint32_t backlog = 0;
-+ int session_id = 0;
-
- if (this->private) {
- gf_log_callingfn (this->name, GF_LOG_ERROR,
- "double init attempted");
-@@ -2627,12 +3053,131 @@
- priv->backlog = backlog;
- }
-
- priv->windowsize = (int)windowsize;
-+
-+ priv->ssl_enabled = _gf_false;
-+ if (dict_get_str(this->options,SSL_ENABLED_OPT,&optstr) == 0) {
-+ if (gf_string2boolean (optstr, &priv->ssl_enabled) != 0) {
-+ gf_log (this->name, GF_LOG_ERROR,
-+ "invalid value given for ssl-enabled boolean");
-+ }
-+ }
-+
-+ priv->ssl_own_cert = DEFAULT_CERT_PATH;
-+ if (dict_get_str(this->options,SSL_OWN_CERT_OPT,&optstr) == 0) {
-+ if (!priv->ssl_enabled) {
-+ gf_log(this->name,GF_LOG_WARNING,
-+ "%s specified without %s (ignored)",
-+ SSL_OWN_CERT_OPT, SSL_ENABLED_OPT);
-+ }
-+ priv->ssl_own_cert = optstr;
-+ }
-+ priv->ssl_own_cert = gf_strdup(priv->ssl_own_cert);
-+
-+ priv->ssl_private_key = DEFAULT_KEY_PATH;
-+ if (dict_get_str(this->options,SSL_PRIVATE_KEY_OPT,&optstr) == 0) {
-+ if (!priv->ssl_enabled) {
-+ gf_log(this->name,GF_LOG_WARNING,
-+ "%s specified without %s (ignored)",
-+ SSL_PRIVATE_KEY_OPT, SSL_ENABLED_OPT);
-+ }
-+ priv->ssl_private_key = optstr;
-+ }
-+ priv->ssl_private_key = gf_strdup(priv->ssl_private_key);
-+
-+ priv->ssl_ca_list = DEFAULT_CA_PATH;
-+ if (dict_get_str(this->options,SSL_CA_LIST_OPT,&optstr) == 0) {
-+ if (!priv->ssl_enabled) {
-+ gf_log(this->name,GF_LOG_WARNING,
-+ "%s specified without %s (ignored)",
-+ SSL_CA_LIST_OPT, SSL_ENABLED_OPT);
-+ }
-+ priv->ssl_ca_list = optstr;
-+ }
-+ priv->ssl_ca_list = gf_strdup(priv->ssl_ca_list);
-+
-+ gf_log(this->name,GF_LOG_INFO,"SSL support is %s",
-+ priv->ssl_enabled ? "ENABLED" : "NOT enabled");
-+ /*
-+ * This might get overridden temporarily in socket_connect (q.v.)
-+ * if we're using the glusterd portmapper.
-+ */
-+ priv->use_ssl = priv->ssl_enabled;
-+
-+ priv->own_thread = priv->use_ssl;
-+ if (dict_get_str(this->options,OWN_THREAD_OPT,&optstr) == 0) {
-+ if (gf_string2boolean (optstr, &priv->own_thread) != 0) {
-+ gf_log (this->name, GF_LOG_ERROR,
-+ "invalid value given for own-thread boolean");
-+ }
-+ }
-+ gf_log(this->name,GF_LOG_INFO,"using %s polling thread",
-+ priv->own_thread ? "private" : "system");
-+
-+ if (priv->use_ssl) {
-+ SSL_library_init();
-+ SSL_load_error_strings();
-+ priv->ssl_meth = (SSL_METHOD *)TLSv1_method();
-+ priv->ssl_ctx = SSL_CTX_new(priv->ssl_meth);
-+
-+ if (SSL_CTX_set_cipher_list(priv->ssl_ctx,
-+ "HIGH:-SSLv2") == 0) {
-+ gf_log(this->name,GF_LOG_ERROR,
-+ "failed to find any valid ciphers");
-+ goto err;
-+ }
-+
-+ if (!SSL_CTX_use_certificate_chain_file(priv->ssl_ctx,
-+ priv->ssl_own_cert)) {
-+ gf_log(this->name,GF_LOG_ERROR,
-+ "could not load our cert");
-+ goto err;
-+ }
-+
-+ if (!SSL_CTX_use_PrivateKey_file(priv->ssl_ctx,
-+ priv->ssl_private_key,
-+ SSL_FILETYPE_PEM)) {
-+ gf_log(this->name,GF_LOG_ERROR,
-+ "could not load private key");
-+ goto err;
-+ }
-+
-+ if (!SSL_CTX_load_verify_locations(priv->ssl_ctx,
-+ priv->ssl_ca_list,0)) {
-+ gf_log(this->name,GF_LOG_ERROR,
-+ "could not load CA list");
-+ goto err;
-+ }
-+
-+#if (OPENSSL_VERSION_NUMBER < 0x00905100L)
-+ SSL_CTX_set_verify_depth(ctx,1);
-+#endif
-+
-+ priv->ssl_session_id = ++session_id;
-+ SSL_CTX_set_session_id_context(priv->ssl_ctx,
-+ (void *)&priv->ssl_session_id,
-+ sizeof(priv->ssl_session_id));
-+
-+ SSL_CTX_set_verify(priv->ssl_ctx,SSL_VERIFY_PEER,0);
-+ }
-+
- out:
- this->private = priv;
--
- return 0;
-+
-+err:
-+ if (priv->ssl_own_cert) {
-+ GF_FREE(priv->ssl_own_cert);
-+ }
-+ if (priv->ssl_private_key) {
-+ GF_FREE(priv->ssl_private_key);
-+ }
-+ if (priv->ssl_ca_list) {
-+ GF_FREE(priv->ssl_ca_list);
-+ }
-+ GF_FREE(priv);
-+ return -1;
- }
-
-
- void
-@@ -2656,8 +3201,17 @@
- gf_log (this->name, GF_LOG_TRACE,
- "transport %p destroyed", this);
-
- pthread_mutex_destroy (&priv->lock);
-+ if (priv->ssl_private_key) {
-+ GF_FREE(priv->ssl_private_key);
-+ }
-+ if (priv->ssl_own_cert) {
-+ GF_FREE(priv->ssl_own_cert);
-+ }
-+ if (priv->ssl_ca_list) {
-+ GF_FREE(priv->ssl_ca_list);
-+ }
- GF_FREE (priv);
- }
-
- this->private = NULL;
-@@ -2731,6 +3285,21 @@
- },
- { .key = {"transport.socket.listen-backlog"},
- .type = GF_OPTION_TYPE_INT
- },
-+ { .key = {SSL_ENABLED_OPT},
-+ .type = GF_OPTION_TYPE_BOOL
-+ },
-+ { .key = {SSL_OWN_CERT_OPT},
-+ .type = GF_OPTION_TYPE_STR
-+ },
-+ { .key = {SSL_PRIVATE_KEY_OPT},
-+ .type = GF_OPTION_TYPE_STR
-+ },
-+ { .key = {SSL_CA_LIST_OPT},
-+ .type = GF_OPTION_TYPE_STR
-+ },
-+ { .key = {OWN_THREAD_OPT},
-+ .type = GF_OPTION_TYPE_BOOL
-+ },
- { .key = {NULL} }
- };
---- ./rpc/rpc-transport/socket/src/socket.h.orig 2011-11-14 14:46:00.000000000 +0100
-+++ ./rpc/rpc-transport/socket/src/socket.h 2011-12-14 20:47:10.000000000 +0100
-@@ -19,8 +19,10 @@
-
- #ifndef _SOCKET_H
- #define _SOCKET_H
-
-+#include <openssl/ssl.h>
-+#include <openssl/err.h>
-
- #ifndef _CONFIG_H
- #define _CONFIG_H
- #include "config.h"
-@@ -143,9 +145,10 @@
-
- typedef struct {
- int32_t sock;
- int32_t idx;
-- unsigned char connected; // -1 = not connected. 0 = in progress. 1 = connected
-+ // -1 = not connected. 0 = in progress. 1 = connected
-+ unsigned char connected;
- char bio;
- char connect_finish_log;
- char submit_log;
- union {
-@@ -192,8 +195,22 @@
- int keepalive;
- int keepaliveidle;
- int keepaliveintvl;
- uint32_t backlog;
-+ gf_boolean_t ssl_enabled;
-+ gf_boolean_t use_ssl;
-+ SSL_METHOD *ssl_meth;
-+ SSL_CTX *ssl_ctx;
-+ int ssl_session_id;
-+ BIO *ssl_sbio;
-+ SSL *ssl_ssl;
-+ char *ssl_own_cert;
-+ char *ssl_private_key;
-+ char *ssl_ca_list;
-+ pthread_t thread;
-+ int pipe[2];
-+ gf_boolean_t own_thread;
-+ volatile int socket_gen;
- } socket_private_t;
-
-
- #endif
diff --git a/filesystems/glusterfs/options.mk b/filesystems/glusterfs/options.mk
index ce3f4ebf817..fbae8ca595c 100644
--- a/filesystems/glusterfs/options.mk
+++ b/filesystems/glusterfs/options.mk
@@ -1,7 +1,7 @@
-# $NetBSD: options.mk,v 1.6 2011/12/09 16:57:44 manu Exp $
+# $NetBSD: options.mk,v 1.7 2012/10/19 04:15:21 manu Exp $
PKG_OPTIONS_VAR= PKG_OPTIONS.glusterfs
-PKG_SUPPORTED_OPTIONS= georeplication ssl
+PKG_SUPPORTED_OPTIONS= georeplication
.include "../../mk/bsd.options.mk"
@@ -9,18 +9,6 @@ PKG_SUPPORTED_OPTIONS= georeplication ssl
CONFIGURE_ARGS+= --enable-georeplication
PLIST_SRC+= ${PKGDIR}/PLIST.georeplication
.else
-CONFIGURE_ARGS+= --disable-georeplication
-.endif
-
-.if !empty(PKG_OPTIONS:Mssl)
-MESSAGE_SRC+= ${PKGDIR}/MESSAGE.ssl
-USE_TOOLS+= patch
-SSL_PATCH= ${FILESDIR}/ssl.patch
-OPENSSL_SYSCONFDIR?= ${PKG_SYSCONFDIR}/openssl
-CFLAGS+= -DDEFAULT_CERT_PATH=\"${OPENSSL_SYSCONFDIR}/certs/gluster.crt\"
-CFLAGS+= -DDEFAULT_KEY_PATH=\"${OPENSSL_SYSCONFDIR}/private/gluster.key\"
-CFLAGS+= -DDEFAULT_CA_PATH=\"${OPENSSL_SYSCONFDIR}/certs/gluster-ca.crt\"
-post-patch:
- ${PATCH} -d ${WRKSRC} --forward --quiet < ${SSL_PATCH}
+CONFIGURE_ARGS+= --disable-georeplication
.endif
diff --git a/filesystems/glusterfs/patches/patch-aa b/filesystems/glusterfs/patches/patch-aa
deleted file mode 100644
index 04c3bff8380..00000000000
--- a/filesystems/glusterfs/patches/patch-aa
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-aa,v 1.7 2011/09/18 01:36:06 manu Exp $
-
-The == operator is a non-standard bash extension. = should be used instead
---- xlators/mount/fuse/utils/mount_glusterfs.in.orig 2011-08-23 14:31:40.000000000 +0200
-+++ xlators/mount/fuse/utils/mount_glusterfs.in 2011-09-17 15:45:29.000000000 +0200
-@@ -164,9 +164,9 @@
- }
-
- # TODO: use getopt. This is very much darwin specific
- volfile_loc="$1";
-- while [ "$volfile_loc" == "-o" ] ; do
-+ while [ "$volfile_loc" = "-o" ] ; do
- shift ;
- shift ;
- volfile_loc="$1";
- done
diff --git a/filesystems/glusterfs/patches/patch-ab b/filesystems/glusterfs/patches/patch-ab
deleted file mode 100644
index ce6a35f2bae..00000000000
--- a/filesystems/glusterfs/patches/patch-ab
+++ /dev/null
@@ -1,51 +0,0 @@
-$NetBSD: patch-ab,v 1.7 2011/09/18 01:36:06 manu Exp $
-
-NetBSD does not have AI_ADDRCONFIG. This patch has a side effect: glusterfsd
-listens on IPv6 adresses only by default. Option transport.socket.bind-address
-in volume server-tcp must be used to listen on an IPv4 address.
-
---- rpc/rpc-lib/src/rpc-transport.h.orig 2011-08-23 14:31:38.000000000 +0200
-+++ rpc/rpc-lib/src/rpc-transport.h 2011-09-17 15:45:29.000000000 +0200
-@@ -39,8 +39,12 @@
- #ifndef MAX_IOVEC
- #define MAX_IOVEC 16
- #endif
-
-+#ifndef AI_ADDRCONFIG
-+#define AI_ADDRCONFIG 0
-+#endif /* AI_ADDRCONFIG */
-+
- /* Given the 4-byte fragment header, returns non-zero if this fragment
- * is the last fragment for the RPC record being assemebled.
- * RPC Record marking standard defines a 32 bit value as the fragment
- * header with the MSB signifying whether the fragment is the last
---- xlators/nfs/lib/src/rpc-socket.c.orig 2011-08-23 14:31:40.000000000 +0200
-+++ xlators/nfs/lib/src/rpc-socket.c 2011-09-17 15:45:29.000000000 +0200
-@@ -36,8 +36,12 @@
- #include <netdb.h>
- #include <netinet/in.h>
- #include <netinet/tcp.h>
-
-+#ifndef AI_ADDRCONFIG
-+#define AI_ADDRCONFIG 0
-+#endif /* AI_ADDRCONFIG */
-+
- static int
- nfs_rpcsvc_socket_server_get_local_socket (int addrfam, char *listenhost,
- uint16_t listenport,
- struct sockaddr *addr,
---- libglusterfs/src/common-utils.c.orig 2011-08-23 14:31:37.000000000 +0200
-+++ libglusterfs/src/common-utils.c 2011-09-17 15:45:29.000000000 +0200
-@@ -48,8 +48,12 @@
- #include "stack.h"
- #include "globals.h"
- #include "md5.h"
-
-+#ifndef AI_ADDRCONFIG
-+#define AI_ADDRCONFIG 0
-+#endif /* AI_ADDRCONFIG */
-+
- typedef int32_t (*rw_op_t)(int32_t fd, char *buf, int32_t size);
- typedef int32_t (*rwv_op_t)(int32_t fd, const struct iovec *buf, int32_t size);
-
- struct dnscache6 {
diff --git a/filesystems/glusterfs/patches/patch-ac b/filesystems/glusterfs/patches/patch-ac
deleted file mode 100644
index 9618393a07c..00000000000
--- a/filesystems/glusterfs/patches/patch-ac
+++ /dev/null
@@ -1,18 +0,0 @@
-$NetBSD: patch-ac,v 1.4 2011/09/18 01:36:06 manu Exp $
-NetBSD does not have EDOOFUS
---- libglusterfs/src/compat-errno.c.orig 2011-08-23 14:31:37.000000000 +0200
-+++ libglusterfs/src/compat-errno.c 2011-09-17 15:45:29.000000000 +0200
-@@ -857,11 +857,13 @@
- /* ENOATTR 87 / * Attribute not found */
- gf_error_to_errno_array[GF_ERROR_CODE_NOATTR] = ENOATTR;
- gf_errno_to_error_array[ENOATTR] = GF_ERROR_CODE_NOATTR;
-
-+#ifndef __NetBSD__ /* Undefined on NetBSD */
- /* EDOOFUS 88 / * Programming error */
- gf_error_to_errno_array[GF_ERROR_CODE_DOOFUS] = EDOOFUS;
- gf_errno_to_error_array[EDOOFUS] = GF_ERROR_CODE_DOOFUS;
-+#endif /* __NetBSD__ */
-
- /* EBADMSG 89 / * Bad message */
- gf_error_to_errno_array[GF_ERROR_CODE_BADMSG] = EBADMSG;
- gf_errno_to_error_array[EBADMSG] = GF_ERROR_CODE_BADMSG;
diff --git a/filesystems/glusterfs/patches/patch-ae b/filesystems/glusterfs/patches/patch-ae
deleted file mode 100644
index 480bdcfbe32..00000000000
--- a/filesystems/glusterfs/patches/patch-ae
+++ /dev/null
@@ -1,101 +0,0 @@
-$NetBSD: patch-ae,v 1.11 2011/12/09 16:57:44 manu Exp $
-
-On NetBSD use libperfuse(3), rename umount2(2) as unmount(2), and skip
-inexistant /etc/mtab management.
-
-Include <signal.h> for sigprocmask(2)
-
-Use /sbin/mount on NetBSD, not /bin/mount
-
---- contrib/fuse-lib/mount.c.orig 2011-11-14 14:45:58.000000000 +0100
-+++ contrib/fuse-lib/mount.c 2011-11-27 08:53:09.000000000 +0100
-@@ -19,16 +19,30 @@
- #include <limits.h>
- #include <fcntl.h>
- #include <errno.h>
- #include <dirent.h>
-+#include <signal.h>
-+#ifndef __NetBSD__
- #include <mntent.h>
-+#endif /* __NetBSD__ */
- #include <sys/stat.h>
- #include <sys/poll.h>
- #include <sys/socket.h>
- #include <sys/un.h>
- #include <sys/wait.h>
- #include <sys/mount.h>
-
-+#ifdef __NetBSD__
-+#include <perfuse.h>
-+#define umount2(dir, flags) unmount(dir, ((flags) != 0) ? MNT_FORCE : 0)
-+#endif
-+
-+#ifdef linux
-+#define _PATH_MOUNT "/bin/mount"
-+#else /* NetBSD, MacOS X */
-+#define _PATH_MOUNT "/sbin/mount"
-+#endif
-+
- #ifdef FUSE_UTIL
- #define MALLOC(size) malloc (size)
- #define FREE(ptr) free (ptr)
- #define GFFUSE_LOGERR(...) fprintf (stderr, ## __VA_ARGS__)
-@@ -57,8 +71,9 @@
- * - s/free/FREE/, s/malloc/MALLOC/
- * - there are some other minor things
- */
-
-+#ifndef __NetBSD__
- static int
- mtab_needs_update (const char *mnt)
- {
- int res;
-@@ -90,8 +105,11 @@
- }
-
- return 1;
- }
-+#else /* __NetBSD__ */
-+#define mtab_needs_update(x) 1
-+#endif /* __NetBSD__ */
-
- #ifndef FUSE_UTIL
- static
- #endif
-@@ -158,12 +176,12 @@
- progname, tmp, strerror (errno));
- exit (1);
- }
- rmdir (tmp);
-- execl ("/bin/mount", "/bin/mount", "-i", "-f", "-t", type,
-+ execl (_PATH_MOUNT, _PATH_MOUNT, "-i", "-f", "-t", type,
- "-o", opts, fsname, mnt, NULL);
-- GFFUSE_LOGERR ("%s: failed to execute /bin/mount: %s",
-- progname, strerror (errno));
-+ GFFUSE_LOGERR ("%s: failed to execute %s: %s",
-+ progname, _PATH_MOUNT, strerror (errno));
- exit (1);
- }
- res = waitpid (res, &status, 0);
- if (res == -1)
-@@ -562,8 +580,9 @@
- goto out;
- else
- mounted = 1;
-
-+#ifndef __NetBSD__
- if (geteuid () == 0) {
- char *newmnt = fuse_mnt_resolve_path ("fuse", mountpoint);
-
- if (!newmnt) {
-@@ -580,8 +599,9 @@
-
- goto out;
- }
- }
-+#endif /* __NetBSD__ */
-
- out:
- if (ret == -1) {
- if (mounted)
-
diff --git a/filesystems/glusterfs/patches/patch-af b/filesystems/glusterfs/patches/patch-af
deleted file mode 100644
index ab15ab02dee..00000000000
--- a/filesystems/glusterfs/patches/patch-af
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-af,v 1.7 2011/09/18 01:36:06 manu Exp $
-
-Works around "error: 'TCP_KEEPALIVE' undeclared" on NetBSD
---- rpc/rpc-transport/socket/src/socket.c.orig 2011-08-23 14:31:38.000000000 +0200
-+++ rpc/rpc-transport/socket/src/socket.c 2011-09-17 15:45:29.000000000 +0200
-@@ -397,9 +397,9 @@
-
- if (keepalive_intvl == GF_USE_DEFAULT_KEEPALIVE)
- goto done;
-
--#ifndef GF_LINUX_HOST_OS
-+#if !defined(GF_LINUX_HOST_OS) && !defined(__NetBSD__)
- #ifdef GF_SOLARIS_HOST_OS
- ret = setsockopt (fd, SOL_SOCKET, SO_KEEPALIVE, &keepalive_intvl,
- sizeof (keepalive_intvl));
- #else
diff --git a/filesystems/glusterfs/patches/patch-an b/filesystems/glusterfs/patches/patch-an
deleted file mode 100644
index ac2f9ad12e3..00000000000
--- a/filesystems/glusterfs/patches/patch-an
+++ /dev/null
@@ -1,62 +0,0 @@
-$NetBSD: patch-an,v 1.8 2011/09/18 01:36:06 manu Exp $
-
-NetBSD uses libperfuse(3). Also enable debugging (-g) for now,
-and let it build georeplication.
---- configure.ac.orig 2011-08-23 14:31:42.000000000 +0200
-+++ configure.ac 2011-09-17 15:45:29.000000000 +0200
-@@ -305,8 +305,11 @@
- case $host_os in
- linux*)
- #do nothing
- ;;
-+ netbsd*)
-+#do nothing
-+ ;;
- *)
- #disabling geo replication for non-linux platforms
- enable_georeplication=no
- ;;
-@@ -369,8 +372,13 @@
- dnl Linux, Solaris, Cygwin
- AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec])
- dnl FreeBSD, NetBSD
- AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec])
-+AC_CHECK_FUNC([linkat], [have_linkat=yes])
-+if test "x${have_linkat}" = "xyes"; then
-+ AC_DEFINE(HAVE_LINKAT, 1, [define if found linkat])
-+fi
-+AC_SUBST(HAVE_LINKAT)
-
- dnl Check for argp
- AC_CHECK_HEADER([argp.h], AC_DEFINE(HAVE_ARGP, 1, [have argp]))
- AC_CONFIG_SUBDIRS(argp-standalone)
-@@ -437,8 +445,19 @@
- GF_GLUSTERFS_LDFLAGS="-lnsl -lresolv -lsocket"
- BUILD_FUSE_CLIENT=no
- FUSE_CLIENT_SUBDIR=""
- ;;
-+ *netbsd*)
-+ GF_HOST_OS="GF_BSD_HOST_OS"
-+ GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_INCOMPLETE_XOPEN_C063"
-+ GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
-+ GF_LDADD="${ARGP_STANDALONE_LDADD}"
-+ if test "x$ac_cv_header_execinfo_h" = "xyes"; then
-+ GF_GLUSTERFS_LDFLAGS="-lexecinfo"
-+ fi
-+ GF_FUSE_LDADD="-liconv -lperfuse"
-+ BUILD_FUSE_CLIENT=no
-+ ;;
- *bsd*)
- GF_HOST_OS="GF_BSD_HOST_OS"
- GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -O0"
- GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
-@@ -473,8 +492,9 @@
- AC_SUBST(GF_GLUSTERFS_CFLAGS)
- AC_SUBST(GF_CFLAGS)
- AC_SUBST(GF_LDFLAGS)
- AC_SUBST(GF_LDADD)
-+AC_SUBST(GF_FUSE_LDADD)
- AC_SUBST(GF_FUSE_CFLAGS)
- AC_SUBST(RLLIBS)
- AC_SUBST(AM_MAKEFLAGS)
- AC_SUBST(AM_LIBTOOLFLAGS)
diff --git a/filesystems/glusterfs/patches/patch-ao b/filesystems/glusterfs/patches/patch-ao
deleted file mode 100644
index fcea9ea5cbe..00000000000
--- a/filesystems/glusterfs/patches/patch-ao
+++ /dev/null
@@ -1,180 +0,0 @@
-$NetBSD: patch-ao,v 1.8 2011/09/18 01:36:06 manu Exp $
-
-NetBSD uses libperfuse(3). Also enable debugging (-g) for now,
-and let it build georeplication
---- configure.orig 2011-08-23 14:31:48.000000000 +0200
-+++ configure 2011-09-17 15:48:02.000000000 +0200
-@@ -464,9 +464,9 @@
- # include <unistd.h>
- #endif"
-
- ac_subdirs_all="$ac_subdirs_all argp-standalone"
--ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL mountutildir initdir launchddir LEX LEXLIB LEX_OUTPUT_ROOT YACC LD ac_ct_LD HAVE_SPINLOCK HAVE_STRNLEN FUSE_CLIENT_SUBDIR FUSERMOUNT_SUBDIR IBVERBS_SUBDIR RDMA_SUBDIR PYTHON PYTHON_VERSION PYTHON_PREFIX PYTHON_EXEC_PREFIX PYTHON_PLATFORM pythondir pkgpythondir pyexecdir pkgpyexecdir SYNCDAEMON_COMPILE SYNCDAEMON_SUBDIR PKG_CONFIG ac_pt_PKG_CONFIG LIBXML2_CFLAGS LIBXML2_LIBS HAVE_BACKTRACE HAVE_MALLOC_STATS subdirs ARGP_STANDALONE_CPPFLAGS ARGP_STANDALONE_LDADD GF_DISTRIBUTION GF_HOST_OS GF_GLUSTERFS_LDFLAGS GF_GLUSTERFS_CFLAGS GF_CFLAGS GF_LDFLAGS GF_LDADD GF_FUSE_CFLAGS RLLIBS AM_MAKEFLAGS AM_LIBTOOLFLAGS CONTRIBDIR INCLUDES GF_DARWIN_HOST_OS_TRUE GF_DARWIN_HOST_OS_FALSE LIBOBJS LTLIBOBJS'
-+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL mountutildir initdir launchddir LEX LEXLIB LEX_OUTPUT_ROOT YACC LD ac_ct_LD HAVE_SPINLOCK HAVE_STRNLEN FUSE_CLIENT_SUBDIR FUSERMOUNT_SUBDIR IBVERBS_SUBDIR RDMA_SUBDIR PYTHON PYTHON_VERSION PYTHON_PREFIX PYTHON_EXEC_PREFIX PYTHON_PLATFORM pythondir pkgpythondir pyexecdir pkgpyexecdir SYNCDAEMON_COMPILE SYNCDAEMON_SUBDIR PKG_CONFIG ac_pt_PKG_CONFIG LIBXML2_CFLAGS LIBXML2_LIBS HAVE_BACKTRACE HAVE_MALLOC_STATS subdirs ARGP_STANDALONE_CPPFLAGS ARGP_STANDALONE_LDADD GF_DISTRIBUTION GF_HOST_OS GF_GLUSTERFS_LDFLAGS GF_GLUSTERFS_CFLAGS GF_CFLAGS GF_LDFLAGS GF_LDADD GF_FUSE_LDADD GF_FUSE_CFLAGS RLLIBS AM_MAKEFLAGS AM_LIBTOOLFLAGS CONTRIBDIR INCLUDES GF_DARWIN_HOST_OS_TRUE GF_DARWIN_HOST_OS_FALSE LIBOBJS LTLIBOBJS'
- ac_subst_files=''
-
- # Initialize some variables set by options.
- ac_init_help=
-@@ -20385,8 +20385,11 @@
- case $host_os in
- linux*)
- #do nothing
- ;;
-+ netbsd*)
-+#do nothing
-+ ;;
- *)
- #disabling geo replication for non-linux platforms
- enable_georeplication=no
- ;;
-@@ -21124,8 +21127,110 @@
-
- fi
-
-
-+echo "$as_me:$LINENO: checking for linkat" >&5
-+echo $ECHO_N "checking for linkat... $ECHO_C" >&6
-+if test "${ac_cv_func_linkat+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+/* Define linkat to an innocuous variant, in case <limits.h> declares linkat.
-+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
-+#define linkat innocuous_linkat
-+
-+/* System header to define __stub macros and hopefully few prototypes,
-+ which can conflict with char linkat (); below.
-+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-+ <limits.h> exists even on freestanding compilers. */
-+
-+#ifdef __STDC__
-+# include <limits.h>
-+#else
-+# include <assert.h>
-+#endif
-+
-+#undef linkat
-+
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+{
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char linkat ();
-+/* The GNU C library defines this for functions which it implements
-+ to always fail with ENOSYS. Some functions are actually named
-+ something starting with __ and the normal name is an alias. */
-+#if defined (__stub_linkat) || defined (__stub___linkat)
-+choke me
-+#else
-+char (*f) () = linkat;
-+#endif
-+#ifdef __cplusplus
-+}
-+#endif
-+
-+int
-+main ()
-+{
-+return f != linkat;
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag"
-+ || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_func_linkat=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_func_linkat=no
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_func_linkat" >&5
-+echo "${ECHO_T}$ac_cv_func_linkat" >&6
-+if test $ac_cv_func_linkat = yes; then
-+ have_linkat=yes
-+fi
-+
-+if test "x${have_linkat}" = "xyes"; then
-+
-+cat >>confdefs.h <<\_ACEOF
-+#define HAVE_LINKAT 1
-+_ACEOF
-+
-+fi
-+
- echo "$as_me:$LINENO: checking for struct stat.st_atim.tv_nsec" >&5
- echo $ECHO_N "checking for struct stat.st_atim.tv_nsec... $ECHO_C" >&6
- if test "${ac_cv_member_struct_stat_st_atim_tv_nsec+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-@@ -21948,8 +22053,19 @@
- GF_GLUSTERFS_LDFLAGS="-lnsl -lresolv -lsocket"
- BUILD_FUSE_CLIENT=no
- FUSE_CLIENT_SUBDIR=""
- ;;
-+ *netbsd*)
-+ GF_HOST_OS="GF_BSD_HOST_OS"
-+ GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_INCOMPLETE_XOPEN_C063"
-+ GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
-+ GF_LDADD="${ARGP_STANDALONE_LDADD}"
-+ if test "x$ac_cv_header_execinfo_h" = "xyes"; then
-+ GF_GLUSTERFS_LDFLAGS="-lexecinfo"
-+ fi
-+ GF_FUSE_LDADD="-liconv -lperfuse"
-+ BUILD_FUSE_CLIENT=no
-+ ;;
- *bsd*)
- GF_HOST_OS="GF_BSD_HOST_OS"
- GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -O0"
- GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
-@@ -23067,8 +23183,9 @@
- s,@LIBXML2_CFLAGS@,$LIBXML2_CFLAGS,;t t
- s,@LIBXML2_LIBS@,$LIBXML2_LIBS,;t t
- s,@HAVE_BACKTRACE@,$HAVE_BACKTRACE,;t t
- s,@HAVE_MALLOC_STATS@,$HAVE_MALLOC_STATS,;t t
-+s,@HAVE_LINKAT@,$HAVE_LINKAT,;t t
- s,@subdirs@,$subdirs,;t t
- s,@ARGP_STANDALONE_CPPFLAGS@,$ARGP_STANDALONE_CPPFLAGS,;t t
- s,@ARGP_STANDALONE_LDADD@,$ARGP_STANDALONE_LDADD,;t t
- s,@GF_DISTRIBUTION@,$GF_DISTRIBUTION,;t t
-@@ -23077,8 +23194,9 @@
- s,@GF_GLUSTERFS_CFLAGS@,$GF_GLUSTERFS_CFLAGS,;t t
- s,@GF_CFLAGS@,$GF_CFLAGS,;t t
- s,@GF_LDFLAGS@,$GF_LDFLAGS,;t t
- s,@GF_LDADD@,$GF_LDADD,;t t
-+s,@GF_FUSE_LDADD@,$GF_FUSE_LDADD,;t t
- s,@GF_FUSE_CFLAGS@,$GF_FUSE_CFLAGS,;t t
- s,@RLLIBS@,$RLLIBS,;t t
- s,@AM_MAKEFLAGS@,$AM_MAKEFLAGS,;t t
- s,@AM_LIBTOOLFLAGS@,$AM_LIBTOOLFLAGS,;t t
diff --git a/filesystems/glusterfs/patches/patch-ar b/filesystems/glusterfs/patches/patch-ar
deleted file mode 100644
index 59131ddca0a..00000000000
--- a/filesystems/glusterfs/patches/patch-ar
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-ar,v 1.7 2011/09/18 01:36:06 manu Exp $
-
-Add @GF_FUSE_LDADD@ to fuse.so library dependecies so that -lperfuse is
-added at configure time for NetBSD.
---- xlators/mount/fuse/src/Makefile.am.orig 2011-08-23 14:31:40.000000000 +0200
-+++ xlators/mount/fuse/src/Makefile.am 2011-09-17 15:45:29.000000000 +0200
-@@ -15,8 +15,9 @@
- fuse_la_SOURCES = fuse-helpers.c fuse-resolve.c fuse-bridge.c \
- $(CONTRIBDIR)/fuse-lib/misc.c $(mount_source)
-
- fuse_la_LDFLAGS = -module -avoidversion -shared -nostartfiles
-+fuse_la_LIBADD = @GF_FUSE_LDADD@
-
- AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS) -Wall \
- -I$(top_srcdir)/libglusterfs/src -I$(CONTRIBDIR)/fuse-include \
- $(GF_CFLAGS) $(GF_FUSE_CFLAGS)
diff --git a/filesystems/glusterfs/patches/patch-as b/filesystems/glusterfs/patches/patch-as
deleted file mode 100644
index f2bb8e47458..00000000000
--- a/filesystems/glusterfs/patches/patch-as
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD: patch-as,v 1.7 2011/09/18 01:36:06 manu Exp $
-
-Add @GF_FUSE_LDADD@ to fuse.so library dependecies so that -lperfuse is
-added at configure time for NetBSD.
---- xlators/mount/fuse/src/Makefile.in.orig 2011-08-23 14:31:57.000000000 +0200
-+++ xlators/mount/fuse/src/Makefile.in 2011-09-17 15:45:29.000000000 +0200
-@@ -55,9 +55,9 @@
- am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
- am__installdirs = "$(DESTDIR)$(xlatordir)"
- xlatorLTLIBRARIES_INSTALL = $(INSTALL)
- LTLIBRARIES = $(xlator_LTLIBRARIES)
--fuse_la_LIBADD =
-+fuse_la_LIBADD = @GF_FUSE_LDADD@
- am__fuse_la_SOURCES_DIST = fuse-helpers.c fuse-resolve.c fuse-bridge.c \
- $(CONTRIBDIR)/fuse-lib/misc.c $(CONTRIBDIR)/fuse-lib/mount.c \
- $(CONTRIBDIR)/macfuse/mount_darwin.c
- @GF_DARWIN_HOST_OS_FALSE@am__objects_1 = mount.lo
diff --git a/filesystems/glusterfs/patches/patch-ax b/filesystems/glusterfs/patches/patch-ax
deleted file mode 100644
index c9f47094132..00000000000
--- a/filesystems/glusterfs/patches/patch-ax
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-ax,v 1.6 2011/09/18 01:36:06 manu Exp $
-
-Do not strip binaries so that we have debug for now.
---- install-sh.orig 2011-08-23 14:31:51.000000000 +0200
-+++ install-sh 2011-09-17 15:45:29.000000000 +0200
-@@ -120,9 +120,9 @@
- shift
- shift
- continue;;
-
-- -s) stripcmd=$stripprog
-+ -s) #stripcmd=$stripprog
- shift
- continue;;
-
- -t) dstarg=$2
diff --git a/filesystems/glusterfs/patches/patch-bb b/filesystems/glusterfs/patches/patch-bb
deleted file mode 100644
index a2f837a4577..00000000000
--- a/filesystems/glusterfs/patches/patch-bb
+++ /dev/null
@@ -1,60 +0,0 @@
-$NetBSD: patch-bb,v 1.9 2011/10/02 01:11:47 manu Exp $
-
-O_DIRECTORY is defined as 0, therefore ((flags & O_DIRECTORY) == O_DIRECTORY)
-is always true even if the flag is not set.
-
---- xlators/performance/quick-read/src/quick-read.c.orig 2011-08-23 14:31:41.000000000 +0200
-+++ xlators/performance/quick-read/src/quick-read.c 2011-10-02 02:55:29.000000000 +0200
-@@ -82,8 +82,9 @@
- qr_loc_fill (loc_t *loc, inode_t *inode, char *path)
- {
- int32_t ret = -1;
- char *parent = NULL;
-+ char *path_copy = NULL;
-
- GF_VALIDATE_OR_GOTO_WITH_ERROR ("quick-read", loc, out, errno, EINVAL);
- GF_VALIDATE_OR_GOTO_WITH_ERROR ("quick-read", inode, out, errno,
- EINVAL);
-@@ -94,15 +95,15 @@
- loc->inode = inode_ref (inode);
- loc->path = gf_strdup (path);
- loc->ino = inode->ino;
-
-- parent = gf_strdup (path);
-- if (parent == NULL) {
-+ path_copy = gf_strdup (path);
-+ if (path_copy == NULL) {
- ret = -1;
- goto out;
- }
-
-- parent = dirname (parent);
-+ parent = dirname (path_copy);
-
- loc->parent = inode_from_path (inode->table, parent);
- if (loc->parent == NULL) {
- ret = -1;
-@@ -118,10 +119,10 @@
- if (ret == -1) {
- qr_loc_wipe (loc);
- }
-
-- if (parent) {
-- GF_FREE (parent);
-+ if (path_copy) {
-+ GF_FREE (path_copy);
- }
-
- return ret;
- }
-@@ -729,9 +730,9 @@
- }
- }
- UNLOCK (&table->lock);
-
-- if (content_cached && ((flags & O_DIRECTORY) == O_DIRECTORY)) {
-+ if (content_cached && (flags & O_DIRECTORY)) {
- op_ret = -1;
- op_errno = ENOTDIR;
- gf_log (this->name, GF_LOG_WARNING,
- "open with O_DIRECTORY flag received on non-directory");
diff --git a/filesystems/glusterfs/patches/patch-be b/filesystems/glusterfs/patches/patch-be
deleted file mode 100644
index 913657a853b..00000000000
--- a/filesystems/glusterfs/patches/patch-be
+++ /dev/null
@@ -1,421 +0,0 @@
-$NetBSD: patch-be,v 1.8 2011/12/09 16:57:44 manu Exp $
-
-basename() and dirname() are not supposed to be thread-safe, and NetBSD's
-implementation is not. glusterfs assume the functions are thread-safe.
-Borrow basename() and rdirname() form glibc and make NetBSD use them.
-
---- libglusterfs/src/compat.c.orig 2011-11-27 07:55:13.000000000 +0100
-+++ libglusterfs/src/compat.c 2011-11-27 07:55:13.000000000 +0100
-@@ -550,8 +550,412 @@
-
-
- #endif /* GF_SOLARIS_HOST_OS */
-
-+#ifdef __NetBSD__
-+/*
-+ * basename() and dirname() are not supposed to be thread-safe.
-+ * SUSv2 states it can return a static pointer, and NetBSD does that.
-+ * glusterfs heavily assume basename() and dirname() thread-safety,
-+ * hence these replacement from glibc.
-+ * compat.h defines basename() and dirname() as macro so that
-+ * the replacement are used.
-+ */
-+
-+/*
-+ * borrowed from glibc-2.12.1/string/basename.c (GPL 2.1 or later)
-+ * Copyright (C) 1996,97,98,2002 Free Software Foundation, Inc.
-+ * Modified to return "." for NULL or "", as required for SUSv2.
-+ */
-+char *
-+basename_r (filename)
-+ const char *filename;
-+{
-+ char *p;
-+
-+ if ((filename == NULL) || (*filename == '\0'))
-+ return ".";
-+
-+ p = strrchr (filename, '/');
-+ return p ? p + 1 : (char *) filename;
-+}
-+
-+/*
-+ * Borrowed from blibc-2.12.1/string/memrchr.c (GPL 2.1 or later)
-+ * Copyright (C) 1991, 93, 96, 97, 99, 2000 Free Software Foundation, Inc.
-+ * Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
-+ * Removed code for long bigger than 32 bytes, renamed __ptr_t as void *
-+ * changed reg_char type to char.
-+ */
-+void *
-+__memrchr (s, c_in, n)
-+ const void * s;
-+ int c_in;
-+ size_t n;
-+{
-+ const unsigned char *char_ptr;
-+ const unsigned long int *longword_ptr;
-+ unsigned long int longword, magic_bits, charmask;
-+ unsigned char c;
-+
-+ c = (unsigned char) c_in;
-+
-+ /* Handle the last few characters by reading one character at a time.
-+ Do this until CHAR_PTR is aligned on a longword boundary. */
-+ for (char_ptr = (const unsigned char *) s + n;
-+ n > 0 && ((unsigned long int) char_ptr
-+ & (sizeof (longword) - 1)) != 0;
-+ --n)
-+ if (*--char_ptr == c)
-+ return (void *) char_ptr;
-+
-+ /* All these elucidatory comments refer to 4-byte longwords,
-+ but the theory applies equally well to 8-byte longwords. */
-+
-+ longword_ptr = (const unsigned long int *) char_ptr;
-+
-+ /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
-+ the "holes." Note that there is a hole just to the left of
-+ each byte, with an extra at the end:
-+
-+ bits: 01111110 11111110 11111110 11111111
-+ bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
-+
-+ The 1-bits make sure that carries propagate to the next 0-bit.
-+ The 0-bits provide holes for carries to fall into. */
-+
-+ if (sizeof (longword) != 4 && sizeof (longword) != 8)
-+ abort ();
-+
-+ magic_bits = 0x7efefeff;
-+
-+ /* Set up a longword, each of whose bytes is C. */
-+ charmask = c | (c << 8);
-+ charmask |= charmask << 16;
-+
-+ /* Instead of the traditional loop which tests each character,
-+ we will test a longword at a time. The tricky part is testing
-+ if *any of the four* bytes in the longword in question are zero. */
-+ while (n >= sizeof (longword))
-+ {
-+ /* We tentatively exit the loop if adding MAGIC_BITS to
-+ LONGWORD fails to change any of the hole bits of LONGWORD.
-+
-+ 1) Is this safe? Will it catch all the zero bytes?
-+ Suppose there is a byte with all zeros. Any carry bits
-+ propagating from its left will fall into the hole at its
-+ least significant bit and stop. Since there will be no
-+ carry from its most significant bit, the LSB of the
-+ byte to the left will be unchanged, and the zero will be
-+ detected.
-+
-+ 2) Is this worthwhile? Will it ignore everything except
-+ zero bytes? Suppose every byte of LONGWORD has a bit set
-+ somewhere. There will be a carry into bit 8. If bit 8
-+ is set, this will carry into bit 16. If bit 8 is clear,
-+ one of bits 9-15 must be set, so there will be a carry
-+ into bit 16. Similarly, there will be a carry into bit
-+ 24. If one of bits 24-30 is set, there will be a carry
-+ into bit 31, so all of the hole bits will be changed.
-+
-+ The one misfire occurs when bits 24-30 are clear and bit
-+ 31 is set; in this case, the hole at bit 31 is not
-+ changed. If we had access to the processor carry flag,
-+ we could close this loophole by putting the fourth hole
-+ at bit 32!
-+
-+ So it ignores everything except 128's, when they're aligned
-+ properly.
-+
-+ 3) But wait! Aren't we looking for C, not zero?
-+ Good point. So what we do is XOR LONGWORD with a longword,
-+ each of whose bytes is C. This turns each byte that is C
-+ into a zero. */
-+
-+ longword = *--longword_ptr ^ charmask;
-+
-+ /* Add MAGIC_BITS to LONGWORD. */
-+ if ((((longword + magic_bits)
-+
-+ /* Set those bits that were unchanged by the addition. */
-+ ^ ~longword)
-+
-+ /* Look at only the hole bits. If any of the hole bits
-+ are unchanged, most likely one of the bytes was a
-+ zero. */
-+ & ~magic_bits) != 0)
-+ {
-+ /* Which of the bytes was C? If none of them were, it was
-+ a misfire; continue the search. */
-+
-+ const unsigned char *cp = (const unsigned char *) longword_ptr;
-+
-+ if (cp[3] == c)
-+ return (void *) &cp[3];
-+ if (cp[2] == c)
-+ return (void *) &cp[2];
-+ if (cp[1] == c)
-+ return (void *) &cp[1];
-+ if (cp[0] == c)
-+ return (void *) cp;
-+ }
-+
-+ n -= sizeof (longword);
-+ }
-+
-+ char_ptr = (const unsigned char *) longword_ptr;
-+
-+ while (n-- > 0)
-+ {
-+ if (*--char_ptr == c)
-+ return (void *) char_ptr;
-+ }
-+
-+ return 0;
-+}
-+
-+/*
-+ * Borrowed from glibc-2.12.1/misc/dirname.c (GPL 2.1 or later)
-+ * Copyright (C) 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
-+ * Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-+ */
-+char *
-+dirname_r (char *path)
-+{
-+ static const char dot[] = ".";
-+ char *last_slash;
-+
-+ /* Find last '/'. */
-+ last_slash = path != NULL ? strrchr (path, '/') : NULL;
-+
-+ if (last_slash != NULL && last_slash != path && last_slash[1] == '\0')
-+ {
-+ /* Determine whether all remaining characters are slashes. */
-+ char *runp;
-+
-+ for (runp = last_slash; runp != path; --runp)
-+ if (runp[-1] != '/')
-+ break;
-+
-+ /* The '/' is the last character, we have to look further. */
-+ if (runp != path)
-+ last_slash = __memrchr (path, '/', runp - path);
-+ }
-+
-+ if (last_slash != NULL)
-+ {
-+ /* Determine whether all remaining characters are slashes. */
-+ char *runp;
-+
-+ for (runp = last_slash; runp != path; --runp)
-+ if (runp[-1] != '/')
-+ break;
-+
-+ /* Terminate the path. */
-+ if (runp == path)
-+ {
-+ /* The last slash is the first character in the string. We have to
-+ return "/". As a special case we have to return "//" if there
-+ are exactly two slashes at the beginning of the string. See
-+ XBD 4.10 Path Name Resolution for more information. */
-+ if (last_slash == path + 1)
-+ ++last_slash;
-+ else
-+ last_slash = path + 1;
-+ }
-+ else
-+ last_slash = runp;
-+
-+ last_slash[0] = '\0';
-+ }
-+ else
-+ /* This assignment is ill-designed but the XPG specs require to
-+ return a string containing "." in any case no directory part is
-+ found and so a static and constant string is required. */
-+ path = (char *) dot;
-+
-+ return path;
-+}
-+#ifndef HAVE_SYS_XATTR_H
-+
-+#define MATCH_NS(ns, key) (strncmp(ns, key, sizeof(ns) - 1) == 0)
-+static int
-+xattr_native_ns(const char *key) {
-+ if (MATCH_NS("system.", key))
-+ return EXTATTR_NAMESPACE_SYSTEM;
-+ else if (MATCH_NS("user.", key))
-+ return EXTATTR_NAMESPACE_USER;
-+ else if (MATCH_NS("security.", key))
-+ return EXTATTR_NAMESPACE_SYSTEM;
-+ else if (MATCH_NS("trusted.", key))
-+ return EXTATTR_NAMESPACE_SYSTEM;
-+ else
-+ return EXTATTR_NAMESPACE_USER;
-+
-+}
-+#undef MATCH_NS
-+
-+static void
-+xattr_native_list(char *data, ssize_t len) {
-+ int i;
-+ size_t attrlen;
-+
-+ for (i = 0; i < len; i += attrlen + 1) {
-+ attrlen = (size_t)data[i];
-+ memmove(data + i, data + i + 1, attrlen);
-+ data[i + attrlen] = 0;
-+ }
-+
-+ return;
-+}
-+
-+int
-+removexattr(const char *path, const char *key)
-+{
-+ return extattr_delete_file(path, xattr_native_ns(key), key);
-+}
-+
-+ssize_t
-+listxattr(const char *path, void *value, size_t size)
-+{
-+ ssize_t syslen;
-+ ssize_t usrlen;
-+
-+ usrlen = extattr_list_file(path, EXTATTR_NAMESPACE_USER, value, size);
-+ if (usrlen == -1)
-+ return -1;
-+
-+ if (value != NULL) {
-+ xattr_native_list(value, usrlen);
-+ value += usrlen;
-+ size -= usrlen;
-+ }
-+
-+ syslen = extattr_list_file(path, EXTATTR_NAMESPACE_SYSTEM, value, size);
-+ if (usrlen == -1)
-+ return usrlen;
-+
-+ if (value != NULL)
-+ xattr_native_list(value, syslen);
-+
-+ return usrlen + syslen;
-+}
-+
-+ssize_t
-+getxattr(const char *path, const char *key, void *value, size_t size)
-+{
-+ return extattr_get_file(path, xattr_native_ns(key), key, value, size);
-+}
-+
-+int
-+setxattr(const char *path, const char *key, const void *value, size_t size)
-+{
-+ ssize_t ret;
-+
-+ ret = extattr_set_file(path, xattr_native_ns(key), key, value, size);
-+
-+ return (ret == -1) ? -1 : 0;
-+}
-+
-+int
-+fremovexattr(int fd, const char *key)
-+{
-+ return extattr_delete_fd(fd, xattr_native_ns(key), key);
-+}
-+
-+ssize_t
-+flistxattr(int fd, void *value, size_t size)
-+{
-+ ssize_t syslen;
-+ ssize_t usrlen;
-+
-+ usrlen = extattr_list_fd(fd, EXTATTR_NAMESPACE_USER, value, size);
-+ if (usrlen == -1)
-+ return -1;
-+
-+ if (value != NULL) {
-+ xattr_native_list(value, usrlen);
-+ value += usrlen;
-+ size -= usrlen;
-+ }
-+
-+ syslen = extattr_list_fd(fd, EXTATTR_NAMESPACE_SYSTEM, value, size);
-+ if (usrlen == -1)
-+ return usrlen;
-+
-+ if (value != NULL)
-+ xattr_native_list(value, syslen);
-+
-+ return usrlen + syslen;
-+}
-+
-+ssize_t
-+fgetxattr(int fd, const char *key, void *value, size_t size)
-+{
-+ return extattr_get_fd(fd, xattr_native_ns(key), key, value, size);
-+}
-+
-+int
-+fsetxattr(int fd, const char *key, const void *value, size_t size)
-+{
-+ ssize_t ret;
-+
-+ ret = extattr_set_fd(fd, xattr_native_ns(key), key, value, size);
-+
-+ return (ret == -1) ? -1 : 0;
-+}
-+
-+int
-+lremovexattr(const char *path, const char *key)
-+{
-+ return extattr_delete_link(path, xattr_native_ns(key), key);
-+}
-+
-+ssize_t
-+llistxattr(const char *path, void *value, size_t size)
-+{
-+ ssize_t syslen;
-+ ssize_t usrlen;
-+
-+ usrlen = extattr_list_link(path, EXTATTR_NAMESPACE_USER, value, size);
-+ if (usrlen == -1)
-+ return -1;
-+
-+ if (value != NULL) {
-+ xattr_native_list(value, usrlen);
-+ value += usrlen;
-+ size -= usrlen;
-+ }
-+
-+ syslen = extattr_list_link(path, EXTATTR_NAMESPACE_SYSTEM, value, size);
-+ if (usrlen == -1)
-+ return usrlen;
-+
-+ if (value != NULL)
-+ xattr_native_list(value, syslen);
-+
-+ return usrlen + syslen;
-+}
-+
-+ssize_t
-+lgetxattr(const char *path, const char *key, void *value, size_t size)
-+{
-+ return extattr_get_link(path, xattr_native_ns(key), key, value, size);
-+}
-+
-+int
-+lsetxattr(const char *path, const char *key, const void *value, size_t size)
-+{
-+ ssize_t ret;
-+
-+ ret = extattr_set_link(path, xattr_native_ns(key), key, value, size);
-+
-+ return (ret == -1) ? -1 : 0;
-+}
-+
-+#endif /* HAVE_SYS_XATTR_H */
-+#endif /* __NetBSD__ */
-+
- #ifndef HAVE_STRNLEN
- size_t
- strnlen(const char *string, size_t maxlen)
- {
diff --git a/filesystems/glusterfs/patches/patch-bf b/filesystems/glusterfs/patches/patch-bf
deleted file mode 100644
index a498cffc802..00000000000
--- a/filesystems/glusterfs/patches/patch-bf
+++ /dev/null
@@ -1,57 +0,0 @@
-$NetBSD: patch-bf,v 1.7 2011/09/18 01:36:06 manu Exp $
-
-basename() and dirname() are not supposed to be thread-safe, and NetBSD's
-implementation is not. glusterfs assume the functions are thread-safe.
-Borrow basename() and rdirname() form glibc and make NetBSD use them.
-
---- libglusterfs/src/compat.h.orig 2011-08-23 14:31:37.000000000 +0200
-+++ libglusterfs/src/compat.h 2011-09-17 15:45:29.000000000 +0200
-@@ -57,26 +57,31 @@
- #endif /* HAVE_LLISTXATTR */
- #endif /* GF_LINUX_HOST_OS */
-
- #ifdef GF_BSD_HOST_OS
--/* In case of FreeBSD */
-+/* In case of FreeBSD and NetBSD */
-
- #define UNIX_PATH_MAX 104
- #include <sys/types.h>
-
- #include <sys/un.h>
- #include <sys/endian.h>
- #include <sys/extattr.h>
-+#ifdef HAVE_SYS_XATTR_H
-+#include <sys/xattr.h>
-+#endif /* HAVE_SYS_XATTR_H */
- #include <limits.h>
-
- #include <libgen.h>
-
-+#ifndef XATTR_CREATE
- enum {
- ATTR_CREATE = 1,
- #define XATTR_CREATE ATTR_CREATE
- ATTR_REPLACE = 2
- #define XATTR_REPLACE ATTR_REPLACE
- };
-+#endif /* XATTR_CREATE */
-
-
- #ifndef sighandler_t
- #define sighandler_t sig_t
-@@ -110,8 +115,15 @@
- #define F_GETLK64 F_GETLK
- #define F_SETLK64 F_SETLK
- #define F_SETLKW64 F_SETLKW
-
-+#ifdef __NetBSD__
-+char *basename_r(const char *);
-+char *dirname_r(char *);
-+
-+#define basename(path) basename_r(path)
-+#define dirname(path) dirname_r(path)
-+#endif /* __NetBSD__ */
- #endif /* GF_BSD_HOST_OS */
-
- #ifdef GF_DARWIN_HOST_OS
-
diff --git a/filesystems/glusterfs/patches/patch-bh b/filesystems/glusterfs/patches/patch-bh
deleted file mode 100644
index 2aa9f38f5f3..00000000000
--- a/filesystems/glusterfs/patches/patch-bh
+++ /dev/null
@@ -1,39 +0,0 @@
-$NetBSD: patch-bh,v 1.6 2011/09/18 01:36:06 manu Exp $
-
-NetBSD's <dirent.h> does a #defiine d_ino d_fileno. Since glusterfs
-declares structs with d_ino members, we must include <dirent.h> early
-so that d_ino get preprocessed into d_fileno conssitently.
-
-Also define proper xdr types for NetBSD.
---- rpc/rpc-lib/src/xdr-common.h.orig 2011-08-23 14:31:38.000000000 +0200
-+++ rpc/rpc-lib/src/xdr-common.h 2011-09-17 15:45:29.000000000 +0200
-@@ -29,8 +29,13 @@
- #include <sys/types.h>
- #include <rpc/xdr.h>
- #include <sys/uio.h>
-
-+#ifdef __NetBSD__
-+#include <dirent.h>
-+#endif /* __NetBSD__ */
-+
-+
- enum gf_dump_procnum {
- GF_DUMP_NULL,
- GF_DUMP_DUMP,
- GF_DUMP_MAXVALUE,
-@@ -46,8 +51,15 @@
- #define xdr_uint32_t xdr_u_int32_t
- #define uint64_t u_int64_t
- #endif
-
-+#if defined(__NetBSD__)
-+#define xdr_u_quad_t xdr_u_int64_t
-+#define xdr_quad_t xdr_int64_t
-+#define xdr_uint32_t xdr_u_int32_t
-+#endif
-+
-+
- #if GF_SOLARIS_HOST_OS
- #define u_quad_t uint64_t
- #define quad_t int64_t
- #define xdr_u_quad_t xdr_uint64_t
diff --git a/filesystems/glusterfs/patches/patch-bj b/filesystems/glusterfs/patches/patch-bj
deleted file mode 100644
index 9e799b8a547..00000000000
--- a/filesystems/glusterfs/patches/patch-bj
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-bj,v 1.6 2011/09/18 01:36:06 manu Exp $
-Make sure NetBSD pulls proper FUSE header
---- xlators/mount/fuse/src/fuse-bridge.h.orig 2011-08-23 14:31:40.000000000 +0200
-+++ xlators/mount/fuse/src/fuse-bridge.h 2011-09-17 15:45:29.000000000 +0200
-@@ -54,9 +54,9 @@
-
- #include "list.h"
- #include "dict.h"
-
--#ifdef GF_LINUX_HOST_OS
-+#if defined(GF_LINUX_HOST_OS) || defined(__NetBSD__)
- #define FUSE_OP_HIGH (FUSE_POLL + 1)
- #endif
- #ifdef GF_DARWIN_HOST_OS
- #define FUSE_OP_HIGH (FUSE_DESTROY + 1)
diff --git a/filesystems/glusterfs/patches/patch-bk b/filesystems/glusterfs/patches/patch-bk
deleted file mode 100644
index 1f973ba9790..00000000000
--- a/filesystems/glusterfs/patches/patch-bk
+++ /dev/null
@@ -1,171 +0,0 @@
-$NetBSD: patch-bk,v 1.6 2011/09/18 01:36:06 manu Exp $
-
-Add missing xdr_sizeof() in NetBSD. Stollen from
-http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/xdr/xdr_sizeof.c?rev=1.1
---- rpc/rpc-lib/src/xdr-sizeof.c.orig 2011-09-17 15:45:29.000000000 +0200
-+++ rpc/rpc-lib/src/xdr-sizeof.c 2011-09-17 15:45:29.000000000 +0200
-@@ -0,0 +1,164 @@
-+#ifdef __NetBSD__
-+/*
-+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
-+ * unrestricted use provided that this legend is included on all tape
-+ * media and as a part of the software program in whole or part. Users
-+ * may copy or modify Sun RPC without charge, but are not authorized
-+ * to license or distribute it to anyone else except as part of a product or
-+ * program developed by the user.
-+ *
-+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
-+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
-+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
-+ *
-+ * Sun RPC is provided with no support and without any obligation on the
-+ * part of Sun Microsystems, Inc. to assist in its use, correction,
-+ * modification or enhancement.
-+ *
-+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
-+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
-+ * OR ANY PART THEREOF.
-+ *
-+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
-+ * or profits or other special, indirect and consequential damages, even if
-+ * Sun has been advised of the possibility of such damages.
-+ *
-+ * Sun Microsystems, Inc.
-+ * 2550 Garcia Avenue
-+ * Mountain View, California 94043
-+ */
-+/*
-+ * xdr_sizeof.c
-+ *
-+ * Copyright 1990 Sun Microsystems, Inc.
-+ *
-+ * General purpose routine to see how much space something will use
-+ * when serialized using XDR.
-+ */
-+
-+#include <sys/cdefs.h>
-+/* __FBSDID("$FreeBSD: src/sys/xdr/xdr_sizeof.c,v 1.1 2008/03/26 15:23:11 dfr Exp $"); */
-+
-+#include "mem-pool.h"
-+
-+#include <rpc/types.h>
-+#include <rpc/xdr.h>
-+
-+/* ARGSUSED */
-+static bool_t
-+x_putlong(XDR *xdrs, const long *longp)
-+{
-+
-+ xdrs->x_handy += BYTES_PER_XDR_UNIT;
-+ return (TRUE);
-+}
-+
-+/* ARGSUSED */
-+static bool_t
-+x_putbytes(XDR *xdrs, const char *bp, u_int len)
-+{
-+
-+ xdrs->x_handy += len;
-+ return (TRUE);
-+}
-+
-+static u_int
-+x_getpostn(XDR *xdrs)
-+{
-+
-+ return (xdrs->x_handy);
-+}
-+
-+/* ARGSUSED */
-+static bool_t
-+x_setpostn(XDR *xdrs, u_int pos)
-+{
-+
-+ /* This is not allowed */
-+ return (FALSE);
-+}
-+
-+static int32_t *
-+x_inline(XDR *xdrs, u_int len)
-+{
-+
-+ if (len == 0) {
-+ return (NULL);
-+ }
-+ if (xdrs->x_op != XDR_ENCODE) {
-+ return (NULL);
-+ }
-+ if (len < (u_int)(uintptr_t)xdrs->x_base) {
-+ /* x_private was already allocated */
-+ xdrs->x_handy += len;
-+ return ((int32_t *) xdrs->x_private);
-+ } else {
-+ /* Free the earlier space and allocate new area */
-+ if (xdrs->x_private)
-+ FREE(xdrs->x_private);
-+ if ((xdrs->x_private = (caddr_t) MALLOC(len)) == NULL) {
-+
-+ xdrs->x_base = 0;
-+ return (NULL);
-+ }
-+ xdrs->x_base = (caddr_t)(uintptr_t) len;
-+ xdrs->x_handy += len;
-+ return ((int32_t *) xdrs->x_private);
-+ }
-+}
-+
-+static int
-+harmless(void)
-+{
-+
-+ /* Always return FALSE/NULL, as the case may be */
-+ return (0);
-+}
-+
-+static void
-+x_destroy(XDR *xdrs)
-+{
-+
-+ xdrs->x_handy = 0;
-+ xdrs->x_base = 0;
-+ if (xdrs->x_private) {
-+ FREE(xdrs->x_private);
-+ xdrs->x_private = NULL;
-+ }
-+ return;
-+}
-+
-+unsigned long
-+xdr_sizeof(xdrproc_t func, void *data)
-+{
-+ XDR x;
-+ struct xdr_ops ops;
-+ bool_t stat;
-+ /* to stop ANSI-C compiler from complaining */
-+ typedef bool_t (* dummyfunc1)(XDR *, long *);
-+ typedef bool_t (* dummyfunc2)(XDR *, caddr_t, u_int);
-+
-+ ops.x_putlong = x_putlong;
-+ ops.x_putbytes = x_putbytes;
-+ ops.x_inline = x_inline;
-+ ops.x_getpostn = x_getpostn;
-+ ops.x_setpostn = x_setpostn;
-+ ops.x_destroy = x_destroy;
-+
-+ /* the other harmless ones */
-+ ops.x_getlong = (dummyfunc1) harmless;
-+ ops.x_getbytes = (dummyfunc2) harmless;
-+
-+ x.x_op = XDR_ENCODE;
-+ x.x_ops = &ops;
-+ x.x_handy = 0;
-+ x.x_private = (caddr_t) NULL;
-+ x.x_base = (caddr_t) 0;
-+
-+ stat = func(&x, data);
-+ if (x.x_private)
-+ FREE(x.x_private);
-+ return (stat == TRUE ? (unsigned) x.x_handy: 0);
-+}
-+
-+#endif /* __NetBSD__ */
diff --git a/filesystems/glusterfs/patches/patch-bl b/filesystems/glusterfs/patches/patch-bl
deleted file mode 100644
index fa0a7a9bc30..00000000000
--- a/filesystems/glusterfs/patches/patch-bl
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-bl,v 1.7 2011/10/06 02:19:06 manu Exp $
-
-#include <signal.h> for SIGTERM
-
---- glusterfsd/src/glusterfsd-mgmt.c.orig 2011-08-23 14:31:37.000000000 +0200
-+++ glusterfsd/src/glusterfsd-mgmt.c 2011-09-17 15:45:29.000000000 +0200
-@@ -20,8 +20,9 @@
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/wait.h>
- #include <stdlib.h>
-+#include <signal.h>
-
- #ifndef _CONFIG_H
- #define _CONFIG_H
- #include "config.h"
diff --git a/filesystems/glusterfs/patches/patch-bm b/filesystems/glusterfs/patches/patch-bm
deleted file mode 100644
index 7488047f6d9..00000000000
--- a/filesystems/glusterfs/patches/patch-bm
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD: patch-bm,v 1.7 2011/10/06 02:19:06 manu Exp $
-
-Add xdr-sizeof() to the build
-
---- rpc/rpc-lib/src/Makefile.am.orig 2011-08-23 14:31:38.000000000 +0200
-+++ rpc/rpc-lib/src/Makefile.am 2011-09-17 15:45:29.000000000 +0200
-@@ -1,9 +1,9 @@
- lib_LTLIBRARIES = libgfrpc.la
-
- libgfrpc_la_SOURCES = auth-unix.c rpcsvc-auth.c rpcsvc.c auth-null.c \
- rpc-transport.c xdr-rpc.c xdr-rpcclnt.c rpc-clnt.c auth-glusterfs.c \
-- rpc-common.c
-+ rpc-common.c xdr-sizeof.c
- libgfrpc_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
-
- noinst_HEADERS = rpcsvc.h rpc-transport.h xdr-common.h xdr-rpc.h xdr-rpcclnt.h \
- rpc-clnt.h rpcsvc-common.h protocol-common.h
diff --git a/filesystems/glusterfs/patches/patch-bn b/filesystems/glusterfs/patches/patch-bn
deleted file mode 100644
index 65f77639031..00000000000
--- a/filesystems/glusterfs/patches/patch-bn
+++ /dev/null
@@ -1,38 +0,0 @@
-$NetBSD: patch-bn,v 1.7 2011/10/06 02:19:06 manu Exp $
-
-Add xdr-sizeof() to the build
-
---- rpc/rpc-lib/src/Makefile.in.orig 2011-08-23 14:31:53.000000000 +0200
-+++ rpc/rpc-lib/src/Makefile.in 2011-09-17 15:45:30.000000000 +0200
-@@ -59,9 +59,9 @@
- libgfrpc_la_DEPENDENCIES = \
- $(top_builddir)/libglusterfs/src/libglusterfs.la
- am_libgfrpc_la_OBJECTS = auth-unix.lo rpcsvc-auth.lo rpcsvc.lo \
- auth-null.lo rpc-transport.lo xdr-rpc.lo xdr-rpcclnt.lo \
-- rpc-clnt.lo auth-glusterfs.lo rpc-common.lo
-+ rpc-clnt.lo auth-glusterfs.lo rpc-common.lo xdr-sizeof.lo
- libgfrpc_la_OBJECTS = $(am_libgfrpc_la_OBJECTS)
- DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
- depcomp = $(SHELL) $(top_srcdir)/depcomp
- am__depfiles_maybe = depfiles
-@@ -228,9 +228,9 @@
- target_alias = @target_alias@
- lib_LTLIBRARIES = libgfrpc.la
- libgfrpc_la_SOURCES = auth-unix.c rpcsvc-auth.c rpcsvc.c auth-null.c \
- rpc-transport.c xdr-rpc.c xdr-rpcclnt.c rpc-clnt.c auth-glusterfs.c \
-- rpc-common.c
-+ rpc-common.c xdr-sizeof.lo
-
- libgfrpc_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
- noinst_HEADERS = rpcsvc.h rpc-transport.h xdr-common.h xdr-rpc.h xdr-rpcclnt.h \
- rpc-clnt.h rpcsvc-common.h protocol-common.h
-@@ -314,8 +314,9 @@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth-null.Plo@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth-unix.Plo@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpc-clnt.Plo@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpc-common.Plo@am__quote@
-+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdr-sizeof.Plo@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpc-transport.Plo@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpcsvc-auth.Plo@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpcsvc.Plo@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdr-rpc.Plo@am__quote@
diff --git a/filesystems/glusterfs/patches/patch-bo b/filesystems/glusterfs/patches/patch-bo
deleted file mode 100644
index 1563314125f..00000000000
--- a/filesystems/glusterfs/patches/patch-bo
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-bo,v 1.5 2011/10/06 02:19:06 manu Exp $
-
-Build fix
-
---- rpc/xdr/src/cli1-xdr.c.orig 2011-08-23 14:31:38.000000000 +0200
-+++ rpc/xdr/src/cli1-xdr.c 2011-09-17 15:45:30.000000000 +0200
-@@ -23,8 +23,9 @@
- * It was generated using rpcgen.
- */
-
- #include "cli1-xdr.h"
-+#include "xdr-common.h"
- #include "compat.h"
-
- bool_t
- xdr_gf1_cluster_type (XDR *xdrs, gf1_cluster_type *objp)
diff --git a/filesystems/glusterfs/patches/patch-bp b/filesystems/glusterfs/patches/patch-bp
deleted file mode 100644
index c6ffd8bfa4b..00000000000
--- a/filesystems/glusterfs/patches/patch-bp
+++ /dev/null
@@ -1,19 +0,0 @@
-$NetBSD: patch-bp,v 1.7 2011/10/06 02:19:06 manu Exp $
-
-Define Linux-like umount()
-
---- xlators/mgmt/glusterd/src/glusterd-op-sm.c.orig 2011-08-23 14:31:40.000000000 +0200
-+++ xlators/mgmt/glusterd/src/glusterd-op-sm.c 2011-09-17 15:45:30.000000000 +0200
-@@ -49,8 +49,12 @@
- #include "syscall.h"
- #include "cli1.h"
- #include "common-utils.h"
-
-+#ifdef __NetBSD__
-+#define umount(path) unmount(path,0)
-+#endif /* __NetBSD__ */
-+
- #include <sys/types.h>
- #include <signal.h>
- #include <sys/wait.h>
- #define glusterd_op_start_volume_args_get(dict, volname, flags) \
diff --git a/filesystems/glusterfs/patches/patch-bq b/filesystems/glusterfs/patches/patch-bq
deleted file mode 100644
index 7cfa6aac5f6..00000000000
--- a/filesystems/glusterfs/patches/patch-bq
+++ /dev/null
@@ -1,92 +0,0 @@
-$NetBSD: patch-bq,v 1.9 2011/12/09 16:57:44 manu Exp $
-
-Make sure gluseterfsd listens on the same address family as glusterd
-
---- xlators/mgmt/glusterd/src/glusterd-utils.c.orig 2011-11-27 07:38:16.000000000 +0100
-+++ xlators/mgmt/glusterd/src/glusterd-utils.c 2011-11-27 07:38:16.000000000 +0100
-@@ -88,8 +88,52 @@
- //TODO: set timestamp
- return 0;
- }
-
-+static const char *
-+glusterd_listener_family_name(void)
-+{
-+ xlator_t *this = NULL;
-+ glusterd_conf_t *conf = NULL;
-+ rpcsvc_listener_t *listener = NULL;
-+ struct sockaddr_storage ss;
-+
-+ this = THIS;
-+ GF_ASSERT (this);
-+ conf = this->private;
-+ GF_ASSERT (conf);
-+ GF_ASSERT (conf->rpc);
-+
-+ list_for_each_entry (listener, &conf->rpc->listeners, list)
-+ break; /* grab first one */
-+
-+ GF_ASSERT (listener->trans);
-+
-+ if (rpc_transport_get_myaddr(listener->trans, NULL, 0,
-+ &ss, sizeof(ss)) != 0) {
-+ gf_log ("glusterd", GF_LOG_ERROR,
-+ "rpc_transport_get_myname failed: %s",
-+ strerror(errno));
-+ return NULL;
-+ }
-+
-+ switch (ss.ss_family) {
-+ case AF_INET:
-+ return "inet";
-+ break;
-+ case AF_INET6:
-+ return "inet6";
-+ break;
-+ default:
-+ gf_log ("glusterd", GF_LOG_ERROR,
-+ "unknown address family %d",
-+ ss.ss_family);
-+ break;
-+ }
-+
-+ return NULL;
-+}
-+
- gf_boolean_t
- glusterd_is_loopback_localhost (const struct sockaddr *sa, char *hostname)
- {
- GF_ASSERT (sa);
-@@ -1032,8 +1076,10 @@
- int rdma_port = 0;
- FILE *file = NULL;
- gf_boolean_t is_locked = _gf_false;
- char socketpath[PATH_MAX] = {0};
-+ const char *family_name;
-+ char *family_option[8192] = {0,};
-
- GF_ASSERT (volinfo);
- GF_ASSERT (brickinfo);
-
-@@ -1112,14 +1158,19 @@
- port = brickinfo->port;
- if (!port)
- port = pmap_registry_alloc (THIS);
-
-+ if ((family_name = glusterd_listener_family_name()) != NULL)
-+ snprintf (family_option, 8192,
-+ "--xlator-option %s-server.transport.address-family=%s ",
-+ volinfo->volname, family_name);
-+
- if (volinfo->transport_type != GF_TRANSPORT_BOTH_TCP_RDMA) {
- snprintf (cmd_str, 8192,
- "%s/sbin/glusterfsd --xlator-option %s-server.listen-port=%d "
-- "-s localhost --volfile-id %s -p %s -S %s --brick-name %s "
-+ "%s -s localhost --volfile-id %s -p %s -S %s --brick-name %s "
- "--brick-port %d -l %s", GFS_PREFIX, volinfo->volname,
-- port, volfile, pidfile, socketpath, brickinfo->path, port,
-+ port, family_option, volfile, pidfile, socketpath, brickinfo->path, port,
- brickinfo->logfile);
- } else {
- rdma_port = brickinfo->rdma_port;
- if (!rdma_port)
diff --git a/filesystems/glusterfs/patches/patch-br b/filesystems/glusterfs/patches/patch-br
deleted file mode 100644
index a3f028eeb8a..00000000000
--- a/filesystems/glusterfs/patches/patch-br
+++ /dev/null
@@ -1,119 +0,0 @@
-$NetBSD: patch-br,v 1.10 2011/12/09 16:57:44 manu Exp $
-
-Use linkat(2) if available so that we can make a hardlink to symlink
-itself, instead of symlink destination, like link(2) does. This is
-required to support moving symlinks on distributed volumes, as
-glusterfsd really wants to hardlink the symlink and not its target.
-
-If linkat(2) is inavailable, then moving a symlink on distributed
-volumes fails.
-
-Correctly cast gfid when producing inode to avoid it getting garbled
-
-Ignore .attribute because chaos occurs if it gets distributed
-
---- xlators/storage/posix/src/posix.c.orig 2011-11-14 14:46:03.000000000 +0100
-+++ xlators/storage/posix/src/posix.c 2011-12-09 03:45:17.000000000 +0100
-@@ -36,8 +36,12 @@
- #ifndef GF_BSD_HOST_OS
- #include <alloca.h>
- #endif /* GF_BSD_HOST_OS */
-
-+#ifdef HAVE_LINKAT
-+#include <fcntl.h>
-+#endif /* HAVE_LINKAT */
-+
- #include "glusterfs.h"
- #include "md5.h"
- #include "checksum.h"
- #include "dict.h"
-@@ -286,9 +290,9 @@
- int i = 0;
-
- /* consider least significant 8 bytes of value out of gfid */
- for (i = 15; i > (15 - 8); i--) {
-- temp_ino += buf->ia_gfid[i] << j;
-+ temp_ino += (uint64_t)(buf->ia_gfid[i]) << j;
- j += 8;
- }
-
- buf->ia_ino = temp_ino;
-@@ -1311,8 +1315,13 @@
- loc->path, strerror (op_errno));
- goto out;
- }
-
-+#ifdef __NetBSD__
-+ if (S_ISFIFO(mode))
-+ op_ret = mkfifo (real_path, mode);
-+ else
-+#endif /* __NetBSD__ */
- op_ret = mknod (real_path, mode, dev);
-
- if (op_ret == -1) {
- op_errno = errno;
-@@ -2204,9 +2213,20 @@
- newparentpath, strerror (op_errno));
- goto out;
- }
-
-+#ifdef HAVE_LINKAT
-+ /*
-+ * On most systems (Linux being the notable exception), link(2)
-+ * first resolves symlinks. If the target is a directory or
-+ * is nonexistent, it will fail. linkat(2) operates on the
-+ * symlink instead of its target when the AT_SYMLINK_FOLLOW
-+ * flag is not supplied.
-+ */
-+ op_ret = linkat (AT_FDCWD, real_oldpath, AT_FDCWD, real_newpath, 0);
-+#else
- op_ret = link (real_oldpath, real_newpath);
-+#endif
- if (op_ret == -1) {
- op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "link %s to %s failed: %s",
-@@ -4329,8 +4349,22 @@
- if ((!strcmp (real_path, base_path))
- && (!strcmp (entry->d_name, GF_REPLICATE_TRASH_DIR)))
- continue;
-
-+#ifdef __NetBSD__
-+ /*
-+ * NetBSD with UFS1 backend uses backing files for
-+ * extended attributes. They can be found in a
-+ * .attribute file located at the root of the filesystem
-+ * We hide it to glusterfs clients, since chaos will occur
-+ * when the cluster/dht xlator decides to distribute
-+ * exended attribute backing file accross storage servers.
-+ */
-+ if ((!strcmp(real_path, base_path))
-+ && (!strcmp(entry->d_name, ".attribute")))
-+ continue;
-+#endif /* __NetBSD__ */
-+
- if ((!strcmp (real_path, base_path))
- && (!strncmp (GF_HIDDEN_PATH, entry->d_name,
- strlen (GF_HIDDEN_PATH)))) {
- snprintf (hidden_path, PATH_MAX, "%s/%s", real_path,
-@@ -4455,14 +4489,15 @@
-
- /* pick ENOENT to indicate EOF */
- op_errno = errno;
-
-+ list_for_each_entry (tmp_entry, &entries.list, list) {
-+ strcpy (entry_path + real_path_len + 1,
-+ tmp_entry->d_name);
-+ posix_lstat_with_gfid (this, entry_path, &stbuf);
-+ tmp_entry->d_ino = stbuf.ia_ino;
-+
- if (whichop == GF_FOP_READDIRP) {
-- list_for_each_entry (tmp_entry, &entries.list, list) {
-- strcpy (entry_path + real_path_len + 1,
-- tmp_entry->d_name);
-- posix_lstat_with_gfid (this, entry_path, &stbuf);
-- tmp_entry->d_ino = stbuf.ia_ino;
- tmp_entry->d_stat = stbuf;
- }
- }
-
diff --git a/filesystems/glusterfs/patches/patch-bs b/filesystems/glusterfs/patches/patch-bs
deleted file mode 100644
index 931318da61e..00000000000
--- a/filesystems/glusterfs/patches/patch-bs
+++ /dev/null
@@ -1,83 +0,0 @@
-$NetBSD: patch-bs,v 1.6 2011/10/06 02:19:06 manu Exp $
-
-Use Linux-like extended attribute API for NetBSD
-
---- libglusterfs/src/syscall.c.orig 2011-08-23 14:31:38.000000000 +0200
-+++ libglusterfs/src/syscall.c 2011-09-17 15:45:30.000000000 +0200
-@@ -267,9 +267,9 @@
- sys_lsetxattr (const char *path, const char *name, const void *value,
- size_t size, int flags)
- {
-
--#ifdef GF_LINUX_HOST_OS
-+#if defined(GF_LINUX_HOST_OS) || defined(__NetBSD__)
- return lsetxattr (path, name, value, size, flags);
- #endif
-
- #ifdef GF_BSD_HOST_OS
-@@ -292,9 +292,9 @@
- ssize_t
- sys_llistxattr (const char *path, char *list, size_t size)
- {
-
--#ifdef GF_LINUX_HOST_OS
-+#if defined(GF_LINUX_HOST_OS) || defined(__NetBSD__)
- return llistxattr (path, list, size);
- #endif
-
- #ifdef GF_BSD_HOST_OS
-@@ -315,9 +315,9 @@
- ssize_t
- sys_lgetxattr (const char *path, const char *name, void *value, size_t size)
- {
-
--#ifdef GF_LINUX_HOST_OS
-+#if defined(GF_LINUX_HOST_OS) || defined(__NetBSD__)
- return lgetxattr (path, name, value, size);
- #endif
-
- #ifdef GF_BSD_HOST_OS
-@@ -339,9 +339,9 @@
- ssize_t
- sys_fgetxattr (int filedes, const char *name, void *value, size_t size)
- {
-
--#ifdef GF_LINUX_HOST_OS
-+#if defined(GF_LINUX_HOST_OS) || defined(__NetBSD__)
- return fgetxattr (filedes, name, value, size);
- #endif
-
- #ifdef GF_BSD_HOST_OS
-@@ -364,9 +364,9 @@
- sys_fsetxattr (int filedes, const char *name, const void *value,
- size_t size, int flags)
- {
-
--#ifdef GF_LINUX_HOST_OS
-+#if defined(GF_LINUX_HOST_OS) || defined(__NetBSD__)
- return fsetxattr (filedes, name, value, size, flags);
- #endif
-
- #ifdef GF_BSD_HOST_OS
-@@ -388,9 +388,9 @@
- ssize_t
- sys_flistxattr (int filedes, char *list, size_t size)
- {
-
--#ifdef GF_LINUX_HOST_OS
-+#if defined(GF_LINUX_HOST_OS) || defined(__NetBSD__)
- return flistxattr (filedes, list, size);
- #endif
-
- #ifdef GF_BSD_HOST_OS
-@@ -411,9 +411,9 @@
- int
- sys_lremovexattr (const char *path, const char *name)
- {
-
--#ifdef GF_LINUX_HOST_OS
-+#if defined(GF_LINUX_HOST_OS) || defined(__NetBSD__)
- return lremovexattr (path, name);
- #endif
-
- #ifdef GF_BSD_HOST_OS
diff --git a/filesystems/glusterfs/patches/patch-bt b/filesystems/glusterfs/patches/patch-bt
deleted file mode 100644
index 002cff87d3b..00000000000
--- a/filesystems/glusterfs/patches/patch-bt
+++ /dev/null
@@ -1,27 +0,0 @@
-$NetBSD: patch-bt,v 1.6 2011/10/06 02:19:06 manu Exp $
-
-Initialize pthread_cond_t, it hurts otherwise.
-
---- xlators/performance/io-threads/src/io-threads.c.orig 2011-08-23 14:31:41.000000000 +0200
-+++ xlators/performance/io-threads/src/io-threads.c 2011-09-17 15:45:30.000000000 +0200
-@@ -2194,8 +2194,20 @@
- "pthread_mutex_init failed (%d)", ret);
- goto out;
- }
-
-+ if ((ret = pthread_cond_init(&conf->cond, NULL)) != 0) {
-+ gf_log (this->name, GF_LOG_ERROR,
-+ "pthread_cond_init failed (%d)", ret);
-+ goto out;
-+ }
-+
-+ if ((ret = pthread_mutex_init(&conf->mutex, NULL)) != 0) {
-+ gf_log (this->name, GF_LOG_ERROR,
-+ "pthread_mutex_init failed (%d)", ret);
-+ goto out;
-+ }
-+
- set_stack_size (conf);
-
- if (xlator_get_volopt_info (&this->volume_options, "thread-count",
- &def_val, NULL)) {
diff --git a/filesystems/glusterfs/patches/patch-bv b/filesystems/glusterfs/patches/patch-bv
deleted file mode 100644
index 6091b0a5d6b..00000000000
--- a/filesystems/glusterfs/patches/patch-bv
+++ /dev/null
@@ -1,24 +0,0 @@
-$NetBSD: patch-bv,v 1.3 2011/10/06 02:19:06 manu Exp $
-
-Use linkat(2) if available so that we can make a hardlink to symlink
-itself, instead of symlink destination, like link(2) does. This is
-required to support moving symlinks on distributed volumes, as
-glusterfsd really wants to hardlink the symlink and not its target.
-
-If linkat(2) is inavailable, then moving a symlink on distributed
-volumes fails.
-
---- config.h.in.orig 2011-08-23 14:31:46.000000000 +0200
-+++ config.h.in 2011-09-17 15:45:30.000000000 +0200
-@@ -38,8 +38,11 @@
-
- /* define if found malloc_stats */
- #undef HAVE_MALLOC_STATS
-
-+/* define if found linkat */
-+#undef HAVE_LINKAT
-+
- /* Define to 1 if you have the <memory.h> header file. */
- #undef HAVE_MEMORY_H
-
- /* readline enabled CLI */
diff --git a/filesystems/glusterfs/patches/patch-bw b/filesystems/glusterfs/patches/patch-bw
deleted file mode 100644
index 875aebf69b3..00000000000
--- a/filesystems/glusterfs/patches/patch-bw
+++ /dev/null
@@ -1,23 +0,0 @@
-$NetBSD: patch-bw,v 1.4 2011/12/16 05:40:46 manu Exp $
-
-usleep(3) shall not be called with argument higher than 1s
-
---- libglusterfs/src/timer.c.orig 2011-10-14 15:06:12.000000000 +0200
-+++ libglusterfs/src/timer.c 2011-10-14 15:18:16.000000000 +0200
-@@ -136,6 +136,7 @@
- gf_timer_proc (void *ctx)
- {
- gf_timer_registry_t *reg = NULL;
-+ const struct timespec sleepts = {.tv_sec = 1, .tv_nsec = 0, };
-
- if (ctx == NULL)
- {
-@@ -178,7 +179,7 @@
- else
- break;
- }
-- usleep (1000000);
-+ nanosleep (&sleepts, NULL);
- }
-
- pthread_mutex_lock (&reg->lock);
diff --git a/filesystems/glusterfs/patches/patch-bx b/filesystems/glusterfs/patches/patch-bx
deleted file mode 100644
index 624a3e54b4a..00000000000
--- a/filesystems/glusterfs/patches/patch-bx
+++ /dev/null
@@ -1,18 +0,0 @@
-$NetBSD: patch-bx,v 1.4 2011/12/16 05:40:46 manu Exp $
-
-glusterfs may need lots of data, raise the limit and hope there's enough
-ram ...
-
---- glusterfsd/src/glusterfsd.c.orig 2011-08-23 14:31:37.000000000 +0200
-+++ glusterfsd/src/glusterfsd.c 2011-10-19 15:28:44.000000000 +0200
-@@ -1008,6 +1008,10 @@
- lim.rlim_cur = RLIM_INFINITY;
- lim.rlim_max = RLIM_INFINITY;
- setrlimit (RLIMIT_CORE, &lim);
-+ if (getrlimit(RLIMIT_DATA, &lim) == 0) {
-+ lim.rlim_cur = lim.rlim_max;
-+ setrlimit(RLIMIT_DATA, &lim);
-+ }
-
- return 0;
- }
diff --git a/filesystems/glusterfs/patches/patch-ca b/filesystems/glusterfs/patches/patch-ca
deleted file mode 100644
index 6327b32a52b..00000000000
--- a/filesystems/glusterfs/patches/patch-ca
+++ /dev/null
@@ -1,25 +0,0 @@
-$NetBSD: patch-ca,v 1.2 2011/12/16 05:40:46 manu Exp $
-
-Fix race condition, pulled from upstream
-http://review.gluster.com/#change,77
-
---- glusterfsd/src/glusterfsd-mgmt.c.orig 2011-12-02 03:08:11.000000000 +0100
-+++ glusterfsd/src/glusterfsd-mgmt.c 2011-12-03 04:02:52.000000000 +0100
-@@ -889,13 +889,13 @@
- gf_log ("", GF_LOG_WARNING, "failed to register callback function");
- goto out;
- }
-
-- ret = rpc_clnt_start (rpc);
-- if (ret)
-- goto out;
--
-+ /* This value should be set before doing the 'rpc_clnt_start()' as
-+ the notify function uses this variable */
- ctx->mgmt = rpc;
-+
-+ ret = rpc_clnt_start (rpc);
- out:
- return ret;
- }
-
diff --git a/filesystems/glusterfs/patches/patch-ce b/filesystems/glusterfs/patches/patch-ce
deleted file mode 100644
index e290e04fde7..00000000000
--- a/filesystems/glusterfs/patches/patch-ce
+++ /dev/null
@@ -1,75 +0,0 @@
-$NetBSD: patch-ce,v 1.1 2011/12/16 05:40:46 manu Exp $
-
-Fetch secondary groups using sysctl(2) instead of /proc, to avoid
-deadlocks
-
---- xlators/mount/fuse/src/fuse-helpers.c.orig 2011-11-14 14:46:02.000000000 +0100
-+++ xlators/mount/fuse/src/fuse-helpers.c 2011-12-15 10:49:52.000000000 +0100
-@@ -17,8 +17,11 @@
- <http://www.gnu.org/licenses/>.
- */
-
- #include "fuse-bridge.h"
-+#ifdef __NetBSD__
-+#include <sys/sysctl.h> /* for sysctl(2) */
-+#endif /* __NetBSD__ */
-
- xlator_t *
- fuse_state_subvol (fuse_state_t *state)
- {
-@@ -134,10 +137,10 @@
- return state;
- }
-
-
--void
--frame_fill_groups (call_frame_t *frame)
-+static void
-+frame_fill_groups_proc (call_frame_t *frame)
- {
- char filename[128];
- char line[128];
- char *ptr = NULL;
-@@ -184,8 +187,42 @@
- fclose (fp);
- return;
- }
-
-+#ifdef __NetBSD__
-+static void
-+frame_fill_groups_sysctl (call_frame_t *frame)
-+{
-+ int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, frame->root->pid };
-+ size_t namelen = sizeof(name) / sizeof(*name);
-+ struct kinfo_proc kp;
-+ size_t kplen = sizeof(kp);
-+ int i, ngroups;
-+
-+ if (sysctl(name, namelen, &kp, &kplen, NULL, 0) != 0)
-+ return;
-+
-+ ngroups = MIN(kp.kp_eproc.e_ucred.cr_ngroups, GF_REQUEST_MAXGROUPS);
-+
-+ for (i = 0; i < ngroups; i++)
-+ frame->root->groups[i] = kp.kp_eproc.e_ucred.cr_groups[i];
-+ frame->root->ngrps = ngroups;
-+
-+
-+ return;
-+}
-+#endif /* __NetBSD__ */
-+
-+void
-+frame_fill_groups (call_frame_t *frame)
-+{
-+#if defined(linux)
-+ frame_fill_groups_proc(frame);
-+#elif defined(__NetBSD__)
-+ frame_fill_groups_sysctl(frame);
-+#endif
-+ return;
-+}
-
- call_frame_t *
- get_call_frame_for_req (fuse_state_t *state)
- {
diff --git a/filesystems/glusterfs/patches/patch-cf b/filesystems/glusterfs/patches/patch-cf
deleted file mode 100644
index a030a0d3269..00000000000
--- a/filesystems/glusterfs/patches/patch-cf
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-cf,v 1.1 2012/06/16 01:47:34 manu Exp $
-
-Strip "-o stuff" from volfile_loc
---- xlators/mount/fuse/utils/mount.glusterfs.in.orig 2012-06-16 03:23:37.000000000 +0200
-+++ xlators/mount/fuse/utils/mount.glusterfs.in 2012-06-16 03:25:02.000000000 +0200
-@@ -191,9 +191,9 @@
- log_server=$(echo "$options" | sed -n 's/.*log-server=\([^,]*\).*/\1/p');
-
- log_server_port=$(echo "$options" | sed -n 's/.*log-server-port=\([^,]*\).*/\1/p');
-
-- volfile_loc="$1";
-+ volfile_loc=$(echo "$@" | sed -n 's/-o[ ]*\([^ ]*\)//p'|awk '{print $1}');
-
- [ -r "$volfile_loc" ] || {
- server_ip=$(echo "$volfile_loc" | sed -n 's/\([^\:]*\).*/\1/p');
- test_str=$(echo "$volfile_loc" | sed -n 's/.*:\([^ ]*\).*/\1/p');
diff --git a/filesystems/glusterfs/patches/patch-da b/filesystems/glusterfs/patches/patch-da
new file mode 100644
index 00000000000..f8060e8ca97
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-da
@@ -0,0 +1,26 @@
+$NetBSD: patch-da,v 1.1 2012/10/19 04:15:22 manu Exp $
+
+Avoid corner case where the client is unsable to reconnect to servers
+
+Backport of a bit from http://review.gluster.org/362
+
+--- rpc/rpc-transport/socket/src/socket.c.orig 2012-09-30 06:42:07.000000000 +0200
++++ rpc/rpc-transport/socket/src/socket.c 2012-09-30 09:41:50.000000000 +0200
+@@ -278,8 +278,17 @@
+ gf_log (this->name, GF_LOG_DEBUG,
+ "shutdown() returned %d. %s",
+ ret, strerror (errno));
+ }
++
++ /*
++ * Without this, reconnect (= disconnect + connect)
++ * won't work except by accident.
++ */
++ event_unregister (this->ctx->event_pool,
++ priv->sock, priv->idx);
++ close (priv->sock);
++ priv->sock = -1;
+ }
+
+ out:
+ return ret;
diff --git a/filesystems/glusterfs/patches/patch-db b/filesystems/glusterfs/patches/patch-db
new file mode 100644
index 00000000000..d1b20f733dd
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-db
@@ -0,0 +1,39 @@
+$NetBSD: patch-db,v 1.1 2012/10/19 04:15:22 manu Exp $
+
+Always enable DHT so that scaling from 1 brick to more does not raise
+spurious EINVAL
+
+From upstream http://review.gluster.org/3838
+
+--- xlators/mgmt/glusterd/src/glusterd-volgen.c.orig
++++ xlators/mgmt/glusterd/src/glusterd-volgen.c
+@@ -2362,7 +2362,6 @@ volgen_graph_build_dht_cluster (volgen_graph_t *graph,
+ char *decommissioned_children = NULL;
+ xlator_t *dht = NULL;
+
+- GF_ASSERT (child_count > 1);
+ clusters = volgen_graph_build_clusters (graph, volinfo,
+ "cluster/distribute", "%s-dht",
+ child_count, child_count);
+@@ -2455,12 +2454,16 @@ volume_volgen_graph_build_clusters (volgen_graph_t *graph,
+
+ build_distribute:
+ dist_count = volinfo->brick_count / volinfo->dist_leaf_count;
+- if (dist_count > 1) {
+- ret = volgen_graph_build_dht_cluster (graph, volinfo,
+- dist_count);
+- if (ret)
+- goto out;
++ if (!dist_count) {
++ ret = -1;
++ goto out;
+ }
++
++ ret = volgen_graph_build_dht_cluster (graph, volinfo,
++ dist_count);
++ if (ret)
++ goto out;
++
+ ret = 0;
+ out:
+ return ret;