예제 #1
0
int
fop_lookup(
    vnode_t *dvp,
    char *nm,
    vnode_t **vpp,
    pathname_t *pnp,
    int flags,
    vnode_t *rdir,
    cred_t *cr,
    caller_context_t *ct,
    int *deflags,         /* Returned per-dirent flags */
    pathname_t *ppnp)     /* Returned case-preserved name in directory */
{
    int ret;

    ret = (*(dvp)->v_op->vop_lookup)
          (dvp, nm, vpp, pnp, flags, rdir, cr, ct, deflags, ppnp);
    if (ret == 0 && *vpp) {
        VOPSTATS_UPDATE(*vpp, lookup);
        if ((*vpp)->v_path == NULL) {
            vn_setpath(rootdir, dvp, *vpp, nm, strlen(nm));
        }
    }

    return (ret);
}
예제 #2
0
int
fop_close(
    vnode_t *vp,
    int flag,
    int count,
    offset_t offset,
    cred_t *cr,
    caller_context_t *ct)
{
    int err;

    err = (*(vp)->v_op->vop_close)(vp, flag, count, offset, cr, ct);
    VOPSTATS_UPDATE(vp, close);
    /*
     * Check passed in count to handle possible dups. Vnode counts are only
     * kept on regular files
     */
    if ((vp->v_type == VREG) && (count == 1))  {
        if (flag & FREAD) {
            ASSERT(vp->v_rdcnt > 0);
            atomic_add_32(&(vp->v_rdcnt), -1);
        }
        if (flag & FWRITE) {
            ASSERT(vp->v_wrcnt > 0);
            atomic_add_32(&(vp->v_wrcnt), -1);
        }
    }
    return (err);
}
예제 #3
0
int
fop_mkdir(
    vnode_t *dvp,
    char *dirname,
    vattr_t *vap,
    vnode_t **vpp,
    cred_t *cr,
    caller_context_t *ct,
    int flags,
    vsecattr_t *vsecp,    /* ACL to set during create */
    void *logfunc)
{
    int ret;

    ret = (*(dvp)->v_op->vop_mkdir)
          (dvp, dirname, vap, vpp, cr, ct, flags, vsecp, logfunc);
    if (ret == 0 && *vpp) {
        VOPSTATS_UPDATE(*vpp, mkdir);
        if ((*vpp)->v_path == NULL) {
            vn_setpath(rootdir, dvp, *vpp, dirname,
                       strlen(dirname));
        }
    }

    return (ret);
}
예제 #4
0
파일: vnode.c 프로젝트: ElCoyote27/zfs-fuse
int
fop_create(
	vnode_t *dvp,
	char *name,
	vattr_t *vap,
	vcexcl_t excl,
	int mode,
	vnode_t **vpp,
	cred_t *cr,
	int flags,
	caller_context_t *ct,
	vsecattr_t *vsecp)   /* ACL to set during create */
{
	int ret;

	ret = (*(dvp)->v_op->vop_create)
	    (dvp, name, vap, excl, mode, vpp, cr, flags, ct, vsecp);
	if (ret == 0 && *vpp) {
		VOPSTATS_UPDATE(*vpp, create);
		if ((*vpp)->v_path == NULL) {
			vn_setpath(rootdir, dvp, *vpp, name, strlen(name));
		}
	}

	return (ret);
}
예제 #5
0
void
fop_rwunlock(
    vnode_t *vp,
    int write_lock,
    caller_context_t *ct)
{
    (*(vp)->v_op->vop_rwunlock)(vp, write_lock, ct);
    VOPSTATS_UPDATE(vp, rwunlock);
}
예제 #6
0
void
fop_inactive(
    vnode_t *vp,
    cred_t *cr,
    caller_context_t *ct)
{
    /* Need to update stats before vop call since we may lose the vnode */
    VOPSTATS_UPDATE(vp, inactive);
    (*(vp)->v_op->vop_inactive)(vp, cr, ct);
}
예제 #7
0
int
fop_rwlock(
    vnode_t *vp,
    int write_lock,
    caller_context_t *ct)
{
    int	ret;

    ret = ((*(vp)->v_op->vop_rwlock)(vp, write_lock, ct));
    VOPSTATS_UPDATE(vp, rwlock);
    return (ret);
}
예제 #8
0
int
fop_realvp(
    vnode_t *vp,
    vnode_t **vpp,
    caller_context_t *ct)
{
    int	err;

    err = (*(vp)->v_op->vop_realvp)(vp, vpp, ct);
    VOPSTATS_UPDATE(vp, realvp);
    return (err);
}
예제 #9
0
int
fop_seek(
    vnode_t *vp,
    offset_t ooff,
    offset_t *noffp,
    caller_context_t *ct)
{
    int	err;

    err = (*(vp)->v_op->vop_seek)(vp, ooff, noffp, ct);
    VOPSTATS_UPDATE(vp, seek);
    return (err);
}
예제 #10
0
int
fop_readlink(
    vnode_t *vp,
    uio_t *uiop,
    cred_t *cr,
    caller_context_t *ct)
{
    int	err;

    err = (*(vp)->v_op->vop_readlink)(vp, uiop, cr, ct);
    VOPSTATS_UPDATE(vp, readlink);
    return (err);
}
예제 #11
0
int
fop_fsync(
    vnode_t *vp,
    int syncflag,
    cred_t *cr,
    caller_context_t *ct)
{
    int	err;

    err = (*(vp)->v_op->vop_fsync)(vp, syncflag, cr, ct);
    VOPSTATS_UPDATE(vp, fsync);
    return (err);
}
예제 #12
0
파일: vnode.c 프로젝트: ElCoyote27/zfs-fuse
int
fop_remove(
	vnode_t *dvp,
	char *nm,
	cred_t *cr,
	caller_context_t *ct,
	int flags)
{
	int	err;

	err = (*(dvp)->v_op->vop_remove)(dvp, nm, cr, ct, flags);
	VOPSTATS_UPDATE(dvp, remove);
	return (err);
}
예제 #13
0
int
fop_setsecattr(
    vnode_t *vp,
    vsecattr_t *vsap,
    int flag,
    cred_t *cr,
    caller_context_t *ct)
{
    int	err;

    err = (*(vp)->v_op->vop_setsecattr) (vp, vsap, flag, cr, ct);
    VOPSTATS_UPDATE(vp, setsecattr);
    return (err);
}
예제 #14
0
int
fop_access(
    vnode_t *vp,
    int mode,
    int flags,
    cred_t *cr,
    caller_context_t *ct)
{
    int	err;

    err = (*(vp)->v_op->vop_access)(vp, mode, flags, cr, ct);
    VOPSTATS_UPDATE(vp, access);
    return (err);
}
예제 #15
0
int
fop_getattr(
    vnode_t *vp,
    vattr_t *vap,
    int flags,
    cred_t *cr,
    caller_context_t *ct)
{
    int	err;

    err = (*(vp)->v_op->vop_getattr)(vp, vap, flags, cr, ct);
    VOPSTATS_UPDATE(vp, getattr);
    return (err);
}
예제 #16
0
int
fop_putpage(
    vnode_t *vp,
    offset_t off,
    size_t len,
    int flags,
    cred_t *cr,
    caller_context_t *ct)
{
    int	err;

    err = (*(vp)->v_op->vop_putpage)(vp, off, len, flags, cr, ct);
    VOPSTATS_UPDATE(vp, putpage);
    return (err);
}
예제 #17
0
파일: vnode.c 프로젝트: ElCoyote27/zfs-fuse
int
fop_link(
	vnode_t *tdvp,
	vnode_t *svp,
	char *tnm,
	cred_t *cr,
	caller_context_t *ct,
	int flags)
{
	int	err;

	err = (*(tdvp)->v_op->vop_link)(tdvp, svp, tnm, cr, ct, flags);
	VOPSTATS_UPDATE(tdvp, link);
	return (err);
}
예제 #18
0
int
fop_setattr(
    vnode_t *vp,
    vattr_t *vap,
    int flags,
    cred_t *cr,
    caller_context_t *ct,
    void *logfunc)
{
    int	err;

    err = (*(vp)->v_op->vop_setattr)(vp, vap, flags, cr, ct, logfunc);
    VOPSTATS_UPDATE(vp, setattr);
    return (err);
}
예제 #19
0
파일: vnode.c 프로젝트: ElCoyote27/zfs-fuse
int
fop_rename(
	vnode_t *sdvp,
	char *snm,
	vnode_t *tdvp,
	char *tnm,
	cred_t *cr,
	caller_context_t *ct,
	int flags)
{
	int	err;

	err = (*(sdvp)->v_op->vop_rename)(sdvp, snm, tdvp, tnm, cr, ct, flags);
	VOPSTATS_UPDATE(sdvp, rename);
	return (err);
}
예제 #20
0
int
fop_rmdir(
    vnode_t *dvp,
    char *nm,
    vnode_t *cdir,
    cred_t *cr,
    caller_context_t *ct,
    int flags,
    void *logfunc)
{
    int	err;

    err = (*(dvp)->v_op->vop_rmdir)(dvp, nm, cdir, cr, ct, flags, logfunc);
    VOPSTATS_UPDATE(dvp, rmdir);
    return (err);
}
예제 #21
0
int
fop_space(
    vnode_t *vp,
    int cmd,
    flock64_t *bfp,
    int flag,
    offset_t offset,
    cred_t *cr,
    caller_context_t *ct)
{
    int	err;

    err = (*(vp)->v_op->vop_space)(vp, cmd, bfp, flag, offset, cr, ct);
    VOPSTATS_UPDATE(vp, space);
    return (err);
}
예제 #22
0
파일: vnode.c 프로젝트: ElCoyote27/zfs-fuse
int
fop_symlink(
	vnode_t *dvp,
	char *linkname,
	vattr_t *vap,
	char *target,
	cred_t *cr,
	caller_context_t *ct,
	int flags)
{
	int	err;

	err = (*(dvp)->v_op->vop_symlink)
	    (dvp, linkname, vap, target, cr, ct, flags);
	VOPSTATS_UPDATE(dvp, symlink);
	return (err);
}
예제 #23
0
int
fop_open(
    vnode_t **vpp,
    int mode,
    cred_t *cr,
    caller_context_t *ct)
{
    int ret;
    vnode_t *vp = *vpp;

    VN_HOLD(vp);
    /*
     * Adding to the vnode counts before calling open
     * avoids the need for a mutex. It circumvents a race
     * condition where a query made on the vnode counts results in a
     * false negative. The inquirer goes away believing the file is
     * not open when there is an open on the file already under way.
     *
     * The counts are meant to prevent NFS from granting a delegation
     * when it would be dangerous to do so.
     *
     * The vnode counts are only kept on regular files
     */
    if ((*vpp)->v_type == VREG) {
        if (mode & FREAD)
            atomic_add_32(&((*vpp)->v_rdcnt), 1);
        if (mode & FWRITE)
            atomic_add_32(&((*vpp)->v_wrcnt), 1);
    }

    ret = (*(*(vpp))->v_op->vop_open)(vpp, mode, cr, ct);

    if (ret) {
        /*
         * Use the saved vp just in case the vnode ptr got trashed
         * by the error.
         */
        VOPSTATS_UPDATE(vp, open);
        if ((vp->v_type == VREG) && (mode & FREAD))
            atomic_add_32(&(vp->v_rdcnt), -1);
        if ((vp->v_type == VREG) && (mode & FWRITE))
            atomic_add_32(&(vp->v_wrcnt), -1);
    } else {
        /*
         * Some filesystems will return a different vnode,
         * but the same path was still used to open it.
         * So if we do change the vnode and need to
         * copy over the path, do so here, rather than special
         * casing each filesystem. Adjust the vnode counts to
         * reflect the vnode switch.
         */
        VOPSTATS_UPDATE(*vpp, open);
        if (*vpp != vp && *vpp != NULL) {
            vn_copypath(vp, *vpp);
            if (((*vpp)->v_type == VREG) && (mode & FREAD))
                atomic_add_32(&((*vpp)->v_rdcnt), 1);
            if ((vp->v_type == VREG) && (mode & FREAD))
                atomic_add_32(&(vp->v_rdcnt), -1);
            if (((*vpp)->v_type == VREG) && (mode & FWRITE))
                atomic_add_32(&((*vpp)->v_wrcnt), 1);
            if ((vp->v_type == VREG) && (mode & FWRITE))
                atomic_add_32(&(vp->v_wrcnt), -1);
        }
    }
    VN_RELE(vp);
    return (ret);
}