From 56bd759df1d0c750a065b8c845e93d5dfa6b549d Mon Sep 17 00:00:00 2001
From: "Robin H. Johnson" <robbat2@gentoo.org>
Date: Sat, 8 Aug 2015 13:49:04 -0700
Subject: proj/gentoo: Initial commit
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.

This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.

Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
---
 sys-fs/fuse4bsd/Manifest                           |   4 +
 sys-fs/fuse4bsd/files/fuse4bsd-0.3.0-gcc4.patch    |  12 +
 sys-fs/fuse4bsd/files/fuse4bsd-0.3.0-ports.patch   | 491 +++++++++++++++++++++
 .../files/fuse4bsd-0.3.9_pre1-fbsd91.patch         |  15 +
 .../fuse4bsd/files/fuse4bsd-0.3.9_pre1-ports.patch | 475 ++++++++++++++++++++
 sys-fs/fuse4bsd/fuse4bsd-0.3.0.ebuild              |  51 +++
 sys-fs/fuse4bsd/fuse4bsd-0.3.9_pre1.ebuild         |  72 +++
 sys-fs/fuse4bsd/metadata.xml                       |   5 +
 8 files changed, 1125 insertions(+)
 create mode 100644 sys-fs/fuse4bsd/Manifest
 create mode 100644 sys-fs/fuse4bsd/files/fuse4bsd-0.3.0-gcc4.patch
 create mode 100644 sys-fs/fuse4bsd/files/fuse4bsd-0.3.0-ports.patch
 create mode 100644 sys-fs/fuse4bsd/files/fuse4bsd-0.3.9_pre1-fbsd91.patch
 create mode 100644 sys-fs/fuse4bsd/files/fuse4bsd-0.3.9_pre1-ports.patch
 create mode 100644 sys-fs/fuse4bsd/fuse4bsd-0.3.0.ebuild
 create mode 100644 sys-fs/fuse4bsd/fuse4bsd-0.3.9_pre1.ebuild
 create mode 100644 sys-fs/fuse4bsd/metadata.xml

(limited to 'sys-fs/fuse4bsd')

diff --git a/sys-fs/fuse4bsd/Manifest b/sys-fs/fuse4bsd/Manifest
new file mode 100644
index 000000000000..3d931909aa31
--- /dev/null
+++ b/sys-fs/fuse4bsd/Manifest
@@ -0,0 +1,4 @@
+DIST 498acaef33b0.tar.gz 116035 SHA256 3fff52dc292f481b4c51cad3e9cf5f8982e38a25e809ee986e8406c81aff0119 SHA512 6427d888cea5b1519c4ae92ec8ec640535692c59dd8ca987a32574050239c9ff4cb92a4cf6b34f3c1363becdd9fd75c031f5db4bda34b298898466066740845a WHIRLPOOL 4f78cb0228a73e76e15e6d85c2db94e1eaf75eb10507e533bb51c4a52092fc9c881187f10aca12bc89b791058790f9a84e139698e0e64ee602fe5efb3c03b82a
+DIST freebsd-sbin-6.2.tar.bz2 1162548 SHA256 aef424c07686bb72fbd06e4fd66a01b00bd36b70fec02ebdc228061cd4b435dd
+DIST freebsd-sbin-9.1.tar.bz2 1273913 SHA256 45008b0733b232ef03707ef5fa3e5c889e3b3728393d736bd9a869ea83be6447 SHA512 9f186602b7de96f268c352ca386986652fddf5570e7eca1afa8c0d2bdc83b57df1198efe47f36dd5c7a6abf4f9c935f1c8207a4a12a6b2153bd6c3c6292719dc WHIRLPOOL 20920dfa9607a0ce854319cef29bbd77fb1b31f6f6cfd5ac60cbd678169e43929e215743fe636d0c224443f3e6149a8f07c292d647f7f901592795ac292699f9
+DIST fuse4bsd-0.3.0.tar.gz 168068 SHA256 5ed1d9b0542d6962c135f6f2e8d296ab3feb51f239954cc6acc50833318854fe
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..af1892de220c
--- /dev/null
+++ b/sys-fs/fuse4bsd/fuse4bsd-0.3.0.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+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..ec1a8e38ba95
--- /dev/null
+++ b/sys-fs/fuse4bsd/fuse4bsd-0.3.9_pre1.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+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..ecedda4aa2cc
--- /dev/null
+++ b/sys-fs/fuse4bsd/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>bsd</herd>
+</pkgmetadata>
-- 
cgit v1.2.3-65-gdbad