sysutils/fusefs-kmod: backport 10.x-integrated code for 8.x and 9.x

submitter takes over as maintainer

PR:		184042
Submitted by:	dpejesh@yahoo.com
Approved by:	mirror176@cox.net (maintainer timeout)
This commit is contained in:
Kurt Jaeger 2014-08-03 22:04:34 +00:00
parent 3330ce6d74
commit f18ad55f8d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=363947
22 changed files with 446 additions and 662 deletions

View File

@ -1,113 +1,70 @@
# Created by: Anish Mistry <amistry@am-productions.biz>
# $FreeBSD$
PORTNAME= fusefs
DISTVERSION= 0.3.9-pre1.20080208
PORTREVISION= 11
CATEGORIES= sysutils
MASTER_SITES= http://mercurial.creo.hu/repos/fuse4bsd-hg/index.cgi/archive/ \
http://mirrors.rit.edu/zi/fuse4bsd/ \
LOCAL/bdrewery/${PORTNAME}/
PKGNAMESUFFIX= -kmod
DISTNAME= ${HG_SHORTREV}
DIST_SUBDIR= fuse4bsd
PORTNAME= fusefs-kmod
PORTVERSION= 0.263233
CATEGORIES= sysutils kld
MAINTAINER= mirror176@cox.net
COMMENT= Kernel module for fuse
MAINTAINER= dpejesh@yahoo.com
COMMENT= FUSE kernel module
MASTER_SITES= https://googledrive.com/host/0B0OQnKtejJEMQlpoTy11SG1nN2s/
ONLY_FOR_ARCHS= amd64 i386
WRKSRC= ${WRKDIR}
USE_RC_SUBR= fusefs
USES= kmod uidfix
BUILD_DEPENDS= fusefs-libs>2.4.1:${PORTSDIR}/sysutils/fusefs-libs
USE_RC_SUBR= fusefs
KMODDIR= ${PREFIX}/modules
MAKE_ENV= BINDIR="${PREFIX}/sbin" MANDIR="${MANPREFIX}/man/man" \
MOUNT="${SRC_BASE}/sbin/mount"
WRKSRC= ${WRKDIR}/fuse4bsd-${HG_SHORTREV}
DISABLE_SIZE= yes
MAKE_ENV= BINDIR="${PREFIX}/sbin" \
MANDIR="${MANPREFIX}/man/man"
OPTIONS_DEFINE= AUTOSETUP DOCS
AUTOSETUP_DESC= Automatic global config file setup
USES= kmod uidfix
DOCS_BUILD_DEPENDS= deplate:${PORTSDIR}/textproc/ruby-deplate
SUB_LIST+= KMODDIR=${KMODDIR}
SUB_FILES= pkg-message
.include <bsd.port.pre.mk>
SETUP= setup.sh
HG_SHORTREV= 498acaef33b0
TXT_DOCS= doc.text
HTML_DOCS= Faq.html \
Implementation.html \
Quickstart.html \
article.css \
deplate-mini.png \
deplate.css \
doc.html \
heading-navbar.css \
home-grey.png \
mailto.png \
next-grey.png \
prev-grey.png \
remote.png \
serif.css \
tabbar-right.css
.if ${OSVERSION} >= 900040
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-fuse_module__fuse_vnops.c
.if ${OSVERSION} >= 800000 && ${OSVERSION} < 900000
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-8-fuse_vfsops.c
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-8-fuse_vnops.c
.endif
.if ${OSVERSION} >= 1000011
EXTRA_PATCHES+= ${FILESDIR}/extrapatch-fuse_module__fuse_vnops.c
.if ${OSVERSION} >= 900000 && ${OSVERSION} < 1000000
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-9-fuse_vfsops.c
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-9-fuse_vnops.c
.endif
.if exists(${SRC_BASE}/sys/fs/fuse)
.if ${OSVERSION} >= 1000000
IGNORE= integrated into base
.endif
.if !exists(${SRC_BASE}/sbin/mount)
IGNORE= requires the userland sources to be installed. Set SRC_BASE if it is not in /usr/src
.endif
.if ${ARCH} != "i386" && ${ARCH} != "amd64"
BROKEN= Does not compile on other than i386/amd64
.endif
do-build:
cd ${WRKDIR}/modules/fuse; ${MAKE}
cd ${WRKDIR}/mount_fusefs; ${MAKE}
.if ${PORT_OPTIONS:MAUTOSETUP}
SUB_FILES+= ${SETUP}
.else
SUB_FILES+= pkg-message
.endif
post-patch:
@${REINPLACE_CMD} -e 's/deplate.rb/deplate/g' \
${WRKSRC}/doc/Makefile
@${REINPLACE_CMD} -e 's|-I../inc|-I${SRC_BASE}/sys -I../inc|g' \
${WRKSRC}/mount_fusefs/Makefile
post-configure:
@${CP} ${LOCALBASE}/include/fuse/fuse_kernel.h ${WRKSRC}/fuse_module
post-build:
.if ${PORT_OPTIONS:MDOCS}
@cd ${WRKSRC}/doc && make plaintext html_chunked
.endif
do-install:
${INSTALL_KLD} ${WRKSRC}/modules/fuse/fuse.ko ${STAGEDIR}${KMODDIR}
${INSTALL_MAN} ${WRKSRC}/mount_fusefs/mount_fusefs.8 ${STAGEDIR}${PREFIX}/man/man8
${INSTALL_PROGRAM} ${WRKSRC}/mount_fusefs/mount_fusefs ${STAGEDIR}${PREFIX}/sbin
post-install:
${MKDIR} ${STAGEDIR}/usr/sbin
(cd ${STAGEDIR} && ${LN} -fs ${PREFIX}/sbin/mount_fusefs \
usr/sbin/mount_fusefs)
.if ${PORT_OPTIONS:MAUTOSETUP} && !defined(PACKAGE_BUILDING)
@${ECHO} "Modifying global startup config files and loading module..."
@${SH} ${WRKDIR}/${SETUP}
.endif
${CAT} ${PKGMESSAGE}
.if ${PORT_OPTIONS:MDOCS}
${MKDIR} ${STAGEDIR}${DOCSDIR}/kmod/html
.for i in ${TXT_DOCS}
${INSTALL_DATA} ${WRKSRC}/doc/plaintext_out/$i ${STAGEDIR}${DOCSDIR}/kmod
.endfor
.for i in ${HTML_DOCS}
${INSTALL_DATA} ${WRKSRC}/doc/html_chunked_out/$i ${STAGEDIR}${DOCSDIR}/kmod/html
.endfor
.endif
SVN_REV= 263233
SVN_MIRROR?= http://svn.freebsd.org/base
EXPDIR= ${WRKSRC}/src
maintainer-tar:
${MKDIR} ${EXPDIR}
cd ${EXPDIR} && svn export -r ${SVN_REV} ${SVN_MIRROR}/head/sys/fs/fuse/ fs/fuse
cd ${EXPDIR} && svn export -r ${SVN_REV} ${SVN_MIRROR}/head/sys/modules/fuse/ modules/fuse
cd ${EXPDIR} && svn export -r ${SVN_REV} ${SVN_MIRROR}/head/sbin/mount_fusefs mount_fusefs
cd ${EXPDIR} && svn export -r ${SVN_REV} ${SVN_MIRROR}/head/sbin/mount/getmntopts.c mount_fusefs/getmntopts.c
cd ${EXPDIR} && svn export -r ${SVN_REV} ${SVN_MIRROR}/head/sbin/mount/mntopts.h mount_fusefs/
cd ${EXPDIR} && ${TAR} --uname root --uid 0 --gname wheel --gid 0 -zcvf ${DISTDIR}/${PORTNAME}-0.${SVN_REV}${EXTRACT_SUFX} fs modules mount_fusefs
maintainer-check:
@new=`svn log -ql 1 ${SVN_MIRROR}@HEAD head/sys/fs/fuse | ${GREP} -v ^- | ${SED} -e 's| .*||; s|r||'`;\
old="${SVN_REV}";\
if [ "$${new}" -gt "$${old}" ]; then ${ECHO_MSG} "New fuse rev: r$${new} (was $${old})"; fi
.include <bsd.port.post.mk>

