Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet/dist/uts/common/fs/zfs Implement zfsctl_...



details:   https://anonhg.NetBSD.org/src/rev/d3e190278f1c
branches:  trunk
changeset: 449726:d3e190278f1c
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Mar 18 09:21:31 2019 +0000

description:
Implement zfsctl_lookup_objset() to look up "zfsvfs" of an mounted snapshot.

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c |  17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r 1f40b86f62e5 -r d3e190278f1c external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c   Mon Mar 18 09:20:58 2019 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c   Mon Mar 18 09:21:31 2019 +0000
@@ -1946,8 +1946,23 @@
 int
 zfsctl_lookup_objset(vfs_t *vfsp, uint64_t objsetid, zfsvfs_t **zfsvfsp)
 {
+       struct sfs_node_key key = {
+               .parent_id = ZFSCTL_INO_SNAPDIR,
+               .id = objsetid
+       };
+       vnode_t *vp;
+       int error;
 
-       return EINVAL;
+       *zfsvfsp = NULL;
+       error = vcache_get(vfsp, &key, sizeof(key), &vp);
+       if (error == 0) {
+               if (vp->v_mountedhere)
+                       *zfsvfsp = vp->v_mountedhere->mnt_data;
+               vrele(vp);
+       }
+       if (*zfsvfsp == NULL)
+               return SET_ERROR(EINVAL);
+       return 0;
 }
 
 int



Home | Main Index | Thread Index | Old Index