diff options
author | avg <avg@FreeBSD.org> | 2017-03-23 08:22:27 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2017-03-23 08:22:27 +0000 |
commit | e92bfb0db6f2e6a30da30d3a4aa505eb69868243 (patch) | |
tree | 1dd071925a0a08eca5852c76d89f403204905810 | |
parent | 9644b9fb76ae3c2afaa7c31a8f86106c6a7da9ab (diff) | |
download | FreeBSD-src-e92bfb0db6f2e6a30da30d3a4aa505eb69868243.zip FreeBSD-src-e92bfb0db6f2e6a30da30d3a4aa505eb69868243.tar.gz |
MFC r315076: zfs: provide a special vptocnp method for the .zfs vnode
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c index 4c2e3e9..855dd87 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c @@ -706,6 +706,28 @@ zfsctl_root_readdir(ap) return (0); } +static int +zfsctl_root_vptocnp(struct vop_vptocnp_args *ap) +{ + static const char dotzfs_name[4] = ".zfs"; + vnode_t *dvp; + int error; + + if (*ap->a_buflen < sizeof (dotzfs_name)) + return (SET_ERROR(ENOMEM)); + + error = vn_vget_ino_gen(ap->a_vp, zfsctl_fs_root_vnode, NULL, + LK_SHARED, &dvp); + if (error != 0) + return (SET_ERROR(error)); + + VOP_UNLOCK(dvp, 0); + *ap->a_vpp = dvp; + *ap->a_buflen -= sizeof (dotzfs_name); + bcopy(dotzfs_name, ap->a_buf + *ap->a_buflen, sizeof (dotzfs_name)); + return (0); +} + static struct vop_vector zfsctl_ops_root = { .vop_default = &default_vnodeops, .vop_open = zfsctl_common_open, @@ -719,6 +741,7 @@ static struct vop_vector zfsctl_ops_root = { .vop_reclaim = zfsctl_common_reclaim, .vop_fid = zfsctl_common_fid, .vop_print = zfsctl_common_print, + .vop_vptocnp = zfsctl_root_vptocnp, }; static int |