View File

@ -1,2 +1,2 @@
SHA256 (fuse4bsd/498acaef33b0.tar.gz) = 3fff52dc292f481b4c51cad3e9cf5f8982e38a25e809ee986e8406c81aff0119
SIZE (fuse4bsd/498acaef33b0.tar.gz) = 116035
SHA256 (fusefs-kmod-0.263233.tar.gz) = 68e0e5505cab651d089e6b0824b779676ae2a07d264724844f4980ffd6032933
SIZE (fusefs-kmod-0.263233.tar.gz) = 58262

View File

@ -0,0 +1,47 @@
--- fs/fuse/fuse_vfsops.c.orig
+++ fs/fuse/fuse_vfsops.c
@@ -62,8 +62,8 @@
#include <sys/errno.h>
#include <sys/param.h>
#include <sys/kernel.h>
-#include <sys/capsicum.h>
#include <sys/conf.h>
+#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/uio.h>
#include <sys/malloc.h>
@@ -206,7 +206,7 @@
{
int err;
- uint64_t mntopts, __mntopts;
+ u_int mntopts, __mntopts;
int max_read_set;
uint32_t max_read;
int daemon_timeout;
@@ -220,7 +220,6 @@
struct file *fp, *fptmp;
char *fspec, *subtype;
struct vfsoptlist *opts;
- cap_rights_t rights;
subtype = NULL;
max_read_set = 0;
@@ -290,7 +289,7 @@
FS_DEBUG2G("mntopts 0x%jx\n", (uintmax_t)mntopts);
- err = fget(td, fd, cap_rights_init(&rights, CAP_READ), &fp);
+ err = fget(td, fd, &fp);
if (err != 0) {
FS_DEBUG("invalid or not opened device: data=%p\n", data);
goto out;
@@ -459,7 +458,7 @@
FUSE_UNLOCK();
VOP_UNLOCK(*vpp, 0);
vrele(*vpp);
- vrecycle(*vpp);
+ vrecycle(*vpp, curthread);
*vpp = data->vroot;
} else
FUSE_UNLOCK();

View File

@ -0,0 +1,146 @@
--- fs/fuse/fuse_vnops.c.orig
+++ fs/fuse/fuse_vnops.c
@@ -190,10 +190,10 @@
int fuse_pbuf_freecnt = -1;
-#define fuse_vm_page_lock(m) vm_page_lock((m));
-#define fuse_vm_page_unlock(m) vm_page_unlock((m));
-#define fuse_vm_page_lock_queues() ((void)0)
-#define fuse_vm_page_unlock_queues() ((void)0)
+#define fuse_vm_page_lock(m) ((void)0)
+#define fuse_vm_page_unlock(m) ((void)0)
+#define fuse_vm_page_lock_queues() vm_page_lock_queues()
+#define fuse_vm_page_unlock_queues() vm_page_unlock_queues()
/*
struct vnop_access_args {
@@ -579,7 +579,7 @@
}
if ((fvdat->flag & FN_REVOKED) != 0 && fuse_reclaim_revoked) {
- vrecycle(vp);
+ vrecycle(vp, curthread);
}
return 0;
}
@@ -706,7 +706,7 @@
op = FUSE_GETATTR;
goto calldaemon;
} else if (fuse_lookup_cache_enable) {
- err = cache_lookup(dvp, vpp, cnp, NULL, NULL);
+ err = cache_lookup(dvp, vpp, cnp);
switch (err) {
case -1: /* positive match */
@@ -1758,7 +1758,7 @@
* can only occur at the file EOF.
*/
- VM_OBJECT_WLOCK(vp->v_object);
+ VM_OBJECT_LOCK(vp->v_object);
fuse_vm_page_lock_queues();
if (pages[ap->a_reqpage]->valid != 0) {
for (i = 0; i < npages; ++i) {
@@ -1769,11 +1769,11 @@
}
}
fuse_vm_page_unlock_queues();
- VM_OBJECT_WUNLOCK(vp->v_object);
+ VM_OBJECT_UNLOCK(vp->v_object);
return 0;
}
fuse_vm_page_unlock_queues();
- VM_OBJECT_WUNLOCK(vp->v_object);
+ VM_OBJECT_UNLOCK(vp->v_object);
/*
* We use only the kva address for the buffer, but this is extremely
@@ -1803,7 +1803,7 @@
if (error && (uio.uio_resid == count)) {
FS_DEBUG("error %d\n", error);
- VM_OBJECT_WLOCK(vp->v_object);
+ VM_OBJECT_LOCK(vp->v_object);
fuse_vm_page_lock_queues();
for (i = 0; i < npages; ++i) {
if (i != ap->a_reqpage) {
@@ -1813,7 +1813,7 @@
}
}
fuse_vm_page_unlock_queues();
- VM_OBJECT_WUNLOCK(vp->v_object);
+ VM_OBJECT_UNLOCK(vp->v_object);
return VM_PAGER_ERROR;
}
/*
@@ -1823,7 +1823,7 @@
*/
size = count - uio.uio_resid;
- VM_OBJECT_WLOCK(vp->v_object);
+ VM_OBJECT_LOCK(vp->v_object);
fuse_vm_page_lock_queues();
for (i = 0, toff = 0; i < npages; i++, toff = nextoff) {
vm_page_t m;
@@ -1843,7 +1843,7 @@
* Read operation filled a partial page.
*/
m->valid = 0;
- vm_page_set_valid_range(m, 0, size - toff);
+ vm_page_set_valid(m, 0, size - toff);
KASSERT(m->dirty == 0,
("fuse_getpages: page %p is dirty", m));
} else {
@@ -1854,11 +1854,36 @@
*/
;
}
- if (i != ap->a_reqpage)
- vm_page_readahead_finish(m);
+ if (i != ap->a_reqpage) {
+ /*
+ * whether or not to leave the page activated is up in
+ * the air, but we should put the page on a page queue
+ * somewhere. (it already is in the object). Result:
+ * It appears that empirical results show that
+ * deactivating pages is best.
+ */
+
+ /*
+ * just in case someone was asking for this page we
+ * now tell them that it is ok to use
+ */
+ if (!error) {
+#ifdef VPO_WANTED
+ if (m->oflags & VPO_WANTED)
+#else
+ if (m->flags & PG_WANTED)
+#endif
+ vm_page_activate(m);
+ else
+ vm_page_deactivate(m);
+ vm_page_wakeup(m);
+ } else {
+ vm_page_free(m);
+ }
+ }
}
fuse_vm_page_unlock_queues();
- VM_OBJECT_WUNLOCK(vp->v_object);
+ VM_OBJECT_UNLOCK(vp->v_object);
return 0;
}
@@ -1947,9 +1972,9 @@
for (i = 0; i < nwritten; i++) {
rtvals[i] = VM_PAGER_OK;
- VM_OBJECT_WLOCK(pages[i]->object);
+ VM_OBJECT_LOCK(pages[i]->object);
vm_page_undirty(pages[i]);
- VM_OBJECT_WUNLOCK(pages[i]->object);
+ VM_OBJECT_UNLOCK(pages[i]->object);
}
}
return rtvals[0];

