summaryrefslogtreecommitdiff
path: root/sys-fs/fuse4bsd
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-fs/fuse4bsd
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-fs/fuse4bsd')
-rw-r--r--sys-fs/fuse4bsd/Manifest13
-rw-r--r--sys-fs/fuse4bsd/files/fuse4bsd-0.3.0-gcc4.patch12
-rw-r--r--sys-fs/fuse4bsd/files/fuse4bsd-0.3.0-ports.patch491
-rw-r--r--sys-fs/fuse4bsd/files/fuse4bsd-0.3.9_pre1-fbsd91.patch15
-rw-r--r--sys-fs/fuse4bsd/files/fuse4bsd-0.3.9_pre1-ports.patch475
-rw-r--r--sys-fs/fuse4bsd/fuse4bsd-0.3.0.ebuild50
-rw-r--r--sys-fs/fuse4bsd/fuse4bsd-0.3.9_pre1.ebuild71
-rw-r--r--sys-fs/fuse4bsd/metadata.xml8
8 files changed, 1135 insertions, 0 deletions
diff --git a/sys-fs/fuse4bsd/Manifest b/sys-fs/fuse4bsd/Manifest
new file mode 100644
index 000000000000..55b4bdf942ca
--- /dev/null
+++ b/sys-fs/fuse4bsd/Manifest
@@ -0,0 +1,13 @@
+AUX fuse4bsd-0.3.0-gcc4.patch 432 SHA256 ea81c1d6aaba492a4bf5cecae0929d85ac427e30aebacb19b72ed1a380baa21b SHA512 edbd1ac4b7fc4ad81f6787edbe2d5202d3566f5b05c996bf65ab0bf97f69ce99fe14d42707c3a2852ac967082a3cfbf2688d4377b67221240b7d2af0f345b2fc WHIRLPOOL 44a8506824d4833596b67db75e2fe4fada19a36583ad6771094e5325fa5bc5fc8062859bf7e7a9ae7b68fe00723984c44f6201aece022213af1a327080d718b6
+AUX fuse4bsd-0.3.0-ports.patch 13090 SHA256 51a11321b4a792ca8e6127d1ab0982ffed32b1dcaa1c26102254c1aa61ba4278 SHA512 aae25a811ff987aa6beebccf72bda7309552ffa08402d0ae2d1c06c40f5b689d00ee4702cbff0cfcf874d43dadddc94cd088444645fef87bc59a91ac66f680cc WHIRLPOOL ad23409a5c23614773d8df6b68142da55ebc063ab037ee9be0cd998f19fbd6d8a9f10899f0c88754d92b58fca57bcd562684dd4e793dd357f2e1029a8fb2337f
+AUX fuse4bsd-0.3.9_pre1-fbsd91.patch 508 SHA256 2ff41ec6b99b9309288b927d686dac234d5a6c1d0f40724522d00d46bc27ac9c SHA512 9a02ef10ffc1134470a807c7d475c56ac7139835593e06c66a2ed182f39e7488468035ae940a6ef0551e6d888689969d5838733e0fcd398fc524e1de9fd1e8b3 WHIRLPOOL ae427655a4fa0a8996cc597c249f919db75a3631ab5f2a3180aebb3e229eaced4fe80a6d8b70bd6ebd5fc75989214f21ad4f1ddf180fd8f7cba657cb736fc150
+AUX fuse4bsd-0.3.9_pre1-ports.patch 12209 SHA256 2af30fcec3f7ea2a99e549768ac133138c628111e26fb39d8a201b4fdf19ffff SHA512 0d149e517bfa2b0260e86bda7f1d3f06c6328dd1803f72a1e823e91bb596e5f0a0bcf4fd00a70f574935eb96c515049001d8e7c42bc0893d81fb2e371fcef67c WHIRLPOOL bdc8d8ff082a0882d0cce62675d9cbeec0af80fff370466a90f510027bfc9219e4307b9c11c676769f2b86da1f9f770a31ed2eb8bfb9626c0366e78e3bb8f7a8
+DIST 498acaef33b0.tar.gz 116035 SHA256 3fff52dc292f481b4c51cad3e9cf5f8982e38a25e809ee986e8406c81aff0119 SHA512 6427d888cea5b1519c4ae92ec8ec640535692c59dd8ca987a32574050239c9ff4cb92a4cf6b34f3c1363becdd9fd75c031f5db4bda34b298898466066740845a WHIRLPOOL 4f78cb0228a73e76e15e6d85c2db94e1eaf75eb10507e533bb51c4a52092fc9c881187f10aca12bc89b791058790f9a84e139698e0e64ee602fe5efb3c03b82a
+DIST freebsd-sbin-6.2.tar.bz2 1162548 SHA256 aef424c07686bb72fbd06e4fd66a01b00bd36b70fec02ebdc228061cd4b435dd SHA512 db46b03f324713ea03d38f453426b2b8d683e64e0b8bec7de70332a62855f5d3b81169c8bad37d8f3d2a35edf191165894e9e450200d9795d2c03d7675d17329 WHIRLPOOL 28bb471713f74f078170fc12f6b69e15628a6528e6a87b4426da70e72106a0f4ae787f0275bb4741667992caa963354cf50f25fe8d5bf7d83c713e65a4c41378
+DIST freebsd-sbin-9.1.tar.bz2 1273913 SHA256 45008b0733b232ef03707ef5fa3e5c889e3b3728393d736bd9a869ea83be6447 SHA512 9f186602b7de96f268c352ca386986652fddf5570e7eca1afa8c0d2bdc83b57df1198efe47f36dd5c7a6abf4f9c935f1c8207a4a12a6b2153bd6c3c6292719dc WHIRLPOOL 20920dfa9607a0ce854319cef29bbd77fb1b31f6f6cfd5ac60cbd678169e43929e215743fe636d0c224443f3e6149a8f07c292d647f7f901592795ac292699f9
+DIST fuse4bsd-0.3.0.tar.gz 168068 SHA256 5ed1d9b0542d6962c135f6f2e8d296ab3feb51f239954cc6acc50833318854fe SHA512 1e65150ed5aa798e92007c95b4588f1d8c19e04ce7433d28ccdbc1b1492e319e0108641b41d7d6846494da6af4473d5d76ff81f4068b3dfda9d1463d8d995d3e WHIRLPOOL bbbf76abfea9b4b38e0d4723f6109f52d4f15212cedec4a978433978d14afe35f7ee214414c54ee6493a8f5f54afc7de377a86740f93154cc37bd654234bb2a0
+EBUILD fuse4bsd-0.3.0.ebuild 1308 SHA256 e9bb1adcfab2e899d41b7ee5ba54230668a4a95ecbc3d8a7df6da8bb981247d3 SHA512 5d7a0f4d529c259b3c784c61a1d6173d3b0fe7d3668a0c056d6931bd9e118f52f655e43e43a1862f41161f8b643a0757e5140fe0d9a097f8e6b0e6a064c14b52 WHIRLPOOL fadd6d7370fbc87ae115d2fb3131e83e07c2ca92ba90847fc7df0ce64d2cba6257188976875793603e5d0738ec43c9d398c333cea2ffe92dd6f15da5ee5c929c
+EBUILD fuse4bsd-0.3.9_pre1.ebuild 1880 SHA256 422b8237cedfacd4215e97ac61c6590703705897ed28af29e39a53472442dd79 SHA512 3ef2aabe3fbdaee4dbd8fff11434101cb0759025f9e90146b3d9dae2bd37e8e239f000b3819de0f9878015963aa31e248f67539326362ea8c4a534878d2b6730 WHIRLPOOL 370f9d4459d30910441af9e91dce66e8da12e24a36195e593c8381ee9b413810fec635474600a1ec095e623083ac2ff2fb87fdf279079440b99507db5fe795a2
+MISC ChangeLog 2648 SHA256 7fb7335e0474654680bec6f9fcd4309acf46fba8a693a53f1849c77c7fc7108e SHA512 6b13bf85930dd8c75d3c67e33d7fbd9b555f3b5c8684e7aefecadf84dc7b058ce3b719dd9b2012002ae9c34204b4051d3299410d529f663d7d9d2f8ffbca191b WHIRLPOOL 9eb9f5b0c82074a862bb15808f36fdbd6b0315b084b099282d2db1e2c7d0d05dc1e0382b5380aa28c4022e251b1ec659c5f7da652f5af1510960f5a309bd7376
+MISC ChangeLog-2015 1382 SHA256 2479ed2147c8f03faa505fb032387f7c88316fc6fa8da386233a2eade61c1bbf SHA512 8f5b8c54b1c5055da1068f907ac01282b9c3e98798ea40c8543c736cc00e3f566ecc8c9c12fe1f88ab4db2ed249f2426ee174cb87fd7f737dffaeefb0a44a81b WHIRLPOOL 7fba46cb4f6eb0d0d6c4449c9059ff7465fad4b441e17e3dd21a053e88f2ff8b7bf882aae1395ba29610cd4f4afcf8626faed055af1fbd60c10abcfa03386526
+MISC metadata.xml 238 SHA256 501d93b0c41ed422505100f002758cd173cd9783ae7fbb53e2ec5f238c868340 SHA512 173efaa53a514acf1e2f0c6681c82a48ec16d505844f551d2cc823ee8685b27837c7461f7956c12182059ee7e83023e2f0bcd5d1afab74beeaf998487193656d WHIRLPOOL 4ca51d994f011a5e7e4939f02a54b5c2f9f3e526665893c9ac2876c9871b7dc80361393d41c5247b3a5520e82d31d0dd10da520e7715c94b806a94ce0fed2a5a
diff --git a/sys-fs/fuse4bsd/files/fuse4bsd-0.3.0-gcc4.patch b/sys-fs/fuse4bsd/files/fuse4bsd-0.3.0-gcc4.patch
new file mode 100644
index 000000000000..ca1158e9fc1f
--- /dev/null
+++ b/sys-fs/fuse4bsd/files/fuse4bsd-0.3.0-gcc4.patch
@@ -0,0 +1,12 @@
+diff -ur fuse4bsd-0.3.0.old/fuse_module/fuse.c fuse4bsd-0.3.0/fuse_module/fuse.c
+--- fuse4bsd-0.3.0.old/fuse_module/fuse.c 2006-11-05 14:32:44.000000000 +0100
++++ fuse4bsd-0.3.0/fuse_module/fuse.c 2006-11-05 14:33:43.000000000 +0100
+@@ -5971,7 +5971,7 @@
+ extern struct cdevsw fmaster_cdevsw[5];
+ static struct cdev *fmaster_dev[5];
+ #endif
+-extern struct vfsconf fuse_vfsconf;
++static struct vfsconf fuse_vfsconf;
+
+
+ static void
diff --git a/sys-fs/fuse4bsd/files/fuse4bsd-0.3.0-ports.patch b/sys-fs/fuse4bsd/files/fuse4bsd-0.3.0-ports.patch
new file mode 100644
index 000000000000..a2c349919298
--- /dev/null
+++ b/sys-fs/fuse4bsd/files/fuse4bsd-0.3.0-ports.patch
@@ -0,0 +1,491 @@
+--- fuse_module/fmaster.c Mon Jun 19 22:10:26 2006 +0200
++++ fuse_module/fmaster.c Mon Jun 19 22:23:08 2006 +0200
+@@ -506,22 +506,22 @@ fuse_response_prettyprint(enum fuse_opco
+ case FUSE_FSYNCDIR:
+ //pp_buf(fresp);
+ break;
+-#if FUSE_HAS_GETLK
++#ifdef FUSE_HAS_GETLK
+ case FUSE_GETLK:
+ panic("FUSE_GETLK implementor has forgotten to define a response body format check");
+ break;
+ #endif
+-#if FUSE_HAS_SETLK
++#ifdef FUSE_HAS_SETLK
+ case FUSE_SETLK:
+ panic("FUSE_SETLK implementor has forgotten to define a response body format check");
+ break;
+ #endif
+-#if FUSE_HAS_SETLKW
++#ifdef FUSE_HAS_SETLKW
+ case FUSE_SETLKW:
+ panic("FUSE_SETLKW implementor has forgotten to define a response body format check");
+ break;
+ #endif
+-#if FUSE_HAS_ACCESS
++#ifdef FUSE_HAS_ACCESS
+ case FUSE_ACCESS:
+ break;
+ #endif--- fuse_module/fuse.c.orig Wed Sep 27 15:49:47 2006
++++ fuse_module/fuse.c Wed Sep 27 15:52:02 2006
+@@ -75,7 +75,7 @@
+ };
+
+
+-#if USE_OLD_CLONEHANDLER_API
++#ifdef USE_OLD_CLONEHANDLER_API
+ static void fusedev_clone(void *arg, char *name, int namelen, struct cdev **dev);
+ #else
+ static void fusedev_clone(void *arg, struct ucred *cred, char *name, int namelen, struct cdev **dev);
+@@ -120,7 +120,7 @@
+ __static void fuse_insert_message(struct fuse_ticket *tick);
+ __static fuse_handler_t fuse_standard_handler;
+ static fuse_handler_t fuse_fsync_handler;
+-#if FUSE_HAS_CREATE
++#ifdef FUSE_HAS_CREATE
+ static fuse_handler_t fuse_forgetful_handler;
+ #endif
+
+@@ -852,27 +852,27 @@
+ case FUSE_FSYNCDIR:
+ err = blen == 0 ? 0 : EINVAL;
+ break;
+-#if FUSE_HAS_GETLK
++#ifdef FUSE_HAS_GETLK
+ case FUSE_GETLK:
+ panic("FUSE_GETLK implementor has forgotten to define a response body format check");
+ break;
+ #endif
+-#if FUSE_HAS_SETLK
++#ifdef FUSE_HAS_SETLK
+ case FUSE_SETLK:
+ panic("FUSE_SETLK implementor has forgotten to define a response body format check");
+ break;
+ #endif
+-#if FUSE_HAS_SETLKW
++#ifdef FUSE_HAS_SETLKW
+ case FUSE_SETLKW:
+ panic("FUSE_SETLKW implementor has forgotten to define a response body format check");
+ break;
+ #endif
+-#if FUSE_HAS_ACCESS
++#ifdef FUSE_HAS_ACCESS
+ case FUSE_ACCESS:
+ err = blen == 0 ? 0 : EINVAL;
+ break;
+ #endif
+-#if FUSE_HAS_CREATE
++#ifdef FUSE_HAS_CREATE
+ case FUSE_CREATE:
+ err = blen == sizeof(struct fuse_entry_out) + sizeof(struct fuse_open_out) ? 0 : EINVAL;
+ break;
+@@ -881,7 +881,7 @@
+ panic("fuse opcodes out of sync");
+ }
+
+-#if _DEBUG2G
++#ifdef _DEBUG2G
+ if (err)
+ DEBUG2G("op %s (#%d) with body size %d: invalid body size\n",
+ (0 <= opcode && opcode <= fuse_opnames_entries) ? fuse_opnames[opcode] : "???",
+@@ -904,7 +904,7 @@
+ uint64_t nid, enum fuse_opcode op, size_t blen,
+ struct thread* td, struct ucred *cred)
+ {
+- ihead->len = sizeof(ihead) + blen; /* actually not used by lib */
++ ihead->len = sizeof(*ihead) + blen; /* actually not used by lib */
+ ihead->unique = tick->unique;
+ ihead->nodeid = nid;
+ ihead->opcode = op;
+@@ -988,7 +988,7 @@
+ return (0);
+ }
+
+-#if FUSE_HAS_CREATE
++#ifdef FUSE_HAS_CREATE
+ static int
+ fuse_forgetful_handler(struct fuse_callback_node *caliban, struct uio *uio)
+ {
+@@ -1242,7 +1242,7 @@
+ static int
+ fusedev_write(struct cdev *dev, struct uio *uio, int ioflag)
+ {
+-#if _DEBUG_MSGING
++#ifdef _DEBUG_MSGING
+ static int counter=0;
+ #endif
+ struct fuse_out_header *ohead;
+@@ -1415,7 +1415,7 @@
+ if ((err = fuse_callbn_wait_answer(&fdip->tick->callbn))) {
+ /* Uh-huh, we got interrupted... */
+
+-#if ! DONT_TRY_HARD_PREVENT_IO_IN_VAIN
++#ifndef DONT_TRY_HARD_PREVENT_IO_IN_VAIN
+ struct fuse_callback_node *fcallbn;
+ unsigned age;
+ #endif
+@@ -1438,7 +1438,7 @@
+ age = fdip->tick->age;
+ fuse_callbn_set_answered(&fdip->tick->callbn);
+ mtx_unlock(&fdip->tick->callbn.answer_mtx);
+-#if ! DONT_TRY_HARD_PREVENT_IO_IN_VAIN
++#ifndef DONT_TRY_HARD_PREVENT_IO_IN_VAIN
+ /*
+ * If we are willing to pay with one more locking, we
+ * can save on I/O by getting the device write handler
+@@ -1662,7 +1662,7 @@
+ /* static vop_pathconf_t fuse_pathconf; */
+ static vfs_hash_cmp_t fuse_vnode_cmp;
+ static vfs_hash_cmp_t fuse_vnode_bgdrop_cmp;
+-#if FUSE_HAS_CREATE
++#ifdef FUSE_HAS_CREATE
+ static vfs_hash_cmp_t fuse_vnode_fgdrop_cmp;
+ #endif
+ /* static vfs_vget_t fuse_vget; */
+@@ -1683,7 +1683,7 @@
+ static vop_lookup_t fuse_lookup;
+ static int iterate_filehandles(struct vnode *vp, struct thread *td, struct ucred *cred, fuse_metrics_t fmetr, void *param);
+ static fuse_metrics_t fuse_standard_metrics;
+-#if FUSE_HAS_CREATE
++#ifdef FUSE_HAS_CREATE
+ static __inline int create_filehandle(struct vnode *vp, struct thread *td, struct ucred *cred, int mode, struct fuse_dispatcher *fdip);
+ #endif
+ static struct fuse_filehandle *get_filehandle(struct vnode *vp, struct thread *td, struct ucred *cred, int mode, struct get_filehandle_param *gefhp);
+@@ -1729,7 +1729,7 @@
+
+ static b_strategy_t fuse_bufstrategy;
+
+-#if FUSE_HAS_CREATE
++#ifdef FUSE_HAS_CREATE
+ static vop_access_t fuse_germ_access;
+ #endif
+
+@@ -1773,7 +1773,7 @@
+ .vop_unlock = fuse_unlock,
+ };
+
+-#if FUSE_HAS_CREATE
++#ifdef FUSE_HAS_CREATE
+ static struct vop_vector fuse_germ_vnops;
+ #endif
+
+@@ -2092,7 +2092,7 @@
+
+ if (! (fmnt->mntopts & FUSEFS_SECONDARY)) {
+ data->mp = mp;
+-#if ! REALTIME_TRACK_UNPRIVPROCDBG
++#ifndef REALTIME_TRACK_UNPRIVPROCDBG
+ fmnt->mntopts &= ~FUSEFS_UNPRIVPROCDBG;
+ fmnt->mntopts |= get_unprivileged_proc_debug(td) ? FUSEFS_UNPRIVPROCDBG : 0;
+ #endif
+@@ -2380,7 +2380,7 @@
+ return (0);
+ }
+
+-#if FUSE_HAS_CREATE
++#ifdef FUSE_HAS_CREATE
+ /*
+ * Vnode comparison function with which the given vnode always
+ * gets inserted, but got marked invalid upon a clash. Caller
+@@ -2654,7 +2654,7 @@
+
+ fuse_filehandle_gc(vp, td, NULL);
+
+-#if ! DONT_STORE_FS_MAP
++#ifndef DONT_STORE_FS_MAP
+ /*
+ * Dropping vnodes when they are not in use would mean that
+ * the respective inode must be freed on the daemon's side
+@@ -2751,7 +2751,7 @@
+ int denied;
+
+ if ((denied = cr_candebug(
+-#if REALTIME_TRACK_UNPRIVPROCDBG
++#ifdef REALTIME_TRACK_UNPRIVPROCDBG
+ get_unprivileged_proc_debug(td),
+ #else
+ fmnt->mntopts & FUSEFS_UNPRIVPROCDBG,
+@@ -2948,7 +2948,7 @@
+
+ } else {
+ struct sx *devlock = fdi.slock;
+-#if FUSE_HAS_ACCESS
++#ifdef FUSE_HAS_ACCESS
+ struct fuse_access_in *fai;
+
+ if (! (facp->facc_flags & FACCESS_DO_ACCESS))
+@@ -3056,7 +3056,7 @@
+
+ bzero(&facp, sizeof(facp));
+ if (
+-#if NO_EARLY_PERM_CHECK_HACK
++#ifdef NO_EARLY_PERM_CHECK_HACK
+ 1
+ #else
+ dvp->v_vflag & VV_ROOT
+@@ -3281,8 +3281,12 @@
+ DEBUG("we peacefully found that file\n");
+
+ if (flags & ISDOTDOT) {
+- vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, td);
++ VOP_UNLOCK(dvp, 0, td);
++ err = vn_lock(pdp, cnp->cn_lkflags, td);
+ VREF(pdp);
++ vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td);
++ if (err)
++ goto out;
+ *vpp = pdp;
+ } else if (nid == VTOI(dvp)) {
+ VREF(dvp); /* We want ourself, ie "." */
+@@ -3347,7 +3351,7 @@
+ if (islastcn && flags & ISOPEN)
+ ((struct fuse_vnode_data *)(*vpp)->v_data)->flags |= FVP_ACCESS_NOOP;
+
+-#if ! NO_EARLY_PERM_CHECK_HACK
++#ifndef NO_EARLY_PERM_CHECK_HACK
+ if (! islastcn) {
+ /* We have the attributes of the next item
+ * *now*, and it's a fact, and we do not have
+@@ -3486,7 +3490,7 @@
+ return (0);
+ }
+
+-#if FUSE_HAS_CREATE
++#ifdef FUSE_HAS_CREATE
+ static __inline int
+ create_filehandle(struct vnode *vp, struct thread *td, struct ucred *cred,
+ int mode, struct fuse_dispatcher *fdip)
+@@ -3643,7 +3647,7 @@
+ * the vnode... if the vnode is a germ, it will be tried to be initialized
+ * via a dedicated method, but from that on we go on as usual.)
+ */
+-#if FUSE_HAS_CREATE
++#ifdef FUSE_HAS_CREATE
+ if (vp->v_op == &fuse_germ_vnops) {
+ KASSERT(gefhp, ("create_filehandle called without get_filehandle_param"));
+ gone_create = 1;
+@@ -3709,7 +3713,7 @@
+ if ((err = fdisp_wait_answ(&fdi)))
+ goto out;
+
+-#if FUSE_HAS_CREATE
++#ifdef FUSE_HAS_CREATE
+ setup_filehandle:
+ #endif
+ foo = fdi.answ;
+@@ -4184,7 +4188,7 @@
+ #define BSD_FUSE_PAGENO_BOUND MIN(FUSE_MAX_PAGES_PER_REQ, MAXBSIZE / PAGE_SIZE)
+
+ bcount = MIN(MAXBSIZE, biosize * BSD_FUSE_PAGENO_BOUND);
+-#if BIOREAD_CONSIDER_FILE_SIZE
++#ifdef BIOREAD_CONSIDER_FILE_SIZE
+ if (vp->v_type != VDIR) {
+ /*
+ * for directories we can't predict the size, in fact
+@@ -4493,7 +4497,7 @@
+ break;
+ }
+
+-#if ZERO_PAD_INCOMPLETE_BUFS
++#ifdef ZERO_PAD_INCOMPLETE_BUFS
+ if (isbzero(buf), FUSE_NAME_OFFSET) {
+ err = -1;
+ break;
+@@ -4658,7 +4662,7 @@
+ struct vnode *dvp = ap->a_dvp;
+ struct vnode **vpp = ap->a_vpp;
+ struct vattr *vap = ap->a_vap;
+-#if FUSE_HAS_CREATE
++#ifdef FUSE_HAS_CREATE
+ struct fuse_dispatcher fdi;
+ struct fuse_vnode_data *fvdat;
+ int err;
+@@ -4949,7 +4953,7 @@
+ if (err)
+ goto out;
+
+-#if ! DONT_DO_CHECKPATH
++#ifndef DONT_DO_CHECKPATH
+ if (doingdirectory && fdvp != tdvp) {
+ /*
+ * Check for pathname conflict.
+@@ -5396,7 +5400,6 @@
+ struct vnode *vp = fioda->vp;
+ struct uio *uio = fioda->uio;
+ struct ucred *cred = fioda->cred;
+- struct fuse_filehandle *fufh = fioda->fufh;
+
+ int biosize;
+
+@@ -5506,7 +5509,7 @@
+ if ((bp->b_flags & B_CACHE) == 0) {
+ bp->b_iocmd = BIO_READ;
+ vfs_busy_pages(bp, 0);
+- fuse_strategy_i(vp, bp, fufh, 0);
++ fuse_strategy_i(vp, bp, NULL, 0);
+ if ((err = bp->b_error)) {
+ brelse(bp);
+ break;
+@@ -5741,7 +5744,7 @@
+ chunksize, (long long unsigned)fri->offset, respsize);
+
+ if (respsize < chunksize) {
+-#if ZERO_PAD_INCOMPLETE_BUFS
++#ifdef ZERO_PAD_INCOMPLETE_BUFS
+ /*
+ * "if we don't get enough data, just fill the
+ * rest with zeros."
+@@ -5888,7 +5891,7 @@
+ "vp=%p, rc=%d", bp, vp, rc));
+ }
+
+-#if FUSE_HAS_CREATE
++#ifdef FUSE_HAS_CREATE
+ static int
+ fuse_germ_access(struct vop_access_args *ap)
+ {
+@@ -5908,7 +5911,7 @@
+
+ /* Modeled after tunclone() of net/if_tun.c
+ */
+-#if USE_OLD_CLONEHANDLER_API
++#ifdef USE_OLD_CLONEHANDLER_API
+ static void
+ fusedev_clone(void *arg, char *name, int namelen, struct cdev **dev)
+ #else
+@@ -6019,7 +6022,7 @@
+ fuse_fileops.fo_close = fuse_close_f;
+ fuse_fileops.fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE;
+
+-#if FUSE_HAS_CREATE
++#ifdef FUSE_HAS_CREATE
+ memcpy(&fuse_germ_vnops, &dead_vnodeops, sizeof(struct vop_vector));
+ fuse_germ_vnops.vop_access = fuse_germ_access;
+ fuse_germ_vnops.vop_open = fuse_open;
+--- fuse_module/fuse.h.orig Fri Feb 10 17:31:53 2006
++++ fuse_module/fuse.h Sun Jul 16 14:43:20 2006
+@@ -8,7 +8,7 @@
+
+ #ifndef USE_OLD_CLONEHANDLER_API
+ #if __FreeBSD_version < 600034 || ( __FreeBSD_version >= 700000 && __FreeBSD_version < 700002 )
+-#define USE_OLD_CLONEHANDLER_API 1
++#define USE_OLD_CLONEHANDLER_API
+ #endif
+ #endif
+
+@@ -19,10 +19,10 @@
+ */
+ #if FUSE_KERNELABI_GEQ(7, 3)
+ #ifndef FUSE_HAS_ACCESS
+-#define FUSE_HAS_ACCESS 1
++#define FUSE_HAS_ACCESS
+ #endif
+ #ifndef FUSE_HAS_CREATE
+-#define FUSE_HAS_CREATE 1
++#define FUSE_HAS_CREATE
+ #endif
+ #endif
+
+@@ -75,7 +75,7 @@
+ size_t len; /* To keep track of size of the data pushed into base, =< len, of course */
+ };
+
+-#if ! FUSE_AUX
++#ifndef FUSE_AUX
+ #ifndef FUSE_MAX_STORED_FREE_TICKETS
+ #define FUSE_MAX_STORED_FREE_TICKETS 0
+ #endif
+@@ -251,7 +251,7 @@
+ int flags;
+ LIST_HEAD(, fuse_filehandle) fh_head;
+ int fh_counter;
+-#if FUSE_HAS_CREATE
++#ifdef FUSE_HAS_CREATE
+ struct componentname *germcnp;
+ #endif
+ };
+@@ -260,6 +260,9 @@
+
+ /* Debug related stuff */
+
++#ifndef DEBUGTOLOG
++#define DEBUGTOLOG 0
++#endif
+ #if DEBUGTOLOG
+ #define dprintf(args ...) log(LOG_DEBUG, args)
+ #else
+@@ -267,6 +270,9 @@
+ #endif
+
+ #define DEBLABEL "[fuse-debug] "
++#ifndef _DEBUG
++#define _DEBUG 0
++#endif
+ #if _DEBUG
+ #ifndef _DEBUG2G
+ #define _DEBUG2G 1
+@@ -280,6 +286,9 @@
+ #define DEBUG(args ...)
+ #endif
+
++#ifndef _DEBUG2G
++#define _DEBUG2G 0
++#endif
+ #if _DEBUG2G
+ #ifndef _DEBUG3G
+ #define _DEBUG3G 1
+@@ -290,6 +299,9 @@
+ #define DEBUG2G(args ...)
+ #endif
+
++#ifndef _DEBUG3G
++#define _DEBUG3G 0
++#endif
+ #if _DEBUG3G
+ #define DEBUG3G(args, ...) \
+ printf(DEBLABEL "%s:%d: " args, __func__, __LINE__, ## __VA_ARGS__)
+@@ -297,13 +309,19 @@
+ #define DEBUG3G(args ...)
+ #endif
+
++#ifndef FMASTER
++#define FMASTER 0
++#endif
+ #if FMASTER
+ #ifndef _DEBUG_MSGING
+ #define _DEBUG_MSGING 1
+ #endif
+ #endif
+
+-#if _DEBUG_MSGING
++#ifndef _DEBUG_MSG
++#define _DEBUG_MSG 0
++#endif
++#ifdef _DEBUG_MSGING
+ #define fuprintf(args...) \
+ uprintf("[kern] " args)
+ #else
+@@ -319,7 +337,7 @@
+ void fprettyprint(struct fuse_iov *fiov, size_t dlen);
+ #endif
+
+-#if IGNORE_INLINE
++#ifdef IGNORE_INLINE
+ #define __inline
+ #endif
+
+--- fuse_module/fuse_subr.c.orig Fri Feb 10 17:31:53 2006
++++ fuse_module/fuse_subr.c Wed Sep 27 11:57:01 2006
+@@ -15,9 +15,11 @@
+ {
+ int err;
+ int unprivileged_proc_debug;
++ size_t ilen = sizeof(unprivileged_proc_debug);
+
+ err = kernel_sysctlbyname(td, "security.bsd.unprivileged_proc_debug",
+- NULL, 0, &unprivileged_proc_debug, sizeof(unprivileged_proc_debug), NULL, 0);
++ &unprivileged_proc_debug, &ilen,
++ NULL, 0, NULL, 0);
+
+ if (err)
+ unprivileged_proc_debug = 0;
diff --git a/sys-fs/fuse4bsd/files/fuse4bsd-0.3.9_pre1-fbsd91.patch b/sys-fs/fuse4bsd/files/fuse4bsd-0.3.9_pre1-fbsd91.patch
new file mode 100644
index 000000000000..cc3ea70ec7af
--- /dev/null
+++ b/sys-fs/fuse4bsd/files/fuse4bsd-0.3.9_pre1-fbsd91.patch
@@ -0,0 +1,15 @@
+Taken from FreeBSD ports
+
+extra-patch-fuse_module__fuse_vnops.c
+
+--- fuse_module/fuse_vfsops.c.orig 2008-02-05 07:25:57.000000000 +0200
++++ fuse_module/fuse_vfsops.c 2011-09-08 10:27:43.000000000 +0300
+@@ -224,7 +231,7 @@
+ struct cdev *fdev;
+ struct sx *slock;
+ struct fuse_data *data;
+- int mntopts = 0, __mntopts = 0, max_read_set = 0, secondary = 0;
++ uint64_t mntopts = 0, __mntopts = 0, max_read_set = 0, secondary = 0;
+ unsigned max_read = ~0;
+ struct vnode *rvp;
+ struct fuse_vnode_data *fvdat;
diff --git a/sys-fs/fuse4bsd/files/fuse4bsd-0.3.9_pre1-ports.patch b/sys-fs/fuse4bsd/files/fuse4bsd-0.3.9_pre1-ports.patch
new file mode 100644
index 000000000000..cf4cf4441196
--- /dev/null
+++ b/sys-fs/fuse4bsd/files/fuse4bsd-0.3.9_pre1-ports.patch
@@ -0,0 +1,475 @@
+Taken from FreeBSD Ports
+
+cat sysutils/fusefs-kmod/files/patch-* > fuse4bsd-0.3.9_pre20080208-ports.patch
+
+
+--- fuse_module/Makefile.orig 2008-02-05 08:25:57.000000000 +0300
++++ fuse_module/Makefile 2009-01-14 00:29:13.000000000 +0300
+@@ -1,3 +1,5 @@
++.undef KERNCONF
++
+ .include "../Makefile.common"
+
+ SRCS = fuse_main.c \
+@@ -22,7 +24,8 @@
+
+ .if defined(KERNCONF)
+ KERNCONF1!= echo ${KERNCONF} | sed -e 's/ .*//g'
+-KERNCONFDIR= /usr/obj/usr/src/sys/${KERNCONF1}
++KRNLOBJDIR!= make -C /usr/src -f /usr/src/Makefile.inc1 -V KRNLOBJDIR
++KERNCONFDIR= ${KRNLOBJDIR}/${KERNCONF1}
+ .endif
+
+ .if defined(KERNCONFDIR)
+--- fuse_module/fuse.h.orig 2008-02-05 00:25:57.000000000 -0500
++++ fuse_module/fuse.h 2009-05-13 18:40:19.000000000 -0400
+@@ -25,6 +25,22 @@
+ #endif
+ #endif
+
++#ifndef VFSOPS_TAKES_THREAD
++#if __FreeBSD_version >= 800087
++#define VFSOPS_TAKES_THREAD 0
++#else
++#define VFSOPS_TAKES_THREAD 1
++#endif
++#endif
++
++#ifndef VOP_ACCESS_TAKES_ACCMODE_T
++#if __FreeBSD_version >= 800052
++#define VOP_ACCESS_TAKES_ACCMODE_T 1
++#else
++#define VOP_ACCESS_TAKES_ACCMODE_T 0
++#endif
++#endif
++
+ #ifndef VOP_OPEN_TAKES_FP
+ #if __FreeBSD_version >= 700044
+ #define VOP_OPEN_TAKES_FP 1
+@@ -49,6 +65,14 @@
+ #endif
+ #endif
+
++#ifndef VOP_GETATTR_TAKES_THREAD
++#if __FreeBSD_version >= 800046
++#define VOP_GETATTR_TAKES_THREAD 0
++#else
++#define VOP_GETATTR_TAKES_THREAD 1
++#endif
++#endif
++
+ #ifndef USE_PRIVILEGE_API
+ /*
+ * __FreeBSD_version bump was omitted for introduction of
+--- fuse_module/fuse_dev.c
++++ fuse_module/fuse_dev.c
+@@ -52,8 +52,13 @@
+ .d_read = fusedev_read,
+ .d_write = fusedev_write,
+ .d_version = D_VERSION,
++#ifndef D_NEEDMINOR
++#define D_NEEDMINOR 0
++#endif
+ #if ! DO_GIANT_MANUALLY
+- .d_flags = D_NEEDGIANT,
++ .d_flags = D_NEEDMINOR|D_NEEDGIANT,
++#else
++ .d_flags = D_NEEDMINOR,
+ #endif
+ };
+
+@@ -548,7 +553,12 @@
+ /* find any existing device, or allocate new unit number */
+ i = clone_create(&fuseclones, &fuse_cdevsw, &unit, dev, 0);
+ if (i) {
+- *dev = make_dev(&fuse_cdevsw, unit2minor(unit),
++ *dev = make_dev(&fuse_cdevsw,
++#if __FreeBSD_version < 800062
++ unit2minor(unit),
++#else /* __FreeBSD_version >= 800062 */
++ unit,
++#endif /* __FreeBSD_version < 800062 */
+ UID_ROOT, GID_OPERATOR,
+ S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP,
+ "fuse%d", unit);
+--- fuse_module/fuse_io.c.orig 2008-02-05 00:25:57.000000000 -0500
++++ fuse_module/fuse_io.c 2009-07-13 09:31:24.000000000 -0400
+@@ -35,6 +35,10 @@
+ #include <vm/vnode_pager.h>
+ #include <vm/vm_object.h>
+
++#if (__FreeBSD_version >= 800000)
++#define vfs_bio_set_validclean vfs_bio_set_valid
++#endif
++
+ #include "fuse.h"
+ #include "fuse_session.h"
+ #include "fuse_vnode.h"
+@@ -157,7 +161,11 @@
+ goto out;
+
+ if (uio->uio_rw == UIO_WRITE && fp->f_flag & O_APPEND) {
+- if ((err = VOP_GETATTR(vp, &va, cred, td)))
++ if ((err = VOP_GETATTR(vp, &va, cred
++#if VOP_GETATTR_TAKES_THREAD
++ , td
++#endif
++ )))
+ goto out;
+ uio->uio_offset = va.va_size;
+ } else if ((flags & FOF_OFFSET) == 0)
+@@ -227,7 +235,7 @@
+ return (0);
+
+ biosize = vp->v_mount->mnt_stat.f_iosize;
+- bcount = min(MAXBSIZE, biosize);
++ bcount = MIN(MAXBSIZE, biosize);
+
+ DEBUG2G("entering loop\n");
+ do {
+@@ -352,7 +360,7 @@
+ fri = fdi.indata;
+ fri->fh = fufh->fh_id;
+ fri->offset = uio->uio_offset;
+- fri->size = min(uio->uio_resid,
++ fri->size = MIN(uio->uio_resid,
+ fusefs_get_data(vp->v_mount)->max_read);
+
+ DEBUG2G("fri->fh %llu, fri->offset %d, fri->size %d\n",
+@@ -399,7 +407,7 @@
+ while (uio->uio_resid > 0) {
+ int transfersize;
+
+- chunksize = min(iov->iov_len, nmax);
++ chunksize = MIN(iov->iov_len, nmax);
+
+ if (uio->uio_rw == UIO_READ) {
+ struct fuse_read_in *fri;
+@@ -464,7 +472,7 @@
+ {
+ int err;
+
+- if ((err = uiomove(buf, min(reqsize, bufsize), uio)))
++ if ((err = uiomove(buf, MIN(reqsize, bufsize), uio)))
+ return (err);
+
+ if (bufsize < reqsize)
+@@ -502,7 +510,7 @@
+ }
+
+ while (uio->uio_resid > 0) {
+- chunksize = min(uio->uio_resid,
++ chunksize = MIN(uio->uio_resid,
+ fusefs_get_data(vp->v_mount)->max_write);
+
+ fdi.iosize = sizeof(*fwi) + chunksize;
+@@ -569,7 +577,7 @@
+ do {
+ lbn = uio->uio_offset / biosize;
+ on = uio->uio_offset & (biosize-1);
+- n = min((unsigned)(biosize - on), uio->uio_resid);
++ n = MIN((unsigned)(biosize - on), uio->uio_resid);
+
+ DEBUG2G("lbn %d, on %d, n %d, uio offset %d, uio resid %d\n",
+ (int)lbn, on, n, (int)uio->uio_offset, uio->uio_resid);
+@@ -739,8 +747,8 @@
+ */
+ if (n) {
+ if (bp->b_dirtyend > 0) {
+- bp->b_dirtyoff = min(on, bp->b_dirtyoff);
+- bp->b_dirtyend = max((on + n), bp->b_dirtyend);
++ bp->b_dirtyoff = MIN(on, bp->b_dirtyoff);
++ bp->b_dirtyend = MAX((on + n), bp->b_dirtyend);
+ } else {
+ bp->b_dirtyoff = on;
+ bp->b_dirtyend = on + n;
+@@ -823,7 +831,11 @@
+ #if FUSELIB_CONFORM_BIOREAD
+ struct vattr va;
+
+- if ((err = VOP_GETATTR(vp, &va, cred, curthread)))
++ if ((err = VOP_GETATTR(vp, &va, cred
++#if VOP_GETATTR_TAKES_THREAD
++ , curthread
++#endif
++ )))
+ goto out;
+ #endif
+
+@@ -831,7 +843,7 @@
+ bp->b_resid = bp->b_bcount;
+ while (bp->b_resid > 0) {
+ DEBUG2G("starting bio with resid %ld\n", bp->b_resid);
+- chunksize = min(bp->b_resid,
++ chunksize = MIN(bp->b_resid,
+ fusefs_get_data(vp->v_mount)->max_read);
+ fdi.iosize = sizeof(*fri);
+ if (! op)
+@@ -842,8 +854,8 @@
+ fri->fh = fufh->fh_id;
+ fri->offset = ((off_t)bp->b_blkno) * biosize + ioff;
+ #if FUSELIB_CONFORM_BIOREAD
+- chunksize = min(chunksize,
+- min(fri->offset + bp->b_resid,
++ chunksize = MIN(chunksize,
++ MIN(fri->offset + bp->b_resid,
+ va.va_size) - fri->offset);
+ if (chunksize == 0) {
+ respsize = -1;
+@@ -901,7 +913,7 @@
+
+ bufdat = bp->b_data + bp->b_dirtyoff;
+ while (bp->b_dirtyend > bp->b_dirtyoff) {
+- chunksize = min(bp->b_dirtyend - bp->b_dirtyoff,
++ chunksize = MIN(bp->b_dirtyend - bp->b_dirtyoff,
+ fusefs_get_data(vp->v_mount)->max_write);
+
+ fdi.iosize = sizeof(*fwi);
+--- fuse_module/fuse_main.c.00 2010-08-15 14:40:29.000000000 +0400
++++ fuse_module/fuse_main.c 2010-08-15 15:56:56.000000000 +0400
+@@ -108,6 +108,9 @@
+ switch (what) {
+ case MOD_LOAD: /* kldload */
+
++#if __FreeBSD_version > 800009
++ fuse_fileops.fo_truncate = vnops.fo_truncate;
++#endif
+ fuse_fileops.fo_ioctl = vnops.fo_ioctl;
+ fuse_fileops.fo_poll = vnops.fo_poll;
+ fuse_fileops.fo_kqfilter = vnops.fo_kqfilter;
+
+
+--- fuse_module/fuse_vfsops.c.orig 2008-02-05 00:25:57.000000000 -0500
++++ fuse_module/fuse_vfsops.c 2009-05-13 18:54:01.000000000 -0400
+@@ -18,6 +18,7 @@
+ #include <sys/namei.h>
+ #include <sys/mount.h>
+ #include <sys/sysctl.h>
++#include <sys/fcntl.h>
+
+ #include "fuse.h"
+ #include "fuse_session.h"
+@@ -213,8 +214,14 @@
+ * Mount system call
+ */
+ static int
++#if VFSOPS_TAKES_THREAD
+ fuse_mount(struct mount *mp, struct thread *td)
+ {
++#else
++fuse_mount(struct mount *mp)
++{
++ struct thread *td = curthread;
++#endif
+ int err = 0;
+ size_t len;
+ char *fspec, *subtype = NULL;
+@@ -529,8 +536,14 @@
+ * Unmount system call
+ */
+ static int
++#if VFSOPS_TAKES_THREAD
+ fuse_unmount(struct mount *mp, int mntflags, struct thread *td)
+ {
++#else
++fuse_unmount(struct mount *mp, int mntflags)
++{
++ struct thread *td = curthread;
++#endif
+ int flags = 0, err = 0;
+ struct fuse_data *data;
+ struct fuse_secondary_data *fsdat = NULL;
+@@ -633,8 +646,14 @@
+
+ /* stolen from portalfs */
+ static int
++#if VFSOPS_TAKES_THREAD
+ fuse_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td)
+ {
++#else
++fuse_root(struct mount *mp, int flags, struct vnode **vpp)
++{
++ struct thread *td = curthread;
++#endif
+ /*
+ * Return locked reference to root.
+ */
+@@ -650,7 +669,11 @@
+ data = fsdat->master;
+ sx_slock(&data->mhierlock);
+ if (data->mpri == FM_PRIMARY)
+- err = fuse_root(data->mp, flags, vpp, td);
++ err = fuse_root(data->mp, flags, vpp
++#if VFSOPS_TAKES_THREAD
++ , td
++#endif
++ );
+ else
+ err = ENXIO;
+ sx_sunlock(&data->mhierlock);
+@@ -667,7 +690,11 @@
+ if (vp->v_type == VNON) {
+ struct vattr va;
+
+- (void)VOP_GETATTR(vp, &va, td->td_ucred, td);
++ (void)VOP_GETATTR(vp, &va, td->td_ucred
++#if VOP_GETATTR_TAKES_THREAD
++ , td
++#endif
++ );
+ }
+ *vpp = vp;
+ #if _DEBUG2G
+@@ -678,8 +705,14 @@
+ }
+
+ static int
++#if VFSOPS_TAKES_THREAD
+ fuse_statfs(struct mount *mp, struct statfs *sbp, struct thread *td)
+ {
++#else
++fuse_statfs(struct mount *mp, struct statfs *sbp)
++{
++ struct thread *td = curthread;
++#endif
+ struct fuse_dispatcher fdi;
+ struct fuse_statfs_out *fsfo;
+ struct fuse_data *data;
+@@ -696,7 +729,11 @@
+
+ sx_slock(&data->mhierlock);
+ if (data->mpri == FM_PRIMARY)
+- err = fuse_statfs(data->mp, sbp, td);
++ err = fuse_statfs(data->mp, sbp
++#if VFSOPS_TAKES_THREAD
++ , td
++#endif
++ );
+ else
+ err = ENXIO;
+ sx_sunlock(&data->mhierlock);
+@@ -794,7 +831,11 @@
+ if (nodeid == FUSE_ROOT_ID) {
+ if (parentid != FUSE_NULL_ID)
+ return (ENOENT);
+- err = VFS_ROOT(mp, myflags, vpp, td);
++ err = VFS_ROOT(mp, myflags, vpp
++#if VFSOPS_TAKES_THREAD
++ , td
++#endif
++ );
+ if (err)
+ return (err);
+ KASSERT(*vpp, ("we neither err'd nor found the root node"));
+--- ./fuse_module/fuse_vnops.c.orig 2012-09-19 06:04:10.512413490 +0200
++++ ./fuse_module/fuse_vnops.c 2012-09-19 06:20:44.949613892 +0200
+@@ -799,8 +799,11 @@
+ struct vnode *vp = ap->a_vp;
+ struct vattr *vap = ap->a_vap;
+ struct ucred *cred = ap->a_cred;
++#if VOP_GETATTR_TAKES_THREAD
+ struct thread *td = ap->a_td;
+-
++#else
++ struct thread *td = curthread;
++#endif
+ struct fuse_dispatcher fdi;
+ struct timespec uptsp;
+ int err = 0;
+@@ -871,7 +874,11 @@
+ fuse_access(ap)
+ struct vop_access_args /* {
+ struct vnode *a_vp;
++#if VOP_ACCESS_TAKES_ACCMODE_T
++ accmode_t a_accmode;
++#else
+ int a_mode;
++#endif
+ struct ucred *a_cred;
+ struct thread *a_td;
+ } */ *ap;
+@@ -886,7 +893,13 @@
+ else
+ facp.facc_flags |= FACCESS_DO_ACCESS;
+
+- return fuse_access_i(vp, ap->a_mode, ap->a_cred, ap->a_td, &facp);
++ return fuse_access_i(vp,
++#if VOP_ACCESS_TAKES_ACCMODE_T
++ ap->a_accmode,
++#else
++ ap->a_mode,
++#endif
++ ap->a_cred, ap->a_td, &facp);
+ }
+
+ /*
+@@ -946,7 +959,11 @@
+ /* We are to do the check in-kernel */
+
+ if (! (facp->facc_flags & FACCESS_VA_VALID)) {
+- err = VOP_GETATTR(vp, VTOVA(vp), cred, td);
++ err = VOP_GETATTR(vp, VTOVA(vp), cred
++#if VOP_GETATTR_TAKES_THREAD
++ , td
++#endif
++ );
+ if (err)
+ return (err);
+ facp->facc_flags |= FACCESS_VA_VALID;
+@@ -1544,7 +1561,7 @@
+ struct fuse_vnode_data *fvdat = VTOFUD(vp);
+ uint64_t parentid = fvdat->parent_nid;
+ struct componentname *cnp = fvdat->germcnp;
+- struct fuse_open_in *foi;
++ struct fuse_create_in *foi;
+ struct fuse_entry_out *feo;
+ struct fuse_mknod_in fmni;
+ int err;
+@@ -1929,7 +1946,11 @@
+ * It will not invalidate pages which are dirty, locked, under
+ * writeback or mapped into pagetables.")
+ */
++#if VOP_GETATTR_TAKES_THREAD
+ err = vinvalbuf(vp, 0, td, PCATCH, 0);
++#else
++ err = vinvalbuf(vp, 0, PCATCH, 0);
++#endif
+ fufh->flags |= FOPEN_KEEP_CACHE;
+ }
+
+@@ -3005,8 +3026,11 @@
+ struct vattr *vap = ap->a_vap;
+ struct vnode *vp = ap->a_vp;
+ struct ucred *cred = ap->a_cred;
++#if VOP_GETATTR_TAKES_THREAD
+ struct thread *td = ap->a_td;
+-
++#else
++ struct thread *td = curthread;
++#endif
+ int err = 0;
+ struct fuse_dispatcher fdi;
+ struct fuse_setattr_in *fsai;
+--- mount_fusefs/mount_fusefs.c 2008-02-05 07:25:57.000000000 +0200
++++ mount_fusefs/mount_fusefs.c 2012-01-07 21:07:35.000000000 +0200
+@@ -44,6 +44,7 @@
+ #include <getopt.h>
+ #include <libgen.h>
+ #include <limits.h>
++#include <osreldate.h>
+ #include <paths.h>
+
+ #include "fuse4bsd.h"
+@@ -312,7 +313,12 @@
+ * Resolve the mountpoint with realpath(3) and remove unnecessary
+ * slashes from the devicename if there are any.
+ */
++#if __FreeBSD_version >= 1000005
++ if (checkpath(dir, mntpath) != 0)
++ err(1, "%s", mntpath);
++#else
+ (void)checkpath(dir, mntpath);
++#endif
+ (void)rmslashes(dev, dev);
+
+ if (strcmp(dev, "auto") == 0)
diff --git a/sys-fs/fuse4bsd/fuse4bsd-0.3.0.ebuild b/sys-fs/fuse4bsd/fuse4bsd-0.3.0.ebuild
new file mode 100644
index 000000000000..a04605e252f7
--- /dev/null
+++ b/sys-fs/fuse4bsd/fuse4bsd-0.3.0.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+inherit portability toolchain-funcs eutils flag-o-matic
+
+DESCRIPTION="Fuse for FreeBSD"
+HOMEPAGE="http://fuse4bsd.creo.hu/"
+# -sbin is needed for getmntopts.c, hardcoding 6.2 is nasty but can't think of
+# any better solution right now
+SRC_URI="http://fuse4bsd.creo.hu/downloads/${P}.tar.gz
+ mirror://gentoo/freebsd-sbin-6.2.tar.bz2"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~x86-fbsd"
+IUSE=""
+
+DEPEND=">=sys-freebsd/freebsd-sources-6.2
+ virtual/pmake"
+RDEPEND="sys-fs/fuse"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ cp /usr/include/fuse/fuse_kernel.h fuse_module/
+ cp "${WORKDIR}/sbin/mount/getmntopts.c" mount_fusefs/
+ epatch "${FILESDIR}"/${P}-gcc4.patch
+ epatch "${FILESDIR}"/${P}-ports.patch
+}
+
+src_compile() {
+ tc-export CC
+ $(get_bmake) \
+ KMODDIR=/boot/modules BINDIR=/usr/sbin MANDIR=/usr/share/man/man \
+ MOUNT="${WORKDIR}/sbin/mount" LDFLAGS="$(raw-ldflags)" \
+ || die "$(get_bmake) failed"
+}
+
+src_install() {
+ dodir /boot/modules
+ $(get_bmake) \
+ KMODDIR=/boot/modules BINDIR=/usr/sbin MANDIR=/usr/share/man/man \
+ DESTDIR="${D}" install \
+ || die "$(get_bmake) failed"
+
+ for docdir in ./ ./plaintext_out ./html_chunked_out ./html_aux; do
+ docinto ${docdir}
+ dodoc doc/${docdir}/*
+ done
+}
diff --git a/sys-fs/fuse4bsd/fuse4bsd-0.3.9_pre1.ebuild b/sys-fs/fuse4bsd/fuse4bsd-0.3.9_pre1.ebuild
new file mode 100644
index 000000000000..7b0dbafe770a
--- /dev/null
+++ b/sys-fs/fuse4bsd/fuse4bsd-0.3.9_pre1.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit portability toolchain-funcs eutils flag-o-matic
+
+DESCRIPTION="Fuse for FreeBSD"
+HOMEPAGE="http://fuse4bsd.creo.hu/"
+# -sbin is needed for getmntopts.c, hardcoding 6.2 is nasty but can't think of
+# any better solution right now
+SRC_URI="http://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/fuse4bsd/498acaef33b0.tar.gz
+ mirror://gentoo/freebsd-sbin-9.1.tar.bz2"
+S="${WORKDIR}/fuse4bsd-498acaef33b0"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~x86-fbsd"
+IUSE="doc"
+
+DEPEND=">=sys-freebsd/freebsd-sources-9.1
+ virtual/pmake
+ doc? ( app-text/deplate )"
+RDEPEND="sys-fs/fuse"
+
+QA_TEXTRELS="boot/modules/fuse.ko"
+
+src_prepare() {
+ cp /usr/include/fuse/fuse_kernel.h fuse_module/ || die
+ cp "${WORKDIR}/sbin/mount/getmntopts.c" mount_fusefs/ || die
+ epatch "${FILESDIR}"/${P}-ports.patch
+ epatch "${FILESDIR}"/${P}-fbsd91.patch
+ sed -i -e "s:^DEPLATE=.*:DEPLATE=${EPREFIX}/usr/bin/deplate:" \
+ doc/Makefile || die
+}
+
+src_compile() {
+ filter-ldflags "-Wl,--hash-style=*"
+ tc-export CC
+ cd "${S}"/fuse_module
+ $(get_bmake) \
+ KMODDIR=/boot/modules BINDIR=/usr/sbin MANDIR=/usr/share/man/man \
+ MOUNT="${WORKDIR}/sbin/mount" LDFLAGS="$(raw-ldflags)" \
+ || die "$(get_bmake) failed"
+
+ cd "${S}"/mount_fusefs
+ $(get_bmake) \
+ KMODDIR=/boot/modules BINDIR=/usr/sbin MANDIR=/usr/share/man/man \
+ MOUNT="${WORKDIR}/sbin/mount" \
+ || die "$(get_bmake) failed"
+
+ if use doc; then
+ cd "${S}"/doc
+ $(get_bmake) all || die "$(get_bmake) failed"
+ fi
+}
+
+src_install() {
+ dodir /boot/modules
+ $(get_bmake) \
+ KMODDIR=/boot/modules BINDIR=/usr/sbin MANDIR=/usr/share/man/man \
+ DESTDIR="${ED}" install \
+ || die "$(get_bmake) failed"
+
+ dodoc doc/{CREDITS,README}
+ if use doc; then
+ dodoc doc/plaintext_out/* doc/pdf_out/*.pdf
+ docinto html
+ dodoc doc/html_chunked_out/*
+ fi
+}
diff --git a/sys-fs/fuse4bsd/metadata.xml b/sys-fs/fuse4bsd/metadata.xml
new file mode 100644
index 000000000000..a00f3aeb1f81
--- /dev/null
+++ b/sys-fs/fuse4bsd/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>bsd@gentoo.org</email>
+ <name>BSD Project</name>
+</maintainer>
+</pkgmetadata>