Print this page
basic fsh prototype (no comments yet)

@@ -82,10 +82,12 @@
 #include <sys/attr.h>
 #include <sys/zio.h>
 #include <sys/spa.h>
 #include <sys/lofi.h>
 #include <sys/bootprops.h>
+#include <sys/fsh.h>
+#include <sys/fsh_impl.h>
 
 #include <vm/page.h>
 
 #include <fs/fs_subr.h>
 /* Private interfaces to create vopstats-related data structures */

@@ -214,24 +216,24 @@
  */
 
 int
 fsop_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr)
 {
-        return (*(vfsp)->vfs_op->vfs_mount)(vfsp, mvp, uap, cr);
+        return (fsh_mount(vfsp, mvp, uap, cr));
 }
 
 int
 fsop_unmount(vfs_t *vfsp, int flag, cred_t *cr)
 {
-        return (*(vfsp)->vfs_op->vfs_unmount)(vfsp, flag, cr);
+        return (fsh_unmount(vfsp, flag, cr));
 }
 
 int
 fsop_root(vfs_t *vfsp, vnode_t **vpp)
 {
         refstr_t *mntpt;
-        int ret = (*(vfsp)->vfs_op->vfs_root)(vfsp, vpp);
+        int ret = fsh_root(vfsp, vpp);
         /*
          * Make sure this root has a path.  With lofs, it is possible to have
          * a NULL mountpoint.
          */
         if (ret == 0 && vfsp->vfs_mntpt != NULL && (*vpp)->v_path == NULL) {

@@ -245,11 +247,11 @@
 }
 
 int
 fsop_statfs(vfs_t *vfsp, statvfs64_t *sp)
 {
-        return (*(vfsp)->vfs_op->vfs_statvfs)(vfsp, sp);
+        return (fsh_statfs(vfsp, sp));
 }
 
 int
 fsop_sync(vfs_t *vfsp, short flag, cred_t *cr)
 {

@@ -272,11 +274,11 @@
          */
         if (vfs_has_feature(vfsp, VFSFT_SYSATTR_VIEWS) &&
             fidp->fid_len == XATTR_FIDSZ)
                 return (xattr_dir_vget(vfsp, vpp, fidp));
 
-        return (*(vfsp)->vfs_op->vfs_vget)(vfsp, vpp, fidp);
+        return (fsh_vget(vfsp, vpp, fidp));
 }
 
 int
 fsop_mountroot(vfs_t *vfsp, enum whymountroot reason)
 {

@@ -526,10 +528,11 @@
         vfsp->vfs_lofi_minor = 0;
         sema_init(&vfsp->vfs_reflock, 1, NULL, SEMA_DEFAULT, NULL);
         vfsimpl_setup(vfsp);
         vfsp->vfs_data = (data);
         vfs_setops((vfsp), (op));
+        vfsp->vfs_fshrecord = fsh_fsrec_create();
 }
 
 /*
  * Allocate and initialize the vfs implementation private data
  * structure, vfs_impl_t.

@@ -1783,10 +1786,11 @@
                                 vfs_unlock(vfsp);
                         }
                 }
                 /* Return vfsp to caller. */
                 *vfspp = vfsp;
+                fsh_exec_create_callbacks(vfsp);
         }
 errout:
         vfs_freeopttbl(&mnt_mntopts);
         if (resource != NULL)
                 kmem_free(resource, strlen(resource) + 1);

@@ -4317,10 +4321,14 @@
                 mutex_destroy(&vfsp->vfs_femhead->femh_lock);
                 kmem_free(vfsp->vfs_femhead, sizeof (*(vfsp->vfs_femhead)));
                 vfsp->vfs_femhead = NULL;
         }
 
+        /* FSH cleanup */
+        fsh_fsrec_destroy(vfsp->vfs_fshrecord);
+        vfsp->vfs_fshrecord = NULL;
+
         if (vfsp->vfs_implp)
                 vfsimpl_teardown(vfsp);
         sema_destroy(&vfsp->vfs_reflock);
         kmem_cache_free(vfs_cache, vfsp);
 }

@@ -4343,10 +4351,11 @@
 void
 vfs_rele(vfs_t *vfsp)
 {
         ASSERT(vfsp->vfs_count != 0);
         if (atomic_add_32_nv(&vfsp->vfs_count, -1) == 0) {
+                fsh_exec_destroy_callbacks(vfsp);
                 VFS_FREEVFS(vfsp);
                 lofi_remove(vfsp);
                 if (vfsp->vfs_zone)
                         zone_rele_ref(&vfsp->vfs_implp->vi_zone_ref,
                             ZONE_REF_VFS);