View File

@ -0,0 +1,37 @@
--- fs/fuse/fuse_vfsops.c.orig
+++ fs/fuse/fuse_vfsops.c
@@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$");
#include <sys/errno.h>
#include <sys/param.h>
#include <sys/kernel.h>
-#include <sys/capsicum.h>
+#include <sys/capability.h>
#include <sys/conf.h>
#include <sys/filedesc.h>
#include <sys/uio.h>
@@ -220,7 +220,6 @@ fuse_vfsop_mount(struct mount *mp)
struct file *fp, *fptmp;
char *fspec, *subtype;
struct vfsoptlist *opts;
- cap_rights_t rights;
subtype = NULL;
max_read_set = 0;
@@ -290,7 +289,7 @@ fuse_vfsop_mount(struct mount *mp)
FS_DEBUG2G("mntopts 0x%jx\n", (uintmax_t)mntopts);
- err = fget(td, fd, cap_rights_init(&rights, CAP_READ), &fp);
+ err = fget(td, fd, CAP_READ, &fp);
if (err != 0) {
FS_DEBUG("invalid or not opened device: data=%p\n", data);
goto out;
@@ -459,7 +458,7 @@ fuse_vfsop_root(struct mount *mp, int lkflags, struct vnode **vpp)
FUSE_UNLOCK();
VOP_UNLOCK(*vpp, 0);
vrele(*vpp);
- vrecycle(*vpp);
+ vrecycle(*vpp, curthread);
*vpp = data->vroot;
} else
FUSE_UNLOCK();

