Date: Sun, 29 May 2011 10:46:30 GMT From: Ilya Putsikau <ilya@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 193888 for review Message-ID: <201105291046.p4TAkUkS077535@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@193888?ac=10 Change 193888 by ilya@ilya_triton2011 on 2011/05/29 10:45:46 Remove support for FreeBSD versions < 800087 Affected files ... .. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse.h#3 edit .. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_dev.c#3 edit .. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_io.c#3 edit .. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_main.c#3 edit .. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_vfsops.c#3 edit .. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_vnops.c#3 edit Differences ... ==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse.h#3 (text+ko) ==== @@ -11,86 +11,6 @@ #define FUSE_KERNELABI_GEQ(maj, min) \ (FUSE_KERNEL_VERSION > (maj) || (FUSE_KERNEL_VERSION == (maj) && FUSE_KERNEL_MINOR_VERSION >= (min))) -#ifndef USE_OLD_CLONEHANDLER_API -#if __FreeBSD_version < 600034 || ( __FreeBSD_version >= 700000 && __FreeBSD_version < 700002 ) -#define USE_OLD_CLONEHANDLER_API -#endif -#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 - -#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 -#else -#define VOP_OPEN_TAKES_FP 0 -#endif -#endif - -#ifndef VN_LOCK_TAKES_THREAD -#if __FreeBSD_version >= 800010 -#define VN_LOCK_TAKES_THREAD 0 -#else -#define VN_LOCK_TAKES_THREAD 1 -#endif -#endif - -#ifndef VOP_UNLOCK_TAKES_THREAD -#if __FreeBSD_version >= 800011 -#define VOP_UNLOCK_TAKES_THREAD 0 -#else -#define VOP_UNLOCK_TAKES_THREAD 1 -#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 - * 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 ==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_dev.c#3 (text+ko) ==== @@ -37,12 +37,8 @@ static d_read_t fusedev_read; static d_write_t fusedev_write; -#ifdef USE_OLD_CLONEHANDLER_API -void fusedev_clone(void *arg, char *name, int namelen, struct cdev **dev); -#else void fusedev_clone(void *arg, struct ucred *cred, char *name, int namelen, struct cdev **dev); -#endif static struct cdevsw fuse_cdevsw = { .d_open = fusedev_open, @@ -488,14 +484,9 @@ * Modeled after tunclone() of net/if_tun.c ... * boosted with a hack so that devices can be reused. */ -#ifdef USE_OLD_CLONEHANDLER_API void -fusedev_clone(void *arg, char *name, int namelen, struct cdev **dev) -#else -void fusedev_clone(void *arg, struct ucred *cred, char *name, int namelen, struct cdev **dev) -#endif { /* * Why cloning? We do need per-open info, but we could as well put our ==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_io.c#3 (text+ko) ==== @@ -143,11 +143,7 @@ struct vnode *vp, *ovl_vp = fp->f_vnode; int err = 0; - vn_lock(ovl_vp, LK_EXCLUSIVE | LK_RETRY -#if VN_LOCK_TAKES_THREAD - , td -#endif - ); + vn_lock(ovl_vp, LK_EXCLUSIVE | LK_RETRY); if (_file_is_bad(fp) || ! _file_is_fat(fp)) { err = EBADF; @@ -161,11 +157,7 @@ goto out; if (uio->uio_rw == UIO_WRITE && fp->f_flag & O_APPEND) { - if ((err = VOP_GETATTR(vp, &va, cred -#if VOP_GETATTR_TAKES_THREAD - , td -#endif - ))) + if ((err = VOP_GETATTR(vp, &va, cred))) goto out; uio->uio_offset = va.va_size; } else if ((flags & FOF_OFFSET) == 0) @@ -179,11 +171,7 @@ fp->f_nextoff = uio->uio_offset; out: - VOP_UNLOCK(ovl_vp, 0 -#if VOP_UNLOCK_TAKES_THREAD - , td -#endif - ); + VOP_UNLOCK(ovl_vp, 0); DEBUG("leaving with %d\n", err); return (err); } @@ -831,11 +819,7 @@ #if FUSELIB_CONFORM_BIOREAD struct vattr va; - if ((err = VOP_GETATTR(vp, &va, cred -#if VOP_GETATTR_TAKES_THREAD - , curthread -#endif - ))) + if ((err = VOP_GETATTR(vp, &va, cred))) goto out; #endif ==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_main.c#3 (text+ko) ==== @@ -31,12 +31,8 @@ #endif -#ifdef USE_OLD_CLONEHANDLER_API -extern void fusedev_clone(void *arg, char *name, int namelen, struct cdev **dev); -#else extern void fusedev_clone(void *arg, struct ucred *cred, char *name, int namelen, struct cdev **dev); -#endif extern struct vfsops fuse_vfsops; extern struct cdevsw fuse_cdevsw; ==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_vfsops.c#3 (text+ko) ==== @@ -24,12 +24,8 @@ #include "fuse_session.h" #include "fuse_vnode.h" -#if USE_PRIVILEGE_API #include <sys/priv.h> #include <security/mac/mac_framework.h> -#else -#include <sys/mac.h> -#endif /* This will do for privilege types for now */ @@ -214,14 +210,9 @@ * 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; @@ -427,15 +418,9 @@ err = getnewvnode("fuse", mp, &fuse_vnops, &rvp); if (! err) { - err = vn_lock(rvp, LK_EXCLUSIVE | LK_RETRY -#if VN_LOCK_TAKES_THREAD - , td -#endif - ); -#if NEW_VNODES_ADJUSTED_MANUALLY + err = vn_lock(rvp, LK_EXCLUSIVE | LK_RETRY); if (err) printf("fuse4bsd: leaking vnode %p\n", rvp); -#endif } if (! err) { @@ -448,9 +433,7 @@ data->rvp = rvp; fuse_vnode_init(rvp, fvdat, FUSE_ROOT_ID, VNON, 0); rvp->v_vflag |= VV_ROOT; -#if NEW_VNODES_ADJUSTED_MANUALLY err = insmntque(rvp, mp); -#endif } if (err) { @@ -459,11 +442,7 @@ free(fvdat, M_FUSEVN); goto out; } else - VOP_UNLOCK(rvp, 0 -#if VOP_UNLOCK_TAKES_THREAD - , td -#endif - ); + VOP_UNLOCK(rvp, 0); data->mp = mp; data->mpri = FM_PRIMARY; data->dataflag |= mntopts; @@ -536,14 +515,9 @@ * 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; @@ -646,17 +620,12 @@ /* 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. */ + struct thread *td = curthread; struct fuse_data *data = fusefs_get_data(mp); struct vnode *vp; @@ -669,11 +638,7 @@ data = fsdat->master; sx_slock(&data->mhierlock); if (data->mpri == FM_PRIMARY) - err = fuse_root(data->mp, flags, vpp -#if VFSOPS_TAKES_THREAD - , td -#endif - ); + err = fuse_root(data->mp, flags, vpp); else err = ENXIO; sx_sunlock(&data->mhierlock); @@ -682,19 +647,11 @@ vp = data->rvp; vref(vp); - vn_lock(vp, flags | LK_RETRY -#if VN_LOCK_TAKES_THREAD - , td -#endif - ); + vn_lock(vp, flags | LK_RETRY); if (vp->v_type == VNON) { struct vattr va; - (void)VOP_GETATTR(vp, &va, td->td_ucred -#if VOP_GETATTR_TAKES_THREAD - , td -#endif - ); + (void)VOP_GETATTR(vp, &va, td->td_ucred); } *vpp = vp; #if _DEBUG2G @@ -705,14 +662,9 @@ } 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; @@ -729,11 +681,7 @@ sx_slock(&data->mhierlock); if (data->mpri == FM_PRIMARY) - err = fuse_statfs(data->mp, sbp -#if VFSOPS_TAKES_THREAD - , td -#endif - ); + err = fuse_statfs(data->mp, sbp); else err = ENXIO; sx_sunlock(&data->mhierlock); @@ -831,11 +779,7 @@ if (nodeid == FUSE_ROOT_ID) { if (parentid != FUSE_NULL_ID) return (ENOENT); - err = VFS_ROOT(mp, myflags, vpp -#if VFSOPS_TAKES_THREAD - , td -#endif - ); + err = VFS_ROOT(mp, myflags, vpp); if (err) return (err); KASSERT(*vpp, ("we neither err'd nor found the root node")); @@ -929,12 +873,7 @@ return (err); } -#if NEW_VNODES_ADJUSTED_MANUALLY - err = vn_lock(*vpp, myflags -#if VN_LOCK_TAKES_THREAD - , td -#endif - ); + err = vn_lock(*vpp, myflags); if (err) printf("fuse4bsd: leaking vnode %p\n", *vpp); else @@ -943,7 +882,6 @@ free(fvdat, M_FUSEVN); return (err); } -#endif /* * There is no harm in fully initializing the vnode before trying ==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_vnops.c#3 (text+ko) ==== @@ -42,9 +42,7 @@ #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 fuse_filehandle *fufh, struct thread *td, @@ -799,11 +797,7 @@ 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; @@ -893,12 +887,7 @@ else facp.facc_flags |= FACCESS_DO_ACCESS; - return fuse_access_i(vp, -#if VOP_ACCESS_TAKES_ACCMODE_T - ap->a_accmode, -#else - ap->a_mode, -#endif + return fuse_access_i(vp, ap->a_accmode, ap->a_cred, ap->a_td, &facp); } @@ -959,11 +948,7 @@ /* We are to do the check in-kernel */ if (! (facp->facc_flags & FACCESS_VA_VALID)) { - err = VOP_GETATTR(vp, VTOVA(vp), cred -#if VOP_GETATTR_TAKES_THREAD - , td -#endif - ); + err = VOP_GETATTR(vp, VTOVA(vp), cred); if (err) return (err); facp->facc_flags |= FACCESS_VA_VALID; @@ -1345,20 +1330,12 @@ * If doing dotdot, we unlock dvp for vget time * to conform lock order regulations. */ - VOP_UNLOCK(dvp, 0 -#if VOP_UNLOCK_TAKES_THREAD - , td -#endif - ); + VOP_UNLOCK(dvp, 0); err = fuse_vget_i(dvp->v_mount, td, nid, IFTOVT(fattr->mode), &vp, VG_NORMAL, parentid); if (flags & ISDOTDOT) - vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY -#if VN_LOCK_TAKES_THREAD - , td -#endif - ); + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); if (err) goto out; *vpp = vp; @@ -1625,11 +1602,7 @@ cache_attrs(vp, feo); try_insert: - VOP_UNLOCK(vp, 0 -#if VOP_UNLOCK_TAKES_THREAD - , td -#endif - ); + VOP_UNLOCK(vp, 0); /* * We can't let the vnode being vput() here, the caller wants * that do by herself. @@ -1642,13 +1615,8 @@ if (! err && clashvp) fuse_vnode_teardown(clashvp, td, cred, VREG); -#if NEW_VNODES_ADJUSTED_MANUALLY if (! err) { - err = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY -#if VN_LOCK_TAKES_THREAD - , td -#endif - ); + err = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (err) printf("fuse4bsd: leaking vnode %p\n", vp); else { @@ -1658,7 +1626,6 @@ err = insmntque(vp, mp); } } -#endif if (! err) err = vfs_hash_insert(vp, feo->nodeid, LK_EXCLUSIVE, td, @@ -1887,11 +1854,7 @@ struct fuse_filehandle *fufh = NULL; int err = 0; -#if VOP_OPEN_TAKES_FP struct file *fp = ap->a_fp; -#else - struct file *fp = NULL; -#endif struct get_filehandle_param gefhp; /* @@ -1900,19 +1863,6 @@ * keep_cache information (and act according to it). */ -#if ! VOP_OPEN_TAKES_FP - if (ap->a_fdidx >= 0) { - /* - * That certain "pretty disgustingly long chain" - * by which we can put our hands of the file struct - * assinged to this call. - */ - fp = td->td_proc->p_fd->fd_ofiles[ap->a_fdidx]; - if (! fp) - panic("nonneg file desc passed to us but no file there"); - } -#endif - #if _DEBUG2G if (fp) DEBUG2G("fp->f_flag %#x, open mode %d\n", fp->f_flag, mode); @@ -1946,11 +1896,7 @@ * 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; } @@ -2039,11 +1985,7 @@ if (! _file_is_fat(fp)) panic("non-fat file passed to close routine"); - vn_lock(ovl_vp, LK_EXCLUSIVE | LK_RETRY -#if VN_LOCK_TAKES_THREAD - , td -#endif - ); + vn_lock(ovl_vp, LK_EXCLUSIVE | LK_RETRY); if (_file_is_bad(fp)) { DEBUG2G("fp %p, (overlay) vnode %p: went bad, giving up\n", @@ -2483,14 +2425,8 @@ if ((err = getnewvnode("fuse", dvp->v_mount, &fuse_vnops, vpp))) return (err); - if ((err = vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY -#if VN_LOCK_TAKES_THREAD - , curthread -#endif - ))) { -#if NEW_VNODES_ADJUSTED_MANUALLY + if ((err = vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY))) { printf("fuse4bsd: leaking vnode %p\n", *vpp); -#endif return (err); } @@ -2511,9 +2447,7 @@ */ (*vpp)->v_op = &fuse_germ_vnops; (*vpp)->v_data = fvdat; -#if NEW_VNODES_ADJUSTED_MANUALLY (*vpp)->v_mount = dvp->v_mount; -#endif fuse_invalidate_attr(dvp); @@ -2835,11 +2769,7 @@ * No LK_RETRY. See discussion in thread * http://thread.gmane.org/gmane.os.dragonfly-bsd.kernel/8952/focus=8964 */ - err = vn_lock(fvp, LK_EXCLUSIVE -#if VN_LOCK_TAKES_THREAD - , td -#endif - ); + err = vn_lock(fvp, LK_EXCLUSIVE); if (err) goto out; @@ -2850,11 +2780,7 @@ if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') || fdvp == fvp || ((fcnp->cn_flags | tcnp->cn_flags) & ISDOTDOT)) { - VOP_UNLOCK(fvp, 0 -#if VOP_UNLOCK_TAKES_THREAD - , td -#endif - ); + VOP_UNLOCK(fvp, 0); err = EINVAL; goto out; } @@ -2873,9 +2799,6 @@ err = fuse_access_i(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_thread, &facp); fnid = VTOI(fvp); VOP_UNLOCK(fvp, 0 -#if VOP_UNLOCK_TAKES_THREAD - , td -#endif ); if (err) goto out; @@ -3026,11 +2949,7 @@ 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105291046.p4TAkUkS077535>