Print this page
fsh, fsd, libfsd, fsdadm from Sep 3rd webrev
*** 82,91 ****
--- 82,93 ----
#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,230 ****
*/
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);
}
int
fsop_unmount(vfs_t *vfsp, int flag, cred_t *cr)
{
! return (*(vfsp)->vfs_op->vfs_unmount)(vfsp, flag, cr);
}
int
fsop_root(vfs_t *vfsp, vnode_t **vpp)
{
--- 216,232 ----
*/
int
fsop_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr)
{
! return (fsh_mount(vfsp, mvp, uap, cr));
}
int
fsop_unmount(vfs_t *vfsp, int flag, cred_t *cr)
{
! return (fsh_unmount(vfsp, flag, cr));
}
int
fsop_root(vfs_t *vfsp, vnode_t **vpp)
{
*** 1783,1792 ****
--- 1785,1795 ----
vfs_unlock(vfsp);
}
}
/* Return vfsp to caller. */
*vfspp = vfsp;
+ fsh_exec_mount_callbacks(vfsp);
}
errout:
vfs_freeopttbl(&mnt_mntopts);
if (resource != NULL)
kmem_free(resource, strlen(resource) + 1);
*** 4233,4242 ****
--- 4236,4248 ----
vn_create_cache();
/* Setup event monitor framework */
fem_init();
+ /* Setup filesystem hook framework */
+ fsh_init();
+
/* Initialize the dummy stray file system type. */
error = vfs_setfsops(0, stray_vfsops_template, NULL);
/* Initialize the dummy EIO file system. */
error = vfs_makefsops(EIO_vfsops_template, &EIO_vfsops);
*** 4317,4326 ****
--- 4323,4341 ----
mutex_destroy(&vfsp->vfs_femhead->femh_lock);
kmem_free(vfsp->vfs_femhead, sizeof (*(vfsp->vfs_femhead)));
vfsp->vfs_femhead = NULL;
}
+ /*
+ * fsh cleanup
+ * There's no need here to use atomic operations on vfs_fshrecord.
+ */
+ if (vfsp->vfs_fshrecord != NULL) {
+ 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,4352 ****
--- 4358,4368 ----
void
vfs_rele(vfs_t *vfsp)
{
ASSERT(vfsp->vfs_count != 0);
if (atomic_add_32_nv(&vfsp->vfs_count, -1) == 0) {
+ fsh_exec_free_callbacks(vfsp);
VFS_FREEVFS(vfsp);
lofi_remove(vfsp);
if (vfsp->vfs_zone)
zone_rele_ref(&vfsp->vfs_implp->vi_zone_ref,
ZONE_REF_VFS);