View File

@ -0,0 +1,134 @@
--- fs/fuse/fuse_vnops.c.orig
+++ fs/fuse/fuse_vnops.c
@@ -579,7 +579,7 @@ fuse_vnop_inactive(struct vop_inactive_args *ap)
}
if ((fvdat->flag & FN_REVOKED) != 0 && fuse_reclaim_revoked) {
- vrecycle(vp);
+ vrecycle(vp, curthread);
}
return 0;
}
@@ -706,7 +706,7 @@ fuse_vnop_lookup(struct vop_lookup_args *ap)
op = FUSE_GETATTR;
goto calldaemon;
} else if (fuse_lookup_cache_enable) {
- err = cache_lookup(dvp, vpp, cnp, NULL, NULL);
+ err = cache_lookup(dvp, vpp, cnp);
switch (err) {
case -1: /* positive match */
@@ -1758,7 +1758,7 @@ fuse_vnop_getpages(struct vop_getpages_args *ap)
* can only occur at the file EOF.
*/
- VM_OBJECT_WLOCK(vp->v_object);
+ VM_OBJECT_LOCK(vp->v_object);
fuse_vm_page_lock_queues();
if (pages[ap->a_reqpage]->valid != 0) {
for (i = 0; i < npages; ++i) {
@@ -1769,11 +1769,11 @@ fuse_vnop_getpages(struct vop_getpages_args *ap)
}
}
fuse_vm_page_unlock_queues();
- VM_OBJECT_WUNLOCK(vp->v_object);
+ VM_OBJECT_UNLOCK(vp->v_object);
return 0;
}
fuse_vm_page_unlock_queues();
- VM_OBJECT_WUNLOCK(vp->v_object);
+ VM_OBJECT_UNLOCK(vp->v_object);
/*
* We use only the kva address for the buffer, but this is extremely
@@ -1803,7 +1803,7 @@ fuse_vnop_getpages(struct vop_getpages_args *ap)
if (error && (uio.uio_resid == count)) {
FS_DEBUG("error %d\n", error);
- VM_OBJECT_WLOCK(vp->v_object);
+ VM_OBJECT_LOCK(vp->v_object);
fuse_vm_page_lock_queues();
for (i = 0; i < npages; ++i) {
if (i != ap->a_reqpage) {
@@ -1813,7 +1813,7 @@ fuse_vnop_getpages(struct vop_getpages_args *ap)
}
}
fuse_vm_page_unlock_queues();
- VM_OBJECT_WUNLOCK(vp->v_object);
+ VM_OBJECT_UNLOCK(vp->v_object);
return VM_PAGER_ERROR;
}
/*
@@ -1823,7 +1823,7 @@ fuse_vnop_getpages(struct vop_getpages_args *ap)
*/
size = count - uio.uio_resid;
- VM_OBJECT_WLOCK(vp->v_object);
+ VM_OBJECT_LOCK(vp->v_object);
fuse_vm_page_lock_queues();
for (i = 0, toff = 0; i < npages; i++, toff = nextoff) {
vm_page_t m;
@@ -1843,7 +1843,7 @@ fuse_vnop_getpages(struct vop_getpages_args *ap)
* Read operation filled a partial page.
*/
m->valid = 0;
- vm_page_set_valid_range(m, 0, size - toff);
+ vm_page_set_valid(m, 0, size - toff);
KASSERT(m->dirty == 0,
("fuse_getpages: page %p is dirty", m));
} else {
@@ -1854,11 +1854,39 @@ fuse_vnop_getpages(struct vop_getpages_args *ap)
*/
;
}
- if (i != ap->a_reqpage)
- vm_page_readahead_finish(m);
+ if (i != ap->a_reqpage) {
+ /*
+ * whether or not to leave the page activated is up in
+ * the air, but we should put the page on a page queue
+ * somewhere. (it already is in the object). Result:
+ * It appears that empirical results show that
+ * deactivating pages is best.
+ */
+
+ /*
+ * just in case someone was asking for this page we
+ * now tell them that it is ok to use
+ */
+ if (!error) {
+ if (m->oflags & VPO_WANTED) {
+ vm_page_lock(m);
+ vm_page_activate(m);
+ vm_page_unlock(m);
+ } else {
+ vm_page_lock(m);
+ vm_page_deactivate(m);
+ vm_page_unlock(m);
+ }
+ vm_page_wakeup(m);
+ } else {
+ vm_page_lock(m);
+ vm_page_free(m);
+ vm_page_unlock(m);
+ }
+ }
}
fuse_vm_page_unlock_queues();
- VM_OBJECT_WUNLOCK(vp->v_object);
+ VM_OBJECT_UNLOCK(vp->v_object);
return 0;
}
@@ -1947,9 +1975,9 @@ fuse_vnop_putpages(struct vop_putpages_args *ap)
for (i = 0; i < nwritten; i++) {
rtvals[i] = VM_PAGER_OK;
- VM_OBJECT_WLOCK(pages[i]->object);
+ VM_OBJECT_LOCK(pages[i]->object);
vm_page_undirty(pages[i]);
- VM_OBJECT_WUNLOCK(pages[i]->object);
+ VM_OBJECT_UNLOCK(pages[i]->object);
}
}
return rtvals[0];

