diff --git a/sysutils/fusefs-kmod/Makefile b/sysutils/fusefs-kmod/Makefile index 7dddb6fc2cfc..d70fb4801270 100644 --- a/sysutils/fusefs-kmod/Makefile +++ b/sysutils/fusefs-kmod/Makefile @@ -6,19 +6,23 @@ # PORTNAME= fusefs -PORTVERSION= 0.3.0 -PORTREVISION= 5 +DISTVERSION= 0.3.9-pre1 CATEGORIES= sysutils kld MASTER_SITES= http://fuse4bsd.creo.hu/downloads/ \ http://am-productions.biz/docs/ PKGNAMESUFFIX= -kmod -DISTNAME= fuse4bsd-${PORTVERSION} +DISTNAME= fuse4bsd-${DISTVERSION} MAINTAINER= amistry@am-productions.biz COMMENT= Kernel module for fuse +USE_BZIP2= yes BUILD_DEPENDS= fusefs-libs>2.4.1:${PORTSDIR}/sysutils/fusefs-libs +.if !defined(NOPORTDOCS) +BUILD_DEPENDS+= deplate:${PORTSDIR}/textproc/ruby-deplate +.endif + MAKE_ENV= BINDIR="${PREFIX}/sbin" MANDIR="${PREFIX}/man/man" SRC_BASE?= /usr/src @@ -29,7 +33,7 @@ USE_RC_SUBR= fusefs SETUP= setup.sh MAN8= mount_fusefs.8 -TXT_DOCS= doc.txt +TXT_DOCS= doc.text HTML_DOCS= Faq.html \ Implementation.html \ Quickstart.html \ @@ -58,9 +62,18 @@ IGNORE= requires FreeBSD 6 or above. Please consider porting it to 5.x or even IGNORE= requires the Kernel source to be installed. Set SRC_BASE if it is not in /usr/src .endif +post-patch: + @${REINPLACE_CMD} -e 's/deplate.rb/deplate/g' \ + ${WRKSRC}/doc/Makefile + post-configure: @${CP} ${LOCALBASE}/include/fuse/fuse_kernel.h ${WRKSRC}/fuse_module +post-build: +.if !defined(NOPORTDOCS) + @cd ${WRKSRC}/doc && make plaintext html_chunked +.endif + pre-install: @${MKDIR} ${KMODDIR} diff --git a/sysutils/fusefs-kmod/distinfo b/sysutils/fusefs-kmod/distinfo index 8c2db5a54ff8..68019685a8b7 100644 --- a/sysutils/fusefs-kmod/distinfo +++ b/sysutils/fusefs-kmod/distinfo @@ -1,3 +1,3 @@ -MD5 (fuse4bsd-0.3.0.tar.gz) = 4295afdfb53133308abb7abf21f330c8 -SHA256 (fuse4bsd-0.3.0.tar.gz) = 5ed1d9b0542d6962c135f6f2e8d296ab3feb51f239954cc6acc50833318854fe -SIZE (fuse4bsd-0.3.0.tar.gz) = 168068 +MD5 (fuse4bsd-0.3.9-pre1.tar.bz2) = d427d6c831794f6d62ce1aef9f254f9e +SHA256 (fuse4bsd-0.3.9-pre1.tar.bz2) = e339fce188b3667ca267f8d672d3f9657d61e384d54997a93d64ddd178fd55d7 +SIZE (fuse4bsd-0.3.9-pre1.tar.bz2) = 112627 diff --git a/sysutils/fusefs-kmod/files/patch-fuse_module_fmaster.c b/sysutils/fusefs-kmod/files/patch-fuse_module_fmaster.c deleted file mode 100644 index a9a8f9fff734..000000000000 --- a/sysutils/fusefs-kmod/files/patch-fuse_module_fmaster.c +++ /dev/null @@ -1,29 +0,0 @@ ---- 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 \ No newline at end of file diff --git a/sysutils/fusefs-kmod/files/patch-fuse_module_fuse.c b/sysutils/fusefs-kmod/files/patch-fuse_module_fuse.c deleted file mode 100644 index 478186856248..000000000000 --- a/sysutils/fusefs-kmod/files/patch-fuse_module_fuse.c +++ /dev/null @@ -1,511 +0,0 @@ ---- fuse_module/fuse.c.orig Sat Feb 11 00:31:53 2006 -+++ fuse_module/fuse.c Fri May 25 14:54:26 2007 -@@ -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 - -@@ -2070,29 +2070,42 @@ - M_WAITOK | M_ZERO); - - err = getnewvnode("fuse", mp, &fuse_vnops, &rvp); -+ if (! err) { -+ err = vn_lock(rvp, LK_EXCLUSIVE | LK_RETRY, td); -+#if NEW_VNODES_ADJUSTED_MANUALLY -+ if (err) -+ printf("fuse4bsd: leaking vnode %p\n", rvp); -+#endif -+ } -+ -+ if (! err) { -+ /* -+ * FUSE_ROOT_ID as an inode number will be resolved directly. -+ * without resorting to the vfs hashing mechanism, thus it also -+ * can be inserted directly to the v_hash slot. -+ */ -+ rvp->v_hash = FUSE_ROOT_ID; -+ fmnt->rvp = rvp; -+ fuse_vnode_init(rvp, fvdat, FUSE_ROOT_ID, VNON); -+ rvp->v_vflag |= VV_ROOT; -+#if NEW_VNODES_ADJUSTED_MANUALLY -+ err = insmntque(rvp, mp); -+#endif -+ } - - if (err) { - fdata_kick_set(data); - sx_xunlock(slock); - FREE(fvdat, M_FUSEFS); - goto out; -- } -- -- /* -- * FUSE_ROOT_ID as an inode number will be resolved directly. -- * without resorting to the vfs hashing mechanism, thus it also -- * can be inserted directly to the v_hash slot. -- */ -- rvp->v_hash = FUSE_ROOT_ID; -- fmnt->rvp = rvp; -- fuse_vnode_init(rvp, fvdat, FUSE_ROOT_ID, VNON); -- rvp->v_vflag |= VV_ROOT; -+ } else -+ VOP_UNLOCK(rvp, 0, td); - - rootdone: - - 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 +2393,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 -@@ -2405,11 +2418,11 @@ - fuse_vget_i(struct mount *mp, struct thread *td, uint64_t nodeid, - enum vtype vtyp, struct vnode **vpp, int wantnew) - { -+#define myflags LK_EXCLUSIVE | LK_RETRY - int err = 0; - struct fuse_mnt_data *fmnt; - struct fuse_vnode_data *fvdat; - struct vnode *vp2; -- int myflags = LK_EXCLUSIVE; - - DEBUG2G("mp %p: %s\n", mp, mp->mnt_stat.f_mntfromname); - DEBUG("been asked for vno #%llu\n", (unsigned long long)nodeid); -@@ -2470,6 +2483,18 @@ - return (err); - } - -+#if NEW_VNODES_ADJUSTED_MANUALLY -+ err = vn_lock(*vpp, myflags, td); -+ if (err) -+ printf("fuse4bsd: leaking vnode %p\n", *vpp); -+ else -+ err = insmntque(*vpp, mp); -+ if (err) { -+ free(fvdat, M_FUSEFS); -+ return (err); -+ } -+#endif -+ - /* - * There is no harm in fully initializing the vnode before trying - * at insertion, because vnodes are gc-d anyway. For the same reason, -@@ -2504,6 +2529,7 @@ - vn_printf(*vpp, " * "); - #endif - return (err); -+#undef myflags - } - - -@@ -2654,7 +2680,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 +2777,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 +2974,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 +3082,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 +3307,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 +3377,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 +3516,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) -@@ -3567,7 +3597,20 @@ - bzero(fvdat, sizeof(*fvdat)); - fuse_vnode_init(vp, fvdat, feo->nodeid, VREG); - vp->v_op = &fuse_vnops; -+#if NEW_VNODES_ADJUSTED_MANUALLY -+ { -+ struct mount *mp = vp->v_mount; -+ -+ vp->v_mount = NULL; -+ err = insmntque(vp, mp); -+ if (err) { -+ free(fvdat, M_FUSEFS); -+ return (err); -+ } -+ } -+#else - VOP_UNLOCK(vp, 0, td); -+#endif - /* - * We can't let the vnode being vput() here, the caller wants - * that do by herself. -@@ -3643,7 +3686,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 +3752,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 +4227,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 -@@ -4215,11 +4258,9 @@ - #if _DEBUG - prettyprint(bp->b_data, 48); - printf("\n"); --#if ZERO_PAD_INCOMPLETE_BUFS - prettyprint(bp->b_data + PAGE_SIZE, 48); - printf("\n"); - #endif --#endif - if (err) { - brelse(bp); - return (err); -@@ -4493,13 +4534,6 @@ - break; - } - --#if ZERO_PAD_INCOMPLETE_BUFS -- if (isbzero(buf), FUSE_NAME_OFFSET) { -- err = -1; -- break; -- } --#endif -- - /* Sanity checks */ - - if (!fudge->namelen || fudge->namelen > MAXNAMLEN) { -@@ -4658,7 +4692,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; -@@ -4683,8 +4717,12 @@ - if ((err = getnewvnode("fuse", dvp->v_mount, &fuse_vnops, vpp))) - return (err); - -- if ((err = vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, curthread))) -+ if ((err = vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, curthread))) { -+#if NEW_VNODES_ADJUSTED_MANUALLY -+ printf("fuse4bsd: leaking vnode %p\n", *vpp); -+#endif - return (err); -+ } - - MALLOC(fvdat, struct fuse_vnode_data *, sizeof(*fvdat), M_FUSEFS, - M_WAITOK | M_ZERO); -@@ -4704,6 +4742,9 @@ - */ - (*vpp)->v_op = &fuse_germ_vnops; - (*vpp)->v_data = fvdat; -+#if NEW_VNODES_ADJUSTED_MANUALLY -+ (*vpp)->v_mount = dvp->v_mount; -+#endif - - return (0); - -@@ -4949,7 +4990,7 @@ - if (err) - goto out; - --#if ! DONT_DO_CHECKPATH -+#ifndef DONT_DO_CHECKPATH - if (doingdirectory && fdvp != tdvp) { - /* - * Check for pathname conflict. -@@ -5396,7 +5437,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 +5546,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,23 +5781,16 @@ - chunksize, (long long unsigned)fri->offset, respsize); - - if (respsize < chunksize) { --#if ZERO_PAD_INCOMPLETE_BUFS - /* -- * "if we don't get enough data, just fill the -- * rest with zeros." -- * in nfs context this means a hole in the -- * file, I don't know what to do with this -- * here... [we just get a buch of zeroes -- * instead of EOF, baaad] -+ * if we don't get enough data, just fill the -+ * rest with zeros. - */ - DEBUG("zeroing tail of %ld bytes\n", - bp->b_resid); - bzero((char *)bp->b_data + bp->b_bcount - bp->b_resid, - bp->b_resid); -- bp->b_resid = 0; --#else -+ - break; --#endif - } - ticket_refresh(fdi.tick); - DEBUG("bp->b_data %p\n", bp->b_data); -@@ -5888,7 +5921,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 +5941,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 +6052,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; -@@ -6089,7 +6092,7 @@ - - /* Registering the module */ - --static struct vfsconf fuse_vfsconf = { -+struct vfsconf fuse_vfsconf = { - .vfc_version = VFS_VERSION, - .vfc_name = "fusefs", - .vfc_vfsops = &fuse_vfsops, diff --git a/sysutils/fusefs-kmod/files/patch-fuse_module_fuse.h b/sysutils/fusefs-kmod/files/patch-fuse_module_fuse.h index f3a16fe7eb4a..75257347f9ef 100644 --- a/sysutils/fusefs-kmod/files/patch-fuse_module_fuse.h +++ b/sysutils/fusefs-kmod/files/patch-fuse_module_fuse.h @@ -1,120 +1,36 @@ ---- fuse_module/fuse.h.orig Thu May 3 13:26:25 2007 -+++ fuse_module/fuse.h Thu May 3 13:26:03 2007 -@@ -8,7 +8,15 @@ +--- fuse_module/fuse.h.orig Tue Jun 19 14:35:22 2007 ++++ fuse_module/fuse.h Sat Jul 14 13:23:37 2007 +@@ -33,6 +33,24 @@ + #endif + #endif - #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 ++#ifndef USE_PRIVILEGE_API ++/* ++ * __FreeBSD_version bump was omitted for introduction of ++ * the privilege API (both when it's been added and when the ++ * legacy API has been removed), so here we just use the first ++ * value of __FreeBSD_version after adding the priv stuff. ++ */ ++#if __FreeBSD_version >= 700025 ++#define USE_PRIVILEGE_API 1 ++#else ++#define USE_PRIVILEGE_API 0 +#endif +#endif ++#if ! USE_PRIVILEGE_API ++#define priv_check(td, priv) suser(td) ++#define priv_check_cred(cred, priv, flag) suser_cred(cred, SUSER_ALLOWJAIL) ++#endif + -+#ifndef NEW_VNODES_ADJUSTED_MANUALLY -+#if __FreeBSD_version >= 700034 -+#define NEW_VNODES_ADJUSTED_MANUALLY 1 -+#else -+#define NEW_VNODES_ADJUSTED_MANUALLY 0 - #endif - #endif - -@@ -19,10 +27,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 +83,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 +259,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 +268,9 @@ - - /* Debug related stuff */ - -+#ifndef DEBUGTOLOG -+#define DEBUGTOLOG 0 -+#endif - #if DEBUGTOLOG - #define dprintf(args ...) log(LOG_DEBUG, args) - #else -@@ -267,6 +278,9 @@ - #endif - - #define DEBLABEL "[fuse-debug] " -+#ifndef _DEBUG -+#define _DEBUG 0 -+#endif - #if _DEBUG - #ifndef _DEBUG2G - #define _DEBUG2G 1 -@@ -280,6 +294,9 @@ - #define DEBUG(args ...) - #endif - -+#ifndef _DEBUG2G -+#define _DEBUG2G 0 -+#endif - #if _DEBUG2G - #ifndef _DEBUG3G - #define _DEBUG3G 1 -@@ -290,6 +307,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 +317,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 +345,7 @@ + /* + * Appearance of new FUSE operations is not always in par with version + * numbering... At least, 7.3 is a sufficient condition for having +@@ -210,7 +228,7 @@ void fprettyprint(struct fuse_iov *fiov, size_t dlen); #endif --#if IGNORE_INLINE -+#ifdef IGNORE_INLINE - #define __inline +-#if _DEBUG || _DEBUG2G || _DEBUG3G || defined(INVARIANTS) ++#if _DEBUG || _DEBUG2G || _DEBUG3G || defined(INVARIANTS) || FUSELIB_CONFORM_BIOREAD + int isbzero(void *buf, size_t len); #endif diff --git a/sysutils/fusefs-kmod/files/patch-fuse_module_fuse_subr.c b/sysutils/fusefs-kmod/files/patch-fuse_module_fuse_subr.c deleted file mode 100644 index f7ea550b1384..000000000000 --- a/sysutils/fusefs-kmod/files/patch-fuse_module_fuse_subr.c +++ /dev/null @@ -1,15 +0,0 @@ ---- 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/sysutils/fusefs-kmod/files/patch-fuse_vfsops.c b/sysutils/fusefs-kmod/files/patch-fuse_vfsops.c new file mode 100644 index 000000000000..b57a73828ac6 --- /dev/null +++ b/sysutils/fusefs-kmod/files/patch-fuse_vfsops.c @@ -0,0 +1,63 @@ +--- fuse_module/fuse_vfsops.c Sat Jul 14 13:13:55 2007 ++++ fuse_module/fuse_vfsops.c Sat Jul 14 13:13:55 2007 +@@ -23,6 +23,20 @@ + #include "fuse_session.h" + #include "fuse_vnode.h" + ++#if USE_PRIVILEGE_API ++#include ++#endif ++ ++ ++/* This will do for privilege types for now */ ++#ifndef PRIV_VFS_FUSE_ALLOWOTHER ++#define PRIV_VFS_FUSE_ALLOWOTHER PRIV_VFS_MOUNT_NONUSER ++#endif ++#ifndef PRIV_VFS_FUSE_MOUNT_NONUSER ++#define PRIV_VFS_FUSE_MOUNT_NONUSER PRIV_VFS_MOUNT_NONUSER ++#endif ++ ++ + static int fuse_init_handler(struct fuse_ticket *tick, struct uio *uio); + static void fuse_send_init(struct fuse_data *data, struct thread *td); + static vfs_hash_cmp_t fuse_vnode_bgdrop_cmp; +@@ -207,10 +221,8 @@ fuse_mount(struct mount *mp, struct thre + KASSERT(fuse_useco >= 0, + ("negative fuse usecount despite Giant")); + +- if (mp->mnt_flag & MNT_UPDATE) { +- uprintf("fuse: updating mounts is not supported\n"); ++ if (mp->mnt_flag & MNT_UPDATE) + return (EOPNOTSUPP); +- } + + mp->mnt_flag |= MNT_SYNCHRONOUS; + /* Get the new options passed to mount */ +@@ -293,10 +305,8 @@ fuse_mount(struct mount *mp, struct thre + + if (fdata_kick_get(data)) + err = ENOTCONN; +- if (mntopts & FSESS_DAEMON_CAN_SPY && suser(td)) { +- uprintf("only root can use \"allow_other\"\n"); +- err = EPERM; +- } ++ if (mntopts & FSESS_DAEMON_CAN_SPY) ++ err = priv_check(td, PRIV_VFS_FUSE_ALLOWOTHER); + + slock = &data->mhierlock; + /* Note that sx_try_xlock returns 0 on _failure_ */ +@@ -334,10 +344,9 @@ fuse_mount(struct mount *mp, struct thre + */ + err = EINVAL; + } else { +- if (suser(td) && +- td->td_ucred->cr_uid != data->daemoncred->cr_uid) +- /* we are not allowed to do the first mount */ +- err = EPERM; ++ if (td->td_ucred->cr_uid != data->daemoncred->cr_uid) ++ /* are we allowed to do the first mount? */ ++ err = priv_check(td, PRIV_VFS_FUSE_MOUNT_NONUSER); + } + + if (err) { + diff --git a/sysutils/fusefs-kmod/files/patch-fuse_vnops.c b/sysutils/fusefs-kmod/files/patch-fuse_vnops.c new file mode 100644 index 000000000000..a6e6b031b3a2 --- /dev/null +++ b/sysutils/fusefs-kmod/files/patch-fuse_vnops.c @@ -0,0 +1,106 @@ +--- fuse_module/fuse_vnops.c Sat Jul 14 13:14:27 2007 ++++ fuse_module/fuse_vnops.c Sat Jul 14 13:14:27 2007 +@@ -42,6 +42,10 @@ + #include "fuse_vnode.h" + #include "fuse_io.h" + ++#if USE_PRIVILEGE_API ++#include ++#endif ++ + /* function prototype for iterators over filehandles (of a vp) */ + typedef int fuse_metrics_t(struct vnode *vp, struct thread *td, + struct ucred *cred, struct fuse_filehandle *fufh, +@@ -63,7 +67,9 @@ struct fuse_access_param { + #define FACCESS_CHOWN 0x08 /* do permission check for owner changing */ + #define FACCESS_NOCHECKSPY 0x10 /* don't check if daemon is allowed to spy on + user */ +-#define FACCESS_XQUERIES FACCESS_STICKY | FACCESS_CHOWN ++#define FACCESS_SETGID 0x12 /* do permission check for setting setgid flag */ ++ ++#define FACCESS_XQUERIES FACCESS_STICKY | FACCESS_CHOWN | FACCESS_SETGID + + #define FVP_ACCESS_NOOP 0x01 /* vnode based control flag for doing access check */ + +@@ -855,6 +861,7 @@ fuse_access(ap) + + /* + * Attribute caching hasn't yet been implemented. ++ * [... Update: it _has been_ implemented.] + * However, within one function we don't wanna query attributes + * several times. Now it's enough pull the attributes once, and throw + * it into the following routine with various modes. +@@ -929,12 +936,16 @@ fuse_access_i(struct vnode *vp, mode_t m + mode == VWRITE) { + if (cred->cr_uid != facp->xuid && + cred->cr_uid != VTOVA(vp)->va_uid) +- err = suser_cred(cred, SUSER_ALLOWJAIL); ++ err = priv_check_cred(cred, ++ PRIV_VFS_ADMIN, ++ 0); + } + /* + * We return here because this flags is exlusive + * with the others + */ ++ KASSERT(facp->facc_flags == FACCESS_STICKY, ++ ("sticky access check comes in mixed")); + return (err); + } + +@@ -947,10 +958,21 @@ fuse_access_i(struct vnode *vp, mode_t m + (cred->cr_gid != facp->xgid && + facp->xgid != (gid_t)VNOVAL && + ! groupmember(facp->xgid, cred))) +- err = suser_cred(cred, SUSER_ALLOWJAIL); +- return (err); ++ err = priv_check_cred(cred, PRIV_VFS_CHOWN, 0); ++ if (err) ++ return (err); + } + ++ if (facp->facc_flags & FACCESS_SETGID) { ++ gid_t sgid = facp->xgid; ++ ++ if (sgid == (gid_t)VNOVAL) ++ sgid = VTOVA(vp)->va_gid; ++ ++ if (! groupmember(sgid, cred)) ++ err = priv_check_cred(cred, PRIV_VFS_SETGID, 0); ++ return (err); ++ } + + } else { + #if FUSE_HAS_ACCESS +@@ -1234,7 +1256,13 @@ fuse_lookup(ap) + */ + if (nameiop == RENAME && wantparent && islastcn) { + DEBUG("something to rename...\n"); +- if ((err = fuse_access_i(dvp, VWRITE, cred, td, &facp))) ++ ++ facp.xuid = fattr->uid; ++ facp.facc_flags |= FACCESS_STICKY; ++ err = fuse_access_i(dvp, VWRITE, cred, td, &facp); ++ facp.facc_flags &= ~FACCESS_XQUERIES; ++ ++ if (err) + goto out; + + /* +@@ -2948,8 +2976,14 @@ fuse_setattr(ap) + } + + if (vap->va_mode != (mode_t)VNOVAL) { ++#if _DEBUG + if (vap->va_mode & S_IFMT) +- DEBUG("fuse_setattr -- weird: format bits in mode field, 0%o\n", vap->va_mode); ++ DEBUG("fuse_setattr -- weird: " ++ "format bits in mode field, 0%o\n", ++ vap->va_mode); ++#endif ++ if (vap->va_mode & S_ISGID) ++ facp.facc_flags |= FACCESS_SETGID; + fsai->FUSEATTR(mode) = vap->va_mode & ALLPERMS; + fsai->valid |= FATTR_MODE; + } + diff --git a/sysutils/fusefs-kmod/files/patch-mount_fusefs-mount_fusefs.c b/sysutils/fusefs-kmod/files/patch-mount_fusefs-mount_fusefs.c new file mode 100644 index 000000000000..b5f3e946c72b --- /dev/null +++ b/sysutils/fusefs-kmod/files/patch-mount_fusefs-mount_fusefs.c @@ -0,0 +1,11 @@ +--- mount_fusefs/mount_fusefs.c Sat Jul 14 13:12:09 2007 ++++ mount_fusefs/mount_fusefs.c Sat Jul 14 13:12:09 2007 +@@ -469,7 +469,8 @@ showversion(void) + int + init_backgrounded(void) + { +- int ibg, len; ++ int ibg; ++ size_t len; + + len = sizeof(ibg); diff --git a/sysutils/fusefs-kmod/pkg-plist b/sysutils/fusefs-kmod/pkg-plist index 79d69f1567fb..ddbf08852533 100644 --- a/sysutils/fusefs-kmod/pkg-plist +++ b/sysutils/fusefs-kmod/pkg-plist @@ -2,7 +2,7 @@ modules/fuse.ko sbin/mount_fusefs @unexec kldxref %D/modules @dirrmtry modules -%%PORTDOCS%%%%DOCSDIR%%/kmod/doc.txt +%%PORTDOCS%%%%DOCSDIR%%/kmod/doc.text %%PORTDOCS%%%%DOCSDIR%%/kmod/html/Faq.html %%PORTDOCS%%%%DOCSDIR%%/kmod/html/Implementation.html %%PORTDOCS%%%%DOCSDIR%%/kmod/html/Quickstart.html