diff options
Diffstat (limited to 'sysutils/fusefs-kmod/files')
| -rw-r--r-- | sysutils/fusefs-kmod/files/fusefs.in | 6 | ||||
| -rw-r--r-- | sysutils/fusefs-kmod/files/patch-fuse_io.c | 35 | ||||
| -rw-r--r-- | sysutils/fusefs-kmod/files/patch-fuse_module_Makefile | 18 | ||||
| -rw-r--r-- | sysutils/fusefs-kmod/files/patch-fuse_module_fuse.h | 36 | ||||
| -rw-r--r-- | sysutils/fusefs-kmod/files/patch-fuse_vfsops.c | 108 | ||||
| -rw-r--r-- | sysutils/fusefs-kmod/files/patch-fuse_vnops.c | 211 | ||||
| -rw-r--r-- | sysutils/fusefs-kmod/files/patch-mount_fusefs-mount_fusefs.c | 21 | ||||
| -rw-r--r-- | sysutils/fusefs-kmod/files/pkg-message.in | 5 | ||||
| -rw-r--r-- | sysutils/fusefs-kmod/files/setup.sh.in (renamed from sysutils/fusefs-kmod/files/setup.sh) | 10 |
9 files changed, 10 insertions, 440 deletions
diff --git a/sysutils/fusefs-kmod/files/fusefs.in b/sysutils/fusefs-kmod/files/fusefs.in index 62fd25827654..3b5d97afacbc 100644 --- a/sysutils/fusefs-kmod/files/fusefs.in +++ b/sysutils/fusefs-kmod/files/fusefs.in @@ -40,13 +40,13 @@ fusefs_stop() return 1 fi echo "Stopping ${name}." -# Unmount FUSE filesystems in reverse order (in case they are nested) with -# a delay of one second after, to allow 'umount' finish. +# Unmount FUSE filesystems in reverse order (in case they are nested) to +# allow recent FUSE implementation to synchronize disks before shutdown. mount | sed -e '1!G;h;$!d' | while read dev d1 mountpoint d2; do case "$dev" in /dev/fuse[0-9]*) echo "fusefs: unmounting ${mountpoint}." - umount $mountpoint ; sleep 1 + umount $mountpoint ;; esac done diff --git a/sysutils/fusefs-kmod/files/patch-fuse_io.c b/sysutils/fusefs-kmod/files/patch-fuse_io.c deleted file mode 100644 index 11797d848847..000000000000 --- a/sysutils/fusefs-kmod/files/patch-fuse_io.c +++ /dev/null @@ -1,35 +0,0 @@ ---- fuse_module/fuse_io.c.orig 2007-06-19 16:35:22.000000000 +0400 -+++ fuse_module/fuse_io.c 2008-01-20 20:47:05.000000000 +0300 -@@ -139,7 +139,11 @@ - struct vnode *vp = fp->f_vnode; - int err = 0; - -+#if __FreeBSD_version > 800009 -+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); -+#else - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); -+#endif - - ASSERT_VOP_LOCKED__FH(vp); - if (_file_is_bad(fp) || ! _file_is_fat(fp)) { -@@ -148,7 +152,7 @@ - } - - if (uio->uio_resid == 0) -- return (0); -+ goto out; - - if (uio->uio_rw == UIO_WRITE && fp->f_flag & O_APPEND) { - if ((err = VOP_GETATTR(vp, &va, cred, td))) -@@ -166,7 +170,11 @@ - fp->f_nextoff = uio->uio_offset; - - out: -+#if __FreeBSD_version > 800009 -+ VOP_UNLOCK(vp, 0); -+#else - VOP_UNLOCK(vp, 0, td); -+#endif - - DEBUG("leaving with %d\n", err); - return (err); diff --git a/sysutils/fusefs-kmod/files/patch-fuse_module_Makefile b/sysutils/fusefs-kmod/files/patch-fuse_module_Makefile deleted file mode 100644 index 4da86f55b6dc..000000000000 --- a/sysutils/fusefs-kmod/files/patch-fuse_module_Makefile +++ /dev/null @@ -1,18 +0,0 @@ ---- fuse_module/Makefile.orig 2007-06-19 14:35:22.000000000 +0200 -+++ fuse_module/Makefile 2007-08-16 18:31:50.000000000 +0200 -@@ -21,7 +21,14 @@ - .endif - - .if defined(KERNCONF) --KERNCONFDIR= /usr/obj/usr/src/sys/${KERNCONF} -+.if !defined(MAKEOBJDIRPREFIX) -+MAKEOBJDIRPREFIX=/usr/obj -+.endif -+.if !defined(SRC_BASE) -+SRC_BASE=/usr/src -+.endif -+KERNCONF1!= echo ${KERNCONF} | sed -e 's/ .*//g' -+KERNCONFDIR= ${MAKEOBJDIRPREFIX}${SRC_BASE}/sys/${KERNCONF1} - .endif - - .if defined(KERNCONFDIR) diff --git a/sysutils/fusefs-kmod/files/patch-fuse_module_fuse.h b/sysutils/fusefs-kmod/files/patch-fuse_module_fuse.h deleted file mode 100644 index 75257347f9ef..000000000000 --- a/sysutils/fusefs-kmod/files/patch-fuse_module_fuse.h +++ /dev/null @@ -1,36 +0,0 @@ ---- 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_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 -+ - /* - * 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 _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_vfsops.c b/sysutils/fusefs-kmod/files/patch-fuse_vfsops.c deleted file mode 100644 index 194a910effbc..000000000000 --- a/sysutils/fusefs-kmod/files/patch-fuse_vfsops.c +++ /dev/null @@ -1,108 +0,0 @@ ---- fuse_module/fuse_vfsops.c.orig 2007-06-19 16:35:22.000000000 +0400 -+++ fuse_module/fuse_vfsops.c 2008-01-20 20:39:38.000000000 +0300 -@@ -23,6 +23,18 @@ - #include "fuse_session.h" - #include "fuse_vnode.h" - -+#if USE_PRIVILEGE_API -+#include <sys/priv.h> -+#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 +219,8 @@ - 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 +303,8 @@ - - 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 +342,9 @@ - */ - 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) { -@@ -370,7 +377,11 @@ - - err = getnewvnode("fuse", mp, &fuse_vnops, &rvp); - if (! err) { -+#if __FreeBSD_version > 800009 -+ err = vn_lock(rvp, LK_EXCLUSIVE | LK_RETRY); -+#else - err = vn_lock(rvp, LK_EXCLUSIVE | LK_RETRY, td); -+#endif - #if NEW_VNODES_ADJUSTED_MANUALLY - if (err) - printf("fuse4bsd: leaking vnode %p\n", rvp); -@@ -398,7 +409,11 @@ - free(fvdat, M_FUSEVN); - goto out; - } else -+#if __FreeBSD_version > 800009 -+ VOP_UNLOCK(rvp, 0); -+#else - VOP_UNLOCK(rvp, 0, td); -+#endif - - data->mp = mp; - data->mpri = FM_PRIMARY; -@@ -582,7 +597,11 @@ - - vp = data->rvp; - vref(vp); -+#if __FreeBSD_version > 800009 -+ vn_lock(vp, flags | LK_RETRY); -+#else - vn_lock(vp, flags | LK_RETRY, td); -+#endif - if (vp->v_type == VNON) { - struct vattr va; - -@@ -808,7 +827,11 @@ - } - - #if NEW_VNODES_ADJUSTED_MANUALLY -+#if __FreeBSD_version > 800009 -+ err = vn_lock(*vpp, myflags); -+#else - err = vn_lock(*vpp, myflags, td); -+#endif - if (err) - printf("fuse4bsd: leaking vnode %p\n", *vpp); - else diff --git a/sysutils/fusefs-kmod/files/patch-fuse_vnops.c b/sysutils/fusefs-kmod/files/patch-fuse_vnops.c deleted file mode 100644 index 905630bcb351..000000000000 --- a/sysutils/fusefs-kmod/files/patch-fuse_vnops.c +++ /dev/null @@ -1,211 +0,0 @@ ---- fuse_module/fuse_vnops.c.orig 2007-06-19 16:35:22.000000000 +0400 -+++ fuse_module/fuse_vnops.c 2008-01-20 20:45:28.000000000 +0300 -@@ -42,6 +42,10 @@ - #include "fuse_vnode.h" - #include "fuse_io.h" - -+#if USE_PRIVILEGE_API -+#include <sys/priv.h> -+#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 @@ - #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 @@ - - /* - * 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 @@ - 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 @@ - (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 @@ - */ - 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; - - /* -@@ -1270,12 +1298,20 @@ - * If doing dotdot, we unlock dvp for vget time - * to conform lock order regulations. - */ -+#if __FreeBSD_version > 800009 -+ VOP_UNLOCK(dvp, 0); -+#else - VOP_UNLOCK(dvp, 0, td); -+#endif - err = fuse_vget_i(dvp->v_mount, td, nid, - IFTOVT(fattr->mode), &vp, VG_NORMAL, - parentid); - if (flags & ISDOTDOT) -+#if __FreeBSD_version > 800009 -+ vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); -+#else - vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td); -+#endif - if (err) - goto out; - *vpp = vp; -@@ -1540,7 +1576,11 @@ - cache_attrs(vp, feo); - - try_insert: -+#if __FreeBSD_version > 800009 -+ VOP_UNLOCK(vp, 0); -+#else - VOP_UNLOCK(vp, 0, td); -+#endif - /* - * We can't let the vnode being vput() here, the caller wants - * that do by herself. -@@ -1555,7 +1595,11 @@ - - #if NEW_VNODES_ADJUSTED_MANUALLY - if (! err) { -+#if __FreeBSD_version > 800009 -+ err = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); -+#else - err = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); -+#endif - if (err) - printf("fuse4bsd: leaking vnode %p\n", vp); - else { -@@ -1928,7 +1972,11 @@ - if (! _file_is_fat(fp)) - panic("non-fat file passed to close routine"); - -+#if __FreeBSD_version > 800009 -+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); -+#else - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); -+#endif - - if (_file_is_bad(fp)) { - DEBUG2G("fp %p, vnode #%llu: went bad, giving up\n", -@@ -2371,8 +2419,11 @@ - */ - if ((err = getnewvnode("fuse", dvp->v_mount, &fuse_vnops, vpp))) - return (err); -- -+#if __FreeBSD_version > 800009 -+ if ((err = vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY))) { -+#else - if ((err = vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, curthread))) { -+#endif - #if NEW_VNODES_ADJUSTED_MANUALLY - printf("fuse4bsd: leaking vnode %p\n", *vpp); - #endif -@@ -2719,7 +2770,11 @@ - * No LK_RETRY. See discussion in thread - * http://thread.gmane.org/gmane.os.dragonfly-bsd.kernel/8952/focus=8964 - */ -+#if __FreeBSD_version > 800009 -+ err = vn_lock(fvp, LK_EXCLUSIVE); -+#else - err = vn_lock(fvp, LK_EXCLUSIVE, td); -+#endif - if (err) - goto out; - -@@ -2730,7 +2785,11 @@ - if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') - || fdvp == fvp - || ((fcnp->cn_flags | tcnp->cn_flags) & ISDOTDOT)) { -+#if __FreeBSD_version > 800009 -+ VOP_UNLOCK(fvp, 0); -+#else - VOP_UNLOCK(fvp, 0, td); -+#endif - err = EINVAL; - goto out; - } -@@ -2748,7 +2807,11 @@ - */ - err = fuse_access_i(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_thread, &facp); - fnid = VTOI(fvp); -+#if __FreeBSD_version > 800009 -+ VOP_UNLOCK(fvp, 0); -+#else - VOP_UNLOCK(fvp, 0, td); -+#endif - if (err) - goto out; - -@@ -2948,8 +3011,14 @@ - } - - 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 deleted file mode 100644 index dad69c8ea9b0..000000000000 --- a/sysutils/fusefs-kmod/files/patch-mount_fusefs-mount_fusefs.c +++ /dev/null @@ -1,21 +0,0 @@ ---- mount_fusefs/mount_fusefs.c.orig Tue Jun 19 09:35:22 2007 -+++ mount_fusefs/mount_fusefs.c Thu Dec 13 02:44:12 2007 -@@ -70,6 +70,8 @@ - { "user_id=", 0, 0x00, 1 }, - { "group_id=", 0, 0x00, 1 }, - { "large_read", 0, 0x00, 1 }, -+ /* "nonempty", just the first two chars are stripped off during parsing */ -+ { "nempty", 0, 0x00, 1 }, - MOPT_STDOPTS, - MOPT_END - }; -@@ -469,7 +471,8 @@ - int - init_backgrounded(void) - { -- int ibg, len; -+ int ibg; -+ size_t len; - - len = sizeof(ibg); - diff --git a/sysutils/fusefs-kmod/files/pkg-message.in b/sysutils/fusefs-kmod/files/pkg-message.in index 81b4143ab9e7..1d40884834ab 100644 --- a/sysutils/fusefs-kmod/files/pkg-message.in +++ b/sysutils/fusefs-kmod/files/pkg-message.in @@ -13,8 +13,7 @@ Now fuse filesystems (sysutils/fusefs-*) can be mounted at startup from named "mount_<fstype>", which is not created by all the fusefs ports. Note that the rc.d script will unmount all fuse filesystems when called with -"stop", so it can unload the kernel module, and as a temporary workaround to -flush cache in drivers like NTFS-3G (sysutils/fusefs-ntfs) at shutdown (until -a proper solution is implemented). +"stop" (in reverse order in case of nested mounts), so it can unload the +kernel module. ============================================================================== diff --git a/sysutils/fusefs-kmod/files/setup.sh b/sysutils/fusefs-kmod/files/setup.sh.in index eb7c403fcc70..99a873fccde5 100644 --- a/sysutils/fusefs-kmod/files/setup.sh +++ b/sysutils/fusefs-kmod/files/setup.sh.in @@ -4,9 +4,9 @@ SYSCTL_CONFIG=/etc/sysctl.conf LOADER_CONFIG=/etc/rc.conf -sysctl kern.module_path | grep "[:space:;=]@@PREFIX@@/modules[;]\?\b" > /dev/null 2>&1; RESULT=$? +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" + MODULE_PATH="`sysctl -n kern.module_path`;%%PREFIX%%/modules" sysctl "kern.module_path=${MODULE_PATH}" else MODULE_PATH=`sysctl -n kern.module_path` @@ -15,10 +15,10 @@ 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=$? + 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'` + 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 @@ -45,7 +45,7 @@ else echo 'fusefs_enable="YES"' >> ${LOADER_CONFIG} fi -@@PREFIX@@/etc/rc.d/fusefs start > /dev/null 2>&1 ; RESULT=$? +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.' |