View File

@ -1,11 +0,0 @@
--- 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;

View File

@ -1,11 +0,0 @@
--- fuse_module/fuse_vnops.c.orig 2012-05-11 14:59:59.000000000 +0800
+++ fuse_module/fuse_vnops.c 2012-05-11 15:00:05.000000000 +0800
@@ -663,7 +663,7 @@
if ((err = fuse_recyc_backend(vp, td)))
return err;
- vrecycle(vp, td);
+ vrecycle(vp);
return (0);
}

View File

@ -27,7 +27,7 @@
name="fusefs"
rcvar=fusefs_enable
kmod="%%PREFIX%%/modules/fuse.ko"
kmod="%%KMODDIR%%/fuse.ko"
start_cmd="fusefs_start"
stop_cmd="fusefs_stop"

View File

@ -0,0 +1,14 @@
--- fs/fuse/fuse_io.c.orig
+++ fs/fuse/fuse_io.c
@@ -785,9 +785,9 @@ fuse_io_invalbuf(struct vnode *vp, struct thread *td)
fvdat->flag |= FN_FLUSHINPROG;
if (vp->v_bufobj.bo_object != NULL) {
- VM_OBJECT_WLOCK(vp->v_bufobj.bo_object);
+ VM_OBJECT_LOCK(vp->v_bufobj.bo_object);
vm_object_page_clean(vp->v_bufobj.bo_object, 0, 0, OBJPC_SYNC);
- VM_OBJECT_WUNLOCK(vp->v_bufobj.bo_object);
+ VM_OBJECT_UNLOCK(vp->v_bufobj.bo_object);
}
error = vinvalbuf(vp, V_SAVE, PCATCH, 0);
while (error) {

View File

@ -1,18 +0,0 @@
--- 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)

View File

@ -1,40 +0,0 @@
--- 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

View File

@ -1,31 +0,0 @@
--- 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);

View File

@ -1,133 +0,0 @@
--- 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);

View File

@ -1,14 +0,0 @@
--- 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;

View File

@ -1,122 +0,0 @@
--- 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"));

View File

@ -1,89 +0,0 @@
--- ./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;

View File

@ -0,0 +1,11 @@
--- fs/fuse/fuse_node.c.orig
+++ fs/fuse/fuse_node.c
@@ -362,7 +362,7 @@ fuse_vnode_setsize(struct vnode *vp, struct ucred *cred, off_t newsize)
fvdat->flag |= FN_SIZECHANGE;
if (newsize < oldsize) {
- err = vtruncbuf(vp, cred, newsize, fuse_iosize(vp));
+ err = vtruncbuf(vp, cred, curthread, newsize, fuse_iosize(vp));
}
vnode_pager_setsize(vp, newsize);
return err;

View File

@ -1,23 +0,0 @@
--- 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)

View File

@ -1,52 +0,0 @@
#!/bin/sh
#
# Automatically setup the loading of the module without polluting /boot/modules
SYSCTL_CONFIG=/etc/sysctl.conf
LOADER_CONFIG=/etc/rc.conf
sysctl kern.module_path | grep "[:space:;=]%%PREFIX%%/modules[;]\?\b" > /dev/null 2>&1; RESULT=$?
if [ ${RESULT} -eq 1 ]; then
MODULE_PATH="`sysctl -n kern.module_path`;%%PREFIX%%/modules"
sysctl "kern.module_path=${MODULE_PATH}"
else
MODULE_PATH=`sysctl -n kern.module_path`
fi
grep "kern\.module_path" ${SYSCTL_CONFIG} > /dev/null 2>&1; RESULT=$?
if [ ${RESULT} -eq 0 ]; then
# Variable present
grep "kern\.module_path" ${SYSCTL_CONFIG} | grep "[:space:;=]%%PREFIX%%/modules[;]\?\b" ${SYSCTL_CONFIG} > /dev/null 2>&1; RESULT=$?
if [ ${RESULT} -eq 1 ]; then
# Not present in variable, so add
ESC_PREFIX=`echo '%%PREFIX%%' | sed -e 's/\//\\\\\//g'`
sed -i .orig -e 's/kern\.module_path[:space:]*=[:space:]*["]*\([[:alnum:][:space:]\.,;\/_-]*\)["]*/kern\.module_path="\1;'${ESC_PREFIX}'\/modules"/g' ${SYSCTL_CONFIG}
fi
else
# Not present.
echo kern.module_path="${MODULE_PATH}" >> ${SYSCTL_CONFIG}
fi
kldstat -n fuse > /dev/null 2>&1; RESULT=$?
if [ ${RESULT} -eq 0 ]; then
kldunload -n fuse > /dev/null 2>&1; RESULT=$?
if [ ${RESULT} -ne 0 ]; then
echo 'NOTICE: Failed to unload the Fuse module!'
echo 'NOTICE: Is fuse.ko in use?'
fi
fi
grep fusefs_enable ${LOADER_CONFIG} > /dev/null 2>&1; RESULT=$?
if [ ${RESULT} -eq 0 ]; then
# Present, we should leave it alone
# sed -e s/fusefs_enable.*/fuse_load=\"YES\"/g -i.orig ${LOADER_CONFIG}
else
# Not present. First time install, so lets start it up
echo 'fusefs_enable="YES"' >> ${LOADER_CONFIG}
fi
kldload fuse > /dev/null 2>&1 ; RESULT=$?
if [ ${RESULT} -ne 0 ]; then
echo 'NOTICE: Failed to load the Fuse module!'
echo 'NOTICE: Unload and load Fuse module manually, or reboot.'
fi

View File

@ -1,3 +1,3 @@
Kernel module for fusefs based filesystems.
Kernel module for fusefs based filesystems,
backported from 10.x to 8.x and 9.x.
WWW: http://fuse4bsd.creo.hu/

View File

@ -1,24 +1,6 @@
sbin/mount_fusefs
man/man8/mount_fusefs.8.gz
%%PORTDOCS%%%%DOCSDIR%%/kmod/doc.text
%%PORTDOCS%%%%DOCSDIR%%/kmod/html/Faq.html
%%PORTDOCS%%%%DOCSDIR%%/kmod/html/Implementation.html
%%PORTDOCS%%%%DOCSDIR%%/kmod/html/Quickstart.html
%%PORTDOCS%%%%DOCSDIR%%/kmod/html/article.css
%%PORTDOCS%%%%DOCSDIR%%/kmod/html/deplate-mini.png
%%PORTDOCS%%%%DOCSDIR%%/kmod/html/deplate.css
%%PORTDOCS%%%%DOCSDIR%%/kmod/html/doc.html
%%PORTDOCS%%%%DOCSDIR%%/kmod/html/heading-navbar.css
%%PORTDOCS%%%%DOCSDIR%%/kmod/html/home-grey.png
%%PORTDOCS%%%%DOCSDIR%%/kmod/html/mailto.png
%%PORTDOCS%%%%DOCSDIR%%/kmod/html/next-grey.png
%%PORTDOCS%%%%DOCSDIR%%/kmod/html/prev-grey.png
%%PORTDOCS%%%%DOCSDIR%%/kmod/html/remote.png
%%PORTDOCS%%%%DOCSDIR%%/kmod/html/serif.css
%%PORTDOCS%%%%DOCSDIR%%/kmod/html/tabbar-right.css
%%PORTDOCS%%@dirrm %%DOCSDIR%%/kmod/html
%%PORTDOCS%%@dirrm %%DOCSDIR%%/kmod
%%PORTDOCS%%@dirrmtry %%DOCSDIR%%
sbin/mount_fusefs
@exec ln -fs %D/%F /usr/sbin
@unexec rm -f /usr/sbin/mount_fusefs
@cwd /
usr/sbin/mount_fusefs
%%KMODDIR%%/fuse.ko