summaryrefslogtreecommitdiff
path: root/filesystems/glusterfs
diff options
context:
space:
mode:
authormanu <manu>2011-04-18 16:19:47 +0000
committermanu <manu>2011-04-18 16:19:47 +0000
commit8aaedb3b404264c2ae8a62cab1be4c51d026f630 (patch)
tree74bbeb33f73ca9b2b48a4454036f83fb21c6f861 /filesystems/glusterfs
parenta467db51086082078debdb93a86682bc4fc8eb50 (diff)
downloadpkgsrc-8aaedb3b404264c2ae8a62cab1be4c51d026f630.tar.gz
Update glusterfs to 3.1.4.
Major new features according to http://www.gluster.org/ - Elastic Volume Management - New Gluster Console Manager - Dynamic Storage for the data center and cloud
Diffstat (limited to 'filesystems/glusterfs')
-rw-r--r--filesystems/glusterfs/MESSAGE.NetBSD11
-rw-r--r--filesystems/glusterfs/Makefile31
-rw-r--r--filesystems/glusterfs/PLIST121
-rw-r--r--filesystems/glusterfs/distinfo43
-rwxr-xr-xfilesystems/glusterfs/files/glusterd.sh19
-rwxr-xr-xfilesystems/glusterfs/files/glusterfsd.sh18
-rwxr-xr-xfilesystems/glusterfs/files/xattr-init.sh55
-rw-r--r--filesystems/glusterfs/patches/patch-aa8
-rw-r--r--filesystems/glusterfs/patches/patch-ab29
-rw-r--r--filesystems/glusterfs/patches/patch-ad16
-rw-r--r--filesystems/glusterfs/patches/patch-ae12
-rw-r--r--filesystems/glusterfs/patches/patch-af14
-rw-r--r--filesystems/glusterfs/patches/patch-ag20
-rw-r--r--filesystems/glusterfs/patches/patch-an30
-rw-r--r--filesystems/glusterfs/patches/patch-ao32
-rw-r--r--filesystems/glusterfs/patches/patch-aq42
-rw-r--r--filesystems/glusterfs/patches/patch-ar23
-rw-r--r--filesystems/glusterfs/patches/patch-as16
-rw-r--r--filesystems/glusterfs/patches/patch-ba21
-rw-r--r--filesystems/glusterfs/patches/patch-bb9
-rw-r--r--filesystems/glusterfs/patches/patch-bc28
-rw-r--r--filesystems/glusterfs/patches/patch-bd60
-rw-r--r--filesystems/glusterfs/patches/patch-be66
-rw-r--r--filesystems/glusterfs/patches/patch-bf11
-rw-r--r--filesystems/glusterfs/patches/patch-bg15
-rw-r--r--filesystems/glusterfs/patches/patch-bh38
-rw-r--r--filesystems/glusterfs/patches/patch-bj15
-rw-r--r--filesystems/glusterfs/patches/patch-bk223
28 files changed, 705 insertions, 321 deletions
diff --git a/filesystems/glusterfs/MESSAGE.NetBSD b/filesystems/glusterfs/MESSAGE.NetBSD
index 41f355bdfc1..3e7263ac27a 100644
--- a/filesystems/glusterfs/MESSAGE.NetBSD
+++ b/filesystems/glusterfs/MESSAGE.NetBSD
@@ -1,13 +1,14 @@
===========================================================================
-$NetBSD: MESSAGE.NetBSD,v 1.2 2010/10/11 07:14:36 manu Exp $
+$NetBSD: MESSAGE.NetBSD,v 1.3 2011/04/18 16:19:47 manu Exp $
-glusterfs clients need the following in /etc/sys.conf in order to
+glusterfs clients need the following in /etc/sys.conf in order to
avoid hangs on I/O opezrations:
-kern.sbmax=4194304
+kern.sbmax=4194304
net.inet.tcp.sendbuf_max=1048576
net.inet.tcp.recvbuf_max=1048576
-glusterfs servers need an extended attributes filesystem with user
-attribute trusted.posix1.gen
+glusterfs servers will need extended attributes in exported filesystems.
+The requiered attributes can be initialized by running
+ ${PREFIX}/etc/glusterfs/xattr-init.sh
===========================================================================
diff --git a/filesystems/glusterfs/Makefile b/filesystems/glusterfs/Makefile
index f844d626e7d..33500e3d04c 100644
--- a/filesystems/glusterfs/Makefile
+++ b/filesystems/glusterfs/Makefile
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.3 2011/02/25 09:47:22 wiz Exp $
+# $NetBSD: Makefile,v 1.4 2011/04/18 16:19:47 manu Exp $
#
-DISTNAME= glusterfs-3.0.5
+DISTNAME= glusterfs-3.1.4
CATEGORIES= filesystems
-MASTER_SITES= http://ftp.gluster.com/pub/gluster/glusterfs/3.0/LATEST/
+MASTER_SITES= http://download.gluster.com/pub/gluster/glusterfs/3.1/LATEST/
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://www.gluster.org/glusterfs.php
@@ -19,6 +19,12 @@ USE_TOOLS+= flex bison
PYTHON_VERSIONS_ACCEPTED= 27 26 25
CONFIGURE_ARGS+= --localstatedir=${VARBASE}
+# Make sure we do not attept to link with -lfl
+# Only libfl.a is available, and libtool wants libfl.so
+MAKE_FLAGS+= LEXLIB=""
+MAKE_FLAGS+= libglusterfs_la_LIBADD=""
+MAKE_ENV+= AM_MAKEFLAGS=${MAKE_FLAGS:Q}
+
SUBST_CLASSES+= py
SUBST_STAGE.py= post-build
SUBST_FILES.py= extras/volgen/glusterfs-volgen
@@ -29,17 +35,36 @@ SUBST_STAGE.bash= post-build
SUBST_FILES.bash= xlators/mount/fuse/utils/mount.glusterfs
SUBST_SED.bash= -e "s,/bin/bash,/bin/sh,g"
+SUBST_CLASSES+= etc
+SUBST_STAGE.etc= pre-build
+SUBST_FILES.etc+= cli/src/cli-rpc-ops.c
+SUBST_FILES.etc+= libglusterfs/src/compat.h
+SUBST_FILES.etc+= xlators/mgmt/glusterd/src/glusterd-op-sm.c
+SUBST_FILES.etc+= xlators/mgmt/glusterd/src/glusterd.h
+SUBST_FILES.etc+= doc/examples/replicate.vol
+SUBST_FILES.etc+= doc/examples/protocol-server.vol
+SUBST_FILES.etc+= doc/examples/unify.vol
+SUBST_FILES.etc+= doc/examples/stripe.vol
+SUBST_FILES.etc+= doc/glusterd.vol
+SUBST_FILES.etc+= doc/glusterfsd.8
+SUBST_FILES.etc+= doc/glusterfsd.vol.sample
+SUBST_SED.etc= -e "s,/etc/gluster,${PREFIX}/etc/gluster,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 ${EGDIR}/glusterd.vol
OWN_DIRS+= ${VARBASE}/glusterfs
BUILD_DEFS+= VARBASE
+RCD_SCRIPTS= glusterfsd glusterd
+
post-install:
cp ${DESTDIR}/sbin/mount.glusterfs ${DESTDIR}/${PREFIX}/sbin/
+ ${INSTALL_SCRIPT} ${FILESDIR}/xattr-init.sh \
+ ${DESTDIR}/${PREFIX}/etc/glusterfs
.include "../../mk/bsd.prefs.mk"
.include "../../lang/python/application.mk"
diff --git a/filesystems/glusterfs/PLIST b/filesystems/glusterfs/PLIST
index f629a28256e..d8029799c0e 100644
--- a/filesystems/glusterfs/PLIST
+++ b/filesystems/glusterfs/PLIST
@@ -1,72 +1,77 @@
-@comment $NetBSD: PLIST,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
-bin/glusterfs-volgen
+@comment $NetBSD: PLIST,v 1.2 2011/04/18 16:19:47 manu Exp $
etc/glusterfs/glusterfs.vol.sample
etc/glusterfs/glusterfsd.vol.sample
-lib/glusterfs/3.0.5/auth/addr.la
-lib/glusterfs/3.0.5/auth/login.la
-lib/glusterfs/3.0.5/scheduler/alu.la
-lib/glusterfs/3.0.5/scheduler/nufa.la
-lib/glusterfs/3.0.5/scheduler/random.la
-lib/glusterfs/3.0.5/scheduler/rr.la
-lib/glusterfs/3.0.5/scheduler/switch.la
-lib/glusterfs/3.0.5/transport/socket.la
-lib/glusterfs/3.0.5/xlator/cluster/afr.la
-lib/glusterfs/3.0.5/xlator/cluster/dht.la
-lib/glusterfs/3.0.5/xlator/cluster/distribute.so
-lib/glusterfs/3.0.5/xlator/cluster/nufa.la
-lib/glusterfs/3.0.5/xlator/cluster/replicate.so
-lib/glusterfs/3.0.5/xlator/cluster/stripe.la
-lib/glusterfs/3.0.5/xlator/cluster/switch.la
-lib/glusterfs/3.0.5/xlator/debug/error-gen.la
-lib/glusterfs/3.0.5/xlator/debug/io-stats.la
-lib/glusterfs/3.0.5/xlator/debug/trace.la
-lib/glusterfs/3.0.5/xlator/encryption/rot-13.la
-lib/glusterfs/3.0.5/xlator/features/locks.la
-lib/glusterfs/3.0.5/xlator/features/posix-locks.so
-lib/glusterfs/3.0.5/xlator/features/quota.la
-lib/glusterfs/3.0.5/xlator/legacy/cluster/unify.la
-lib/glusterfs/3.0.5/xlator/mount/fuse.la
-lib/glusterfs/3.0.5/xlator/performance/io-cache.la
-lib/glusterfs/3.0.5/xlator/performance/io-threads.la
-lib/glusterfs/3.0.5/xlator/performance/quick-read.la
-lib/glusterfs/3.0.5/xlator/performance/read-ahead.la
-lib/glusterfs/3.0.5/xlator/performance/stat-prefetch.la
-lib/glusterfs/3.0.5/xlator/performance/write-behind.la
-lib/glusterfs/3.0.5/xlator/protocol/client.la
-lib/glusterfs/3.0.5/xlator/protocol/server.la
-lib/glusterfs/3.0.5/xlator/storage/posix.la
-lib/glusterfs/3.0.5/xlator/testing/cluster/ha.la
-lib/glusterfs/3.0.5/xlator/testing/cluster/map.la
-lib/glusterfs/3.0.5/xlator/testing/features/filter.la
-lib/glusterfs/3.0.5/xlator/testing/features/path-converter.la
-lib/glusterfs/3.0.5/xlator/testing/features/trash.la
-lib/glusterfs/3.0.5/xlator/testing/performance/symlink-cache.la
+etc/glusterfs/glusterd.vol
+etc/glusterfs/xattr-init.sh
lib/libglusterfs.la
+lib/libgfrpc.la
+lib/libgfxdr.la
+lib/glusterfs/3.1.4/rpc-transport/socket.la
+lib/glusterfs/3.1.4/xlator/cluster/stripe.la
+lib/glusterfs/3.1.4/xlator/cluster/afr.la
+lib/glusterfs/3.1.4/xlator/cluster/pump.la
+lib/glusterfs/3.1.4/xlator/cluster/replicate.so
+lib/glusterfs/3.1.4/xlator/cluster/dht.la
+lib/glusterfs/3.1.4/xlator/cluster/nufa.la
+lib/glusterfs/3.1.4/xlator/cluster/switch.la
+lib/glusterfs/3.1.4/xlator/cluster/distribute.so
+lib/glusterfs/3.1.4/xlator/storage/posix.la
+lib/glusterfs/3.1.4/xlator/protocol/client.la
+lib/glusterfs/3.1.4/xlator/protocol/server.la
+lib/glusterfs/3.1.4/xlator/performance/write-behind.la
+lib/glusterfs/3.1.4/xlator/performance/read-ahead.la
+lib/glusterfs/3.1.4/xlator/performance/io-threads.la
+lib/glusterfs/3.1.4/xlator/performance/io-cache.la
+lib/glusterfs/3.1.4/xlator/performance/quick-read.la
+lib/glusterfs/3.1.4/xlator/performance/stat-prefetch.la
+lib/glusterfs/3.1.4/xlator/testing/performance/symlink-cache.la
+lib/glusterfs/3.1.4/xlator/testing/features/trash.la
+lib/glusterfs/3.1.4/xlator/debug/trace.la
+lib/glusterfs/3.1.4/xlator/debug/error-gen.la
+lib/glusterfs/3.1.4/xlator/debug/io-stats.la
+lib/glusterfs/3.1.4/xlator/features/locks.la
+lib/glusterfs/3.1.4/xlator/features/posix-locks.so
+lib/glusterfs/3.1.4/xlator/features/quota.la
+lib/glusterfs/3.1.4/xlator/features/read-only.la
+lib/glusterfs/3.1.4/xlator/features/access-control.la
+lib/glusterfs/3.1.4/xlator/features/mac-compat.la
+lib/glusterfs/3.1.4/xlator/features/quiesce.la
+lib/glusterfs/3.1.4/xlator/encryption/rot-13.la
+lib/glusterfs/3.1.4/xlator/mount/fuse.la
+lib/glusterfs/3.1.4/xlator/nfs/server.la
+lib/glusterfs/3.1.4/xlator/mgmt/glusterd.la
+lib/glusterfs/3.1.4/auth/addr.la
+lib/glusterfs/3.1.4/auth/login.la
man/man8/glusterfs.8
man/man8/mount.glusterfs.8
-sbin/glusterfs
+man/man8/gluster.8
+man/man8/glusterd.8
+man/man8/glusterfsd.8
sbin/glusterfsd
+sbin/glusterfs
+sbin/glusterd
+sbin/gluster
sbin/mount.glusterfs
-share/doc/glusterfs/benchmarking/README
-share/doc/glusterfs/benchmarking/glfs-bm.c
-share/doc/glusterfs/benchmarking/launch-script.sh
-share/doc/glusterfs/benchmarking/local-script.sh
-share/doc/glusterfs/benchmarking/rdd.c
share/doc/glusterfs/examples/README
-share/doc/glusterfs/examples/filter.vol
-share/doc/glusterfs/examples/io-cache.vol
-share/doc/glusterfs/examples/io-threads.vol
-share/doc/glusterfs/examples/posix-locks.vol
-share/doc/glusterfs/examples/protocol-client.vol
-share/doc/glusterfs/examples/protocol-server.vol
-share/doc/glusterfs/examples/read-ahead.vol
+share/doc/glusterfs/examples/unify.vol
share/doc/glusterfs/examples/replicate.vol
share/doc/glusterfs/examples/stripe.vol
-share/doc/glusterfs/examples/trace.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/unify.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
+share/doc/glusterfs/benchmarking/launch-script.sh
+share/doc/glusterfs/benchmarking/local-script.sh
share/doc/glusterfs/glusterfs-mode.el
share/doc/glusterfs/glusterfs.vim
-share/glusterfs/CreateBooster.py
-share/glusterfs/CreateVolfile.py
+share/examples/rc.d/glusterd
+share/examples/rc.d/glusterfsd
diff --git a/filesystems/glusterfs/distinfo b/filesystems/glusterfs/distinfo
index dd8b8526947..5e1a82c05a8 100644
--- a/filesystems/glusterfs/distinfo
+++ b/filesystems/glusterfs/distinfo
@@ -1,24 +1,25 @@
-$NetBSD: distinfo,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+$NetBSD: distinfo,v 1.2 2011/04/18 16:19:47 manu Exp $
-SHA1 (glusterfs-3.0.5.tar.gz) = 15ff9777cc23afa61f253bcbea2ebdd7a65ef82a
-RMD160 (glusterfs-3.0.5.tar.gz) = 2316dd43e7d4db98a8a619414cbe3d0546e678b4
-Size (glusterfs-3.0.5.tar.gz) = 1698376 bytes
-SHA1 (patch-aa) = 35e85637d0779d24a7c51cf2084c37d2abf57033
-SHA1 (patch-ab) = d929f88563f503323fb9f29e981cebe0deb6df34
+SHA1 (glusterfs-3.1.4.tar.gz) = 1166063b4a3fa25927b16c88025cc1186c73f420
+RMD160 (glusterfs-3.1.4.tar.gz) = dc7db013790dc2366f574e6e8a4fca6a67078cdc
+Size (glusterfs-3.1.4.tar.gz) = 2173373 bytes
+SHA1 (patch-aa) = b5d19e5ec8a1d9ca9d6e7e5e8e9e251638ac7127
+SHA1 (patch-ab) = c244841380b6f3bc55581a5e18fd3e22b94c9107
SHA1 (patch-ac) = f130a850238f3e0b1b7f906cc2b37242249ef9f2
-SHA1 (patch-ad) = 18860e03627d679a8a1f05f68b0688c82ddaea57
-SHA1 (patch-ae) = 0ec5cd1f251a016ba4f36093c6bdc5b17112ce06
-SHA1 (patch-af) = 7a19a965768cb923629cc50d4791e9934750078d
-SHA1 (patch-ag) = 8de8f242d6aca13b6a04b1affc6af6376877392d
-SHA1 (patch-an) = d76f131bca8e1f6b2d0cf00fec2f5390222811c0
-SHA1 (patch-ao) = 72198b13482bc0653b473ee98830bb05b44bd330
-SHA1 (patch-aq) = 57a25ef86a14c144553c3357fd69b9ab008f798e
-SHA1 (patch-ar) = 56217f95b689d6872d777fed2350366fdb3c3e66
-SHA1 (patch-as) = 3f303a80389b6ddf91e828836581af04d973c7f7
+SHA1 (patch-ae) = b4b12863b608c7aea043809059c586278b62dffc
+SHA1 (patch-af) = fe4494041804bc91a4985c25829e61abfe85eb87
+SHA1 (patch-ag) = ea16cbe55fbaea0989842fcefb61d35c0a6e8da4
+SHA1 (patch-an) = 0b7f67f3698c170e40f8d5e1cfc743eac1a84a97
+SHA1 (patch-ao) = 3368aa3e531ec128383a0b2c85d17cb8809458b3
+SHA1 (patch-ar) = 1ab07f9db7da9ed1cbf34f8285f1ea9be8f7366e
+SHA1 (patch-as) = b5d309e2678f07eb43e2017f47ba7d978dd74b73
SHA1 (patch-ax) = 89e42127b49d70cc0071c0ce32641d3cdf59fae9
-SHA1 (patch-ba) = f384e775bd99622790c7bceef22525e2d92a5519
-SHA1 (patch-bb) = 03afe977ab7b80332de4a1014bc7032a37b677ab
-SHA1 (patch-bc) = 2109d45002dea0cc9546135f333c93f5c2c17d19
-SHA1 (patch-bd) = 2a9b7492af964410f156fbe521b35b1d2ec46d84
-SHA1 (patch-be) = a0ff5c2a9f856055328925ac3cf227f7bcfdf3e2
-SHA1 (patch-bf) = 9ea8057d03de080b42da649ea66a892a07df8f6d
+SHA1 (patch-ba) = 23f0753c8f2b523a381cd2499078d13d01524185
+SHA1 (patch-bb) = 3d78df8c77764d2dfc6ba8447fc933918f55b2f2
+SHA1 (patch-bc) = 4bc72a9e5013a03b43f4d1e2ecbb6ed883786cff
+SHA1 (patch-be) = a8f1e059f1f9e6dfd070d647d9709bab01fdd1df
+SHA1 (patch-bf) = b04efbad0242d7258b9c84185f626ce6c9525f99
+SHA1 (patch-bg) = 559edf8b560a5054e2ee9791570b92992be18c56
+SHA1 (patch-bh) = 21a84a74e1ec114569b6fa4636a0f07b5a0bea16
+SHA1 (patch-bj) = ab35e4e3b70cac2fd6b4fe1df89ab5710e14ed59
+SHA1 (patch-bk) = 8c82f5896c2b4a10be496a627d13b9060ed21bc2
diff --git a/filesystems/glusterfs/files/glusterd.sh b/filesystems/glusterfs/files/glusterd.sh
new file mode 100755
index 00000000000..42a8811cde9
--- /dev/null
+++ b/filesystems/glusterfs/files/glusterd.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# $NetBSD: glusterd.sh,v 1.1 2011/04/18 16:19:48 manu Exp $
+#
+
+# PROVIDE: glusterd
+# REQUIRE: rpcbind
+# BEFORE: glusterfsd
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="glusterd"
+rcvar=$name
+command="@PREFIX@/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+required_files="@PREFIX@/etc/glusterfs/${name}.vol"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/filesystems/glusterfs/files/glusterfsd.sh b/filesystems/glusterfs/files/glusterfsd.sh
new file mode 100755
index 00000000000..8611895bdf4
--- /dev/null
+++ b/filesystems/glusterfs/files/glusterfsd.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# $NetBSD: glusterfsd.sh,v 1.1 2011/04/18 16:19:48 manu Exp $
+#
+
+# PROVIDE: glusterfsd
+# REQUIRE: rpcbind
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="glusterfsd"
+rcvar=$name
+command="@PREFIX@/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+required_files="@PREFIX@/etc/glusterfs/${name}.vol"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/filesystems/glusterfs/files/xattr-init.sh b/filesystems/glusterfs/files/xattr-init.sh
new file mode 100755
index 00000000000..7d9f479fe79
--- /dev/null
+++ b/filesystems/glusterfs/files/xattr-init.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# $NetBSD: xattr-init.sh,v 1.1 2011/04/18 16:19:48 manu Exp $
+
+GLUSTERFS_XATTR="
+ trusted.distribute.linkinfo
+ trusted.distribute.fix.layout
+ trusted.glusterfs.pathinfo
+ trusted.glusterfs.volume-mark
+ trusted.glusterfs.test
+ trusted.posix1.gen
+ trusted.gfid
+ trusted.afr
+"
+
+test $# -ne 1 && {
+ echo "usage: $0 /export/volume/path"
+ exit 1
+}
+
+VOLUME=$1
+
+test -d ${VOLUME} || {
+ echo "$0: ${VOLUME} is not a directory"
+ exit 1
+}
+
+extattrctl start ${VOLUME} || {
+ echo "$0: cannot start extended attributes on ${VOLUME}"
+ exit 1
+}
+
+mkdir -p ${VOLUME}/.attribute/user || {
+ echo "$0: cannot create ${VOLUME}/.attribute/user"
+ exit 1
+}
+
+for attr in ${GLUSTERFS_XATTR} ; do
+ attrfile=${VOLUME}/.attribute/user/${attr}
+
+ test -e ${attrfile} && {
+ echo "$0: ${attrfile} exists."
+ exit 1
+ }
+
+ extattrctl initattr 1024 ${attrfile} || {
+ echo "$0: cannot initialize ${attrfile}"
+ exit 1
+ }
+
+ extattrctl enable ${VOLUME} user ${attr} ${attrfile} || {
+ echo "$0: cannot enable ${attr} backed by ${attrfile}"
+ exit 1
+ }
+done
diff --git a/filesystems/glusterfs/patches/patch-aa b/filesystems/glusterfs/patches/patch-aa
index 1fa5c13929f..70ab4eae1a3 100644
--- a/filesystems/glusterfs/patches/patch-aa
+++ b/filesystems/glusterfs/patches/patch-aa
@@ -1,9 +1,9 @@
-$NetBSD: patch-aa,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+$NetBSD: patch-aa,v 1.2 2011/04/18 16:19:48 manu Exp $
The == operator is a non-standard bash extension. = should be used instead
---- xlators/mount/fuse/utils/mount_glusterfs.in.orig 2010-07-16 11:32:53.000000000 +0200
-+++ xlators/mount/fuse/utils/mount_glusterfs.in 2010-07-16 11:33:04.000000000 +0200
-@@ -166,9 +166,9 @@
+--- xlators/mount/fuse/utils/mount_glusterfs.in.orig 2011-04-13 10:19:20.000000000 +0200
++++ xlators/mount/fuse/utils/mount_glusterfs.in 2011-04-13 10:19:33.000000000 +0200
+@@ -164,9 +164,9 @@
}
# TODO: use getopt. This is very much darwin specific
diff --git a/filesystems/glusterfs/patches/patch-ab b/filesystems/glusterfs/patches/patch-ab
index 75bdc1a8e16..df18eb1688a 100644
--- a/filesystems/glusterfs/patches/patch-ab
+++ b/filesystems/glusterfs/patches/patch-ab
@@ -1,14 +1,15 @@
-$NetBSD: patch-ab,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+$NetBSD: patch-ab,v 1.2 2011/04/18 16:19:48 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.
---- libglusterfs/src/common-utils.c.orig 2010-07-16 11:38:26.000000000 +0200
-+++ libglusterfs/src/common-utils.c 2010-07-16 11:41:03.000000000 +0200
-@@ -45,8 +45,12 @@
- #include "revision.h"
+
+--- libglusterfs/src/common-utils.c.orig 2011-04-13 09:28:41.000000000 +0200
++++ libglusterfs/src/common-utils.c 2011-04-13 09:29:41.000000000 +0200
+@@ -47,8 +47,12 @@
#include "glusterfs.h"
#include "stack.h"
+ #include "globals.h"
+#ifndef AI_ADDRCONFIG
+#define AI_ADDRCONFIG 0
@@ -16,5 +17,21 @@ in volume server-tcp must be used to listen on an IPv4 address.
+
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);
- static glusterfs_ctx_t *gf_global_ctx;
+ struct dnscache6 {
+
+--- xlators/nfs/lib/src/rpc-socket.c.orig 2011-04-13 15:03:16.000000000 +0200
++++ xlators/nfs/lib/src/rpc-socket.c 2011-04-13 15:03:48.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,
diff --git a/filesystems/glusterfs/patches/patch-ad b/filesystems/glusterfs/patches/patch-ad
deleted file mode 100644
index 36c83a4309f..00000000000
--- a/filesystems/glusterfs/patches/patch-ad
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-ad,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
-
-Works around "error: 'EBADFD' undeclared" on NetBSD
---- xlators/protocol/server/src/server-resolve.c.orig 2010-07-16 11:54:50.000000000 +0200
-+++ xlators/protocol/server/src/server-resolve.c 2010-07-16 12:00:29.000000000 +0200
-@@ -23,9 +23,9 @@
- #endif
-
- #include "server-protocol.h"
- #include "server-helpers.h"
--
-+#include "compat-errno.h"
-
- int
- server_resolve_all (call_frame_t *frame);
- int
diff --git a/filesystems/glusterfs/patches/patch-ae b/filesystems/glusterfs/patches/patch-ae
index 21ffe63b945..fafe270db06 100644
--- a/filesystems/glusterfs/patches/patch-ae
+++ b/filesystems/glusterfs/patches/patch-ae
@@ -1,9 +1,9 @@
-$NetBSD: patch-ae,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+$NetBSD: patch-ae,v 1.2 2011/04/18 16:19:48 manu Exp $
On NetBSD use libperfuse(3), rename umount2(2) as unmount(2), and skip
-inexistant /etc/mtab management.
---- contrib/fuse-lib/mount.c.orig 2010-08-23 09:56:52.000000000 +0200
-+++ contrib/fuse-lib/mount.c 2010-08-23 10:29:03.000000000 +0200
+inexistant /etc/mtab management.
+--- contrib/fuse-lib/mount.c.orig 2011-04-09 10:09:02.000000000 +0200
++++ contrib/fuse-lib/mount.c 2011-04-13 14:36:53.000000000 +0200
@@ -19,16 +19,23 @@
#include <limits.h>
#include <fcntl.h>
@@ -11,7 +11,7 @@ inexistant /etc/mtab management.
#include <dirent.h>
+#ifndef __NetBSD__
#include <mntent.h>
-+#endif
++#endif /* __NetBSD__ */
#include <sys/stat.h>
#include <sys/poll.h>
#include <sys/socket.h>
@@ -45,7 +45,7 @@ inexistant /etc/mtab management.
}
+#else /* __NetBSD__ */
+#define mtab_needs_update(x) 1
-+#endif
++#endif /* __NetBSD__ */
#ifndef FUSE_UTIL
static
diff --git a/filesystems/glusterfs/patches/patch-af b/filesystems/glusterfs/patches/patch-af
index cc60cb2d894..dd86dddff3f 100644
--- a/filesystems/glusterfs/patches/patch-af
+++ b/filesystems/glusterfs/patches/patch-af
@@ -1,16 +1,16 @@
-$NetBSD: patch-af,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+$NetBSD: patch-af,v 1.2 2011/04/18 16:19:48 manu Exp $
Works around "error: 'TCP_KEEPALIVE' undeclared" on NetBSD
---- transport/socket/src/socket.c.orig 2010-07-16 12:18:27.000000000 +0200
-+++ transport/socket/src/socket.c 2010-07-16 12:19:46.000000000 +0200
-@@ -258,9 +258,9 @@
+--- rpc/rpc-transport/socket/src/socket.c.orig 2011-04-13 09:38:31.000000000 +0200
++++ rpc/rpc-transport/socket/src/socket.c 2011-04-13 09:38:31.000000000 +0200
+@@ -374,9 +374,9 @@
if (keepalive_intvl == GF_USE_DEFAULT_KEEPALIVE)
goto done;
-#ifndef GF_LINUX_HOST_OS
+#if !defined(GF_LINUX_HOST_OS) && !defined(__NetBSD__)
- ret = setsockopt (fd, IPPROTO_TCP, TCP_KEEPALIVE, &keepalive_intvl,
+ #ifdef GF_SOLARIS_HOST_OS
+ ret = setsockopt (fd, SOL_SOCKET, SO_KEEPALIVE, &keepalive_intvl,
sizeof (keepalive_intvl));
- if (ret == -1)
- goto err;
+ #else
diff --git a/filesystems/glusterfs/patches/patch-ag b/filesystems/glusterfs/patches/patch-ag
index 5e81d4a0174..1e599dbdf17 100644
--- a/filesystems/glusterfs/patches/patch-ag
+++ b/filesystems/glusterfs/patches/patch-ag
@@ -1,20 +1,20 @@
-$NetBSD: patch-ag,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+$NetBSD: patch-ag,v 1.2 2011/04/18 16:19:48 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.
---- transport/socket/src/name.c.orig 2010-07-16 12:20:28.000000000 +0200
-+++ transport/socket/src/name.c 2010-07-16 12:20:59.000000000 +0200
-@@ -33,8 +33,12 @@
- #ifndef AF_INET_SDP
- #define AF_INET_SDP 27
+--- rpc/rpc-lib/src/rpc-transport.h.orig 2011-04-13 09:44:53.000000000 +0200
++++ rpc/rpc-lib/src/rpc-transport.h 2011-04-13 09:45:08.000000000 +0200
+@@ -39,8 +39,12 @@
+ #ifndef MAX_IOVEC
+ #define MAX_IOVEC 16
#endif
+#ifndef AI_ADDRCONFIG
+#define AI_ADDRCONFIG 0
+#endif /* AI_ADDRCONFIG */
+
- static int gf_name_addr_enotspec_log;
-
- #include "transport.h"
- #include "socket.h"
+ /* 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
diff --git a/filesystems/glusterfs/patches/patch-an b/filesystems/glusterfs/patches/patch-an
index 60bd292eb57..73e28b02fda 100644
--- a/filesystems/glusterfs/patches/patch-an
+++ b/filesystems/glusterfs/patches/patch-an
@@ -1,27 +1,35 @@
-$NetBSD: patch-an,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+$NetBSD: patch-an,v 1.2 2011/04/18 16:19:48 manu Exp $
NetBSD uses libperfuse(3). Also enable debugging (-g) for now.
---- configure.ac.orig 2010-08-23 15:31:49.000000000 +0200
-+++ configure.ac 2010-08-23 16:39:32.000000000 +0200
-@@ -378,8 +378,21 @@
- GF_BOOSTER_SUBDIR=""
+--- configure.ac.orig 2011-04-09 10:09:04.000000000 +0200
++++ configure.ac 2011-04-13 14:40:11.000000000 +0200
+@@ -409,8 +409,19 @@
+ GF_GLUSTERFS_LDFLAGS="-lnsl -lresolv -lsocket"
BUILD_FUSE_CLIENT=no
FUSE_CLIENT_SUBDIR=""
;;
+ *netbsd*)
-+ GF_HOST_OS="GF_BSD_HOST_OS"
++ GF_HOST_OS="GF_BSD_HOST_OS"
+ GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}"
+ 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
++ fi
+ GF_FUSE_LDADD="-liconv -lperfuse"
-+ BUILD_LIBGLUSTERFSCLIENT=no
-+ LIBGLUSTERFSCLIENT_SUBDIR=""
-+ GF_BOOSTER_SUBDIR=""
++ BUILD_FUSE_CLIENT=no
+ ;;
*bsd*)
GF_HOST_OS="GF_BSD_HOST_OS"
- GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}"
+ GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -O0"
GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
+@@ -445,8 +456,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)
+
+ CONTRIBDIR='$(top_srcdir)/contrib'
diff --git a/filesystems/glusterfs/patches/patch-ao b/filesystems/glusterfs/patches/patch-ao
index 53f4598b91c..f27bcc3fd94 100644
--- a/filesystems/glusterfs/patches/patch-ao
+++ b/filesystems/glusterfs/patches/patch-ao
@@ -1,27 +1,35 @@
-$NetBSD: patch-ao,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+$NetBSD: patch-ao,v 1.2 2011/04/18 16:19:48 manu Exp $
NetBSD uses libperfuse(3). Also enable debugging (-g) for now.
---- configure.orig 2010-08-23 15:32:00.000000000 +0200
-+++ configure 2010-08-23 16:39:44.000000000 +0200
-@@ -13828,8 +13828,21 @@
- GF_BOOSTER_SUBDIR=""
+--- configure.orig 2011-04-09 10:09:09.000000000 +0200
++++ configure 2011-04-13 14:40:44.000000000 +0200
+@@ -21732,8 +21732,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} -g"
-+ GF_GLUSTERFS_CFLAGS="${GF_CFLAGS} -g"
++ GF_HOST_OS="GF_BSD_HOST_OS"
++ GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}"
++ 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_LIBGLUSTERFSCLIENT=no
-+ LIBGLUSTERFSCLIENT_SUBDIR=""
-+ GF_BOOSTER_SUBDIR=""
++ BUILD_FUSE_CLIENT=no
+ ;;
*bsd*)
GF_HOST_OS="GF_BSD_HOST_OS"
- GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}"
+ GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -O0"
GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
+@@ -22849,8 +22860,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,@CONTRIBDIR@,$CONTRIBDIR,;t t
+ s,@INCLUDES@,$INCLUDES,;t t
diff --git a/filesystems/glusterfs/patches/patch-aq b/filesystems/glusterfs/patches/patch-aq
deleted file mode 100644
index e9018fa5698..00000000000
--- a/filesystems/glusterfs/patches/patch-aq
+++ /dev/null
@@ -1,42 +0,0 @@
-$NetBSD: patch-aq,v 1.1.1.1 2010/08/26 14:26:19 manu Exp $
-
-Emulate missing sem_timedwait(3) on NetBSD
---- xlators/performance/io-threads/src/io-threads.c.orig 2010-08-23 17:49:40.000000000 +0200
-+++ xlators/performance/io-threads/src/io-threads.c 2010-08-23 18:43:35.000000000 +0200
-@@ -32,8 +32,36 @@
- #include <sys/time.h>
- #include <time.h>
- #include "locking.h"
-
-+#ifdef __NetBSD__
-+static inline int sem_timedwait(sem_t *sem, struct timespec *ts) {
-+ struct timespec onems = { 0, 1000000 };
-+ struct timespec total = { 0, 0 };
-+ struct timespec unslept;
-+ struct timespec elapsed;
-+ struct timespec tmp;
-+
-+ while (timespeccmp(ts, &total, >)) {
-+ if (sem_trywait(sem) == 0)
-+ return 0;
-+
-+ if (errno != EAGAIN)
-+ return -1;
-+
-+ (void)nanosleep(&onems, &unslept);
-+
-+ timespecsub(&onems, &unslept, &elapsed);
-+ timespecadd(&total, &elapsed, &tmp);
-+ total.tv_sec = tmp.tv_sec;
-+ total.tv_nsec = tmp.tv_nsec;
-+ }
-+
-+ errno = ETIMEDOUT;
-+ return -1;
-+}
-+#endif /* __NetBSD__ */
-+
- typedef void *(*iot_worker_fn)(void*);
-
- void
- iot_stop_worker (iot_worker_t *worker);
diff --git a/filesystems/glusterfs/patches/patch-ar b/filesystems/glusterfs/patches/patch-ar
index 3fb24c67e0c..e4da8d88820 100644
--- a/filesystems/glusterfs/patches/patch-ar
+++ b/filesystems/glusterfs/patches/patch-ar
@@ -1,17 +1,16 @@
-$NetBSD: patch-ar,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+$NetBSD: patch-ar,v 1.2 2011/04/18 16:19:48 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 2010-08-23 15:57:10.000000000 +0200
-+++ xlators/mount/fuse/src/Makefile.am 2010-08-23 16:38:50.000000000 +0200
-@@ -5,9 +5,9 @@
- xlator_LTLIBRARIES = fuse.la
- xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/mount
- fuse_la_SOURCES = fuse-bridge.c $(CONTRIBDIR)/fuse-lib/misc.c \
- $(CONTRIBDIR)/fuse-lib/mount.c
--fuse_la_LDFLAGS = -module -avoidversion -shared -nostartfiles
+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-04-13 09:55:12.000000000 +0200
++++ xlators/mount/fuse/src/Makefile.am 2011-04-13 09:56:14.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) -DFUSERMOUNT_DIR=\"$(bindir)\"
+ -I$(top_srcdir)/glusterfsd/src $(GF_CFLAGS) $(GF_FUSE_CFLAGS)
diff --git a/filesystems/glusterfs/patches/patch-as b/filesystems/glusterfs/patches/patch-as
index a792ff8045e..8faecff78bd 100644
--- a/filesystems/glusterfs/patches/patch-as
+++ b/filesystems/glusterfs/patches/patch-as
@@ -1,17 +1,17 @@
-$NetBSD: patch-as,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+$NetBSD: patch-as,v 1.2 2011/04/18 16:19:48 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 2010-08-23 15:57:15.000000000 +0200
-+++ xlators/mount/fuse/src/Makefile.in 2010-08-23 16:39:14.000000000 +0200
+--- xlators/mount/fuse/src/Makefile.in.orig 2011-04-13 09:57:06.000000000 +0200
++++ xlators/mount/fuse/src/Makefile.in 2011-04-13 09:57:24.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_OBJECTS = fuse-bridge.lo misc.lo mount.lo
- fuse_la_OBJECTS = $(am_fuse_la_OBJECTS)
- DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
- depcomp = $(SHELL) $(top_srcdir)/depcomp
++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-ba b/filesystems/glusterfs/patches/patch-ba
index 1c86bea106b..3d4c7dea4a5 100644
--- a/filesystems/glusterfs/patches/patch-ba
+++ b/filesystems/glusterfs/patches/patch-ba
@@ -1,34 +1,34 @@
-$NetBSD: patch-ba,v 1.1.1.1 2010/08/26 14:26:19 manu Exp $
+$NetBSD: patch-ba,v 1.2 2011/04/18 16:19:48 manu Exp $
glibc dirname() modify the string it is given and returns it.
glusterfs takes this behavior for granted, and assume that if it
-gives a malloc'ed string to dirname(), then it can free()) the
+gives a malloc'ed string to dirname(), then it can free()) the
return value.
Here is what SUSv2 says:
http://opengroup.org/onlinepubs/007908799/xsh/dirname.html
-"The dirname() function may modify the string pointed to by path,
+"The dirname() function may modify the string pointed to by path,
and may return a pointer to static storage"
-At least NetBSD returns a static storage. glusterfs will return it to
+At least NetBSD returns a static storage. glusterfs will return it to
a calling function that has the responsability to free it, causing
a SIGSEGV.
---- ./xlators/performance/stat-prefetch/src/stat-prefetch.c.orig 2010-08-24 14:06:54.000000000 +0200
-+++ ./xlators/performance/stat-prefetch/src/stat-prefetch.c 2010-08-24 14:20:10.000000000 +0200
-@@ -815,18 +815,25 @@
+--- ./xlators/performance/stat-prefetch/src/stat-prefetch.c.orig 2011-04-13 09:59:38.000000000 +0200
++++ ./xlators/performance/stat-prefetch/src/stat-prefetch.c 2011-04-13 10:01:01.000000000 +0200
+@@ -905,18 +905,24 @@
path = dirname (cpy);
switch (i)
{
case 0:
- *parent = path;
-+ *parent = strdup(path);
++ *parent = gf_strdup (path);
+ if (*parent == NULL)
+ goto out;
break;
case 1:
- *grand_parent = path;
-+ *grand_parent = strdup(path);
++ *grand_parent = gf_strdup (path);
+ if (*grand_parent == NULL)
+ goto out;
break;
@@ -38,8 +38,7 @@ a SIGSEGV.
ret = 0;
out:
+ if (cpy != NULL)
-+ free(cpy);
-+
++ GF_FREE(cpy);
return ret;
}
diff --git a/filesystems/glusterfs/patches/patch-bb b/filesystems/glusterfs/patches/patch-bb
index d9c4689d961..71ae5071ea7 100644
--- a/filesystems/glusterfs/patches/patch-bb
+++ b/filesystems/glusterfs/patches/patch-bb
@@ -1,12 +1,11 @@
-$NetBSD: patch-bb,v 1.1.1.1 2010/08/26 14:26:19 manu Exp $
+$NetBSD: patch-bb,v 1.2 2011/04/18 16:19:48 manu Exp $
On NetBSD and FreeBSD, O_DIRECTORY does not exists and is defined as 0
by glusterfs. ((flags & O_DIRECTORY) == O_DIRECTORY) always evaluate
to true, and this is a bug.
-
---- ./xlators/performance/quick-read/src/quick-read.c.orig 2010-08-24 17:31:30.000000000 +0200
-+++ ./xlators/performance/quick-read/src/quick-read.c 2010-08-24 17:32:13.000000000 +0200
-@@ -642,9 +642,9 @@
+--- ./xlators/performance/quick-read/src/quick-read.c.orig 2011-04-13 10:02:38.000000000 +0200
++++ ./xlators/performance/quick-read/src/quick-read.c 2011-04-13 10:03:23.000000000 +0200
+@@ -637,9 +637,9 @@
}
}
UNLOCK (&table->lock);
diff --git a/filesystems/glusterfs/patches/patch-bc b/filesystems/glusterfs/patches/patch-bc
index e93491e5a65..fbac1f39d13 100644
--- a/filesystems/glusterfs/patches/patch-bc
+++ b/filesystems/glusterfs/patches/patch-bc
@@ -1,5 +1,5 @@
-$NetBSD: patch-bc,v 1.1.1.1 2010/08/26 14:26:19 manu Exp $
-
+$NetBSD: patch-bc,v 1.2 2011/04/18 16:19:48 manu Exp $
+
glibc dirname() modify the string it is given and returns it.
glusterfs takes this behavior for granted, and assume that if it
gives a malloc'ed string to dirname(), then it can free()) the
@@ -9,13 +9,13 @@ Here is what SUSv2 says:
http://opengroup.org/onlinepubs/007908799/xsh/dirname.html
"The dirname() function may modify the string pointed to by path,
and may return a pointer to static storage"
-
+
At least NetBSD returns a static storage. glusterfs will return it to
a calling function that has the responsability to free it, causing
a SIGSEGV.
---- ./xlators/performance/quick-read/src/quick-read.c.orig 2010-08-24 18:01:15.000000000 +0200
-+++ ./xlators/performance/quick-read/src/quick-read.c 2010-08-24 18:04:22.000000000 +0200
+--- xlators/performance/quick-read/src/quick-read.c.orig 2011-04-13 10:04:09.000000000 +0200
++++ xlators/performance/quick-read/src/quick-read.c 2011-04-13 10:05:35.000000000 +0200
@@ -80,8 +80,9 @@
qr_loc_fill (loc_t *loc, inode_t *inode, char *path)
{
@@ -23,17 +23,17 @@ a SIGSEGV.
char *parent = NULL;
+ char *path_copy = NULL;
- if ((loc == NULL) || (inode == NULL) || (path == NULL)) {
+ if ((loc == NULL) || (inode == NULL) || (path == NULL)
+ || (inode->table == NULL)) {
ret = -1;
- errno = EINVAL;
-@@ -91,15 +92,15 @@
+@@ -92,15 +93,15 @@
loc->inode = inode_ref (inode);
- loc->path = strdup (path);
+ loc->path = gf_strdup (path);
loc->ino = inode->ino;
-- parent = strdup (path);
+- parent = gf_strdup (path);
- if (parent == NULL) {
-+ path_copy = strdup (path);
++ path_copy = gf_strdup (path);
+ if (path_copy == NULL) {
ret = -1;
goto out;
@@ -51,10 +51,10 @@ a SIGSEGV.
}
- if (parent) {
-- FREE (parent);
+- GF_FREE (parent);
+ if (path_copy) {
-+ FREE (path_copy);
++ GF_FREE (path_copy);
}
-
+
return ret;
}
diff --git a/filesystems/glusterfs/patches/patch-bd b/filesystems/glusterfs/patches/patch-bd
deleted file mode 100644
index aed29d6aba6..00000000000
--- a/filesystems/glusterfs/patches/patch-bd
+++ /dev/null
@@ -1,60 +0,0 @@
-$NetBSD: patch-bd,v 1.1.1.1 2010/08/26 14:26:19 manu Exp $
-
-glibc dirname() modify the string it is given and returns it.
-glusterfs takes this behavior for granted, and assume that if it
-gives a malloc'ed string to dirname(), then it can free()) the
-return value.
-
-Here is what SUSv2 says:
-http://opengroup.org/onlinepubs/007908799/xsh/dirname.html
-"The dirname() function may modify the string pointed to by path,
-and may return a pointer to static storage"
-
-At least NetBSD returns a static storage. glusterfs will return it to
-a calling function that has the responsability to free it, causing
-a SIGSEGV.
-
---- libglusterfsclient/src/libglusterfsclient-dentry.c.orig 2010-08-24 18:36:08.000000000 +0200
-+++ libglusterfsclient/src/libglusterfsclient-dentry.c 2010-08-24 18:41:09.000000000 +0200
-@@ -231,8 +231,9 @@
- char lookup_basename)
- {
- int32_t op_ret = -1;
- char *resolved = NULL;
-+ char *restmp = NULL;
- inode_t *parent = NULL, *inode = NULL;
- dentry_t *dentry = NULL;
- loc_t new_loc = {0, };
- char *pathname = NULL, *directory = NULL;
-@@ -244,10 +245,10 @@
- gf_log ("libglusterfsclient-dentry", GF_LOG_DEBUG,
- "loc->parent(%"PRId64") already present. sending "
- "lookup for %"PRId64"/%s", parent->ino, parent->ino,
- loc->path);
-- resolved = strdup (loc->path);
-- resolved = dirname (resolved);
-+ restmp = strdup (loc->path);
-+ resolved = dirname (restmp);
- } else {
- parent = __libgf_client_path_to_parenti (ctx, ctx->itable,
- loc->path, &resolved);
- }
-@@ -342,17 +343,13 @@
- out:
- loc->inode = inode;
- loc->parent = parent;
-
-- FREE (resolved);
-+ FREE (restmp);
- if (pathname) {
- FREE (pathname);
- }
-
-- if (directory) {
-- FREE (directory);
-- }
--
- return op_ret;
- }
-
-
diff --git a/filesystems/glusterfs/patches/patch-be b/filesystems/glusterfs/patches/patch-be
index 8e2e4fe26e7..4af8e8c06ef 100644
--- a/filesystems/glusterfs/patches/patch-be
+++ b/filesystems/glusterfs/patches/patch-be
@@ -1,12 +1,14 @@
-$NetBSD: patch-be,v 1.1.1.1 2010/08/26 14:26:19 manu Exp $
+$NetBSD: patch-be,v 1.2 2011/04/18 16:19:48 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 2010-08-25 03:58:44.000000000 +0200
-+++ libglusterfs/src/compat.c 2010-08-25 10:42:37.000000000 +0200
-@@ -509,4 +509,230 @@
+Also map Linux extended attribute system calls to NetBSD counterpart
+
+--- libglusterfs/src/compat.c.orig 2011-04-09 10:09:02.000000000 +0200
++++ libglusterfs/src/compat.c 2011-04-14 10:36:40.000000000 +0200
+@@ -547,4 +547,282 @@
len++;
return len;
}
@@ -15,8 +17,8 @@ Borrow basename() and rdirname() form glibc and make NetBSD use them.
+#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,
++ * 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.
@@ -236,4 +238,56 @@ Borrow basename() and rdirname() form glibc and make NetBSD use them.
+
+ return path;
+}
++
++/*
++ * Extended attribute API for NetBSD
++ */
++int
++removexattr(const char *path, const char *key)
++{ return extattr_delete_file(path, EXTATTR_NAMESPACE_USER, key); }
++
++ssize_t
++listxattr(const char *path, void *value, size_t size)
++{ return extattr_list_file(path, EXTATTR_NAMESPACE_USER, value, size); }
++
++ssize_t
++getxattr(const char *path, const char *key, void *value, size_t size)
++{ return extattr_get_file(path, EXTATTR_NAMESPACE_USER, key, value, size); }
++
++int
++setxattr(const char *path, const char *key, const void *value, size_t size)
++{ return extattr_set_file(path, EXTATTR_NAMESPACE_USER, key, value, size); }
++
++int
++fremovexattr(int fd, const char *key)
++{ return extattr_delete_fd(fd, EXTATTR_NAMESPACE_USER, key); }
++
++ssize_t
++flistxattr(int fd, void *value, size_t size)
++{ return extattr_list_fd(fd, EXTATTR_NAMESPACE_USER, value, size); }
++
++ssize_t
++fgetxattr(int fd, const char *key, void *value, size_t size)
++{ return extattr_get_fd(fd, EXTATTR_NAMESPACE_USER, key, value, size); }
++
++int
++fsetxattr(int fd, const char *key, const void *value, size_t size)
++{ return extattr_set_fd(fd, EXTATTR_NAMESPACE_USER, key, value, size); }
++
++int
++lremovexattr(const char *path, const char *key)
++{ return extattr_delete_link(path, EXTATTR_NAMESPACE_USER, key); }
++
++ssize_t
++llistxattr(const char *path, void *value, size_t size)
++{ return extattr_list_link(path, EXTATTR_NAMESPACE_USER, value, size); }
++
++ssize_t
++lgetxattr(const char *path, const char *key, void *value, size_t size)
++{ return extattr_get_link(path, EXTATTR_NAMESPACE_USER, key, value, size); }
++
++int
++lsetxattr(const char *path, const char *key, const void *value, size_t size)
++{ return extattr_set_link(path, EXTATTR_NAMESPACE_USER, key, value, size); }
++
+#endif /* __NetBSD__ */
diff --git a/filesystems/glusterfs/patches/patch-bf b/filesystems/glusterfs/patches/patch-bf
index 62cfab0c738..c650fa879e9 100644
--- a/filesystems/glusterfs/patches/patch-bf
+++ b/filesystems/glusterfs/patches/patch-bf
@@ -1,11 +1,11 @@
-$NetBSD: patch-bf,v 1.1.1.1 2010/08/26 14:26:19 manu Exp $
+$NetBSD: patch-bf,v 1.2 2011/04/18 16:19:48 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 2010-08-25 10:18:27.000000000 +0200
-+++ libglusterfs/src/compat.h 2010-08-25 10:23:19.000000000 +0200
+--- libglusterfs/src/compat.h.orig 2011-04-09 10:09:02.000000000 +0200
++++ libglusterfs/src/compat.h 2011-04-14 15:27:54.000000000 +0200
@@ -57,9 +57,9 @@
#endif /* HAVE_LLISTXATTR */
#endif /* GF_LINUX_HOST_OS */
@@ -17,12 +17,15 @@ Borrow basename() and rdirname() form glibc and make NetBSD use them.
#define UNIX_PATH_MAX 104
#include <sys/types.h>
-@@ -110,8 +110,12 @@
+@@ -110,8 +110,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__ */
diff --git a/filesystems/glusterfs/patches/patch-bg b/filesystems/glusterfs/patches/patch-bg
new file mode 100644
index 00000000000..a10bae0c8f8
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-bg
@@ -0,0 +1,15 @@
+$NetBSD: patch-bg,v 1.1 2011/04/18 16:19:48 manu Exp $
+GCC does not have to be being with 64 bit mode.
+--- argp-standalone/configure.orig 2011-04-13 10:27:45.000000000 +0200
++++ argp-standalone/configure 2011-04-13 10:27:52.000000000 +0200
+@@ -6114,9 +6114,9 @@
+ true
+ else
+ CFLAGS="$CFLAGS -ggdb3"
+ fi
+- CFLAGS="$CFLAGS -m64 -Wall -W \
++ CFLAGS="$CFLAGS -Wall -W \
+ -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes \
+ -Waggregate-return \
+ -Wpointer-arith -Wbad-function-cast -Wnested-externs"
+ fi
diff --git a/filesystems/glusterfs/patches/patch-bh b/filesystems/glusterfs/patches/patch-bh
new file mode 100644
index 00000000000..19471cc6356
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-bh
@@ -0,0 +1,38 @@
+$NetBSD: patch-bh,v 1.1 2011/04/18 16:19:48 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-04-13 10:41:50.000000000 +0200
++++ rpc/rpc-lib/src/xdr-common.h 2011-04-13 10:47:57.000000000 +0200
+@@ -29,8 +29,12 @@
+ #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 +50,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
new file mode 100644
index 00000000000..945ab021db4
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-bj
@@ -0,0 +1,15 @@
+$NetBSD: patch-bj,v 1.1 2011/04/18 16:19:48 manu Exp $
+Make sure NetBSD pulls proper FUSE header
+--- xlators/mount/fuse/src/fuse-bridge.h.orig 2011-04-13 14:32:26.000000000 +0200
++++ xlators/mount/fuse/src/fuse-bridge.h 2011-04-13 14:32:27.000000000 +0200
+@@ -58,9 +58,9 @@
+
+ /* TODO: when supporting posix acl, remove this definition */
+ #define DISABLE_POSIX_ACL
+
+-#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
new file mode 100644
index 00000000000..15b662d3f30
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-bk
@@ -0,0 +1,223 @@
+$NetBSD: patch-bk,v 1.1 2011/04/18 16:19:48 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/Makefile.am.orig 2011-04-09 10:09:02.000000000 +0200
++++ rpc/rpc-lib/src/Makefile.am 2011-04-13 15:34:52.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-transport.c xdr-rpc.c xdr-rpcclnt.c xdr-sizeof.c \
++ rpc-clnt.c auth-glusterfs.c rpc-common.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
+--- rpc/rpc-lib/src/Makefile.in.orig 2011-04-09 10:09:13.000000000 +0200
++++ rpc/rpc-lib/src/Makefile.in 2011-04-13 15:34:52.000000000 +0200
+@@ -58,10 +58,10 @@
+ LTLIBRARIES = $(lib_LTLIBRARIES)
+ 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
++ auth-null.lo rpc-transport.lo xdr-rpc.lo xdr-sizeof.lo \
++ xdr-rpcclnt.lo rpc-clnt.lo auth-glusterfs.lo rpc-common.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
+@@ -221,10 +221,10 @@
+ sysconfdir = @sysconfdir@
+ 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-transport.c xdr-rpc.c xdr-rpcclnt.c xdr-sizeof.c \
++ rpc-clnt.c auth-glusterfs.c rpc-common.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
+@@ -313,8 +313,9 @@
+ @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@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdr-rpcclnt.Plo@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdr-sizeof.Plo@am__quote@
+
+ .c.o:
+ @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+--- rpc/rpc-lib/src/xdr-sizeof.c.orig 2011-04-13 15:34:52.000000000 +0200
++++ rpc/rpc-lib/src/xdr-sizeof.c 2011-04-13 15:46:04.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__ */