summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/vfs_mount.c4
-rw-r--r--sys/sys/eventhandler.h12
2 files changed, 14 insertions, 2 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 448fdbb..493bb98 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -861,8 +861,9 @@ vfs_domount_first(
vfs_event_signal(NULL, VQ_MOUNT, 0);
if (VFS_ROOT(mp, LK_EXCLUSIVE, &newdp))
panic("mount: lost mount");
- VOP_UNLOCK(newdp, 0);
VOP_UNLOCK(vp, 0);
+ EVENTHANDLER_INVOKE(vfs_mounted, mp, newdp, td);
+ VOP_UNLOCK(newdp, 0);
mountcheckdirs(vp, newdp);
vrele(newdp);
if ((mp->mnt_flag & MNT_RDONLY) == 0)
@@ -1355,6 +1356,7 @@ dounmount(mp, flags, td)
mtx_lock(&mountlist_mtx);
TAILQ_REMOVE(&mountlist, mp, mnt_list);
mtx_unlock(&mountlist_mtx);
+ EVENTHANDLER_INVOKE(vfs_unmounted, mp, td);
if (coveredvp != NULL) {
coveredvp->v_mountedhere = NULL;
vput(coveredvp);
diff --git a/sys/sys/eventhandler.h b/sys/sys/eventhandler.h
index 94f377e..02fbeaa 100644
--- a/sys/sys/eventhandler.h
+++ b/sys/sys/eventhandler.h
@@ -192,6 +192,17 @@ EVENTHANDLER_DECLARE(vm_lowmem, vm_lowmem_handler_t);
typedef void (*mountroot_handler_t)(void *);
EVENTHANDLER_DECLARE(mountroot, mountroot_handler_t);
+/* File system mount events */
+struct mount;
+struct vnode;
+struct thread;
+typedef void (*vfs_mounted_notify_fn)(void *, struct mount *, struct vnode *,
+ struct thread *);
+typedef void (*vfs_unmounted_notify_fn)(void *, struct mount *,
+ struct thread *);
+EVENTHANDLER_DECLARE(vfs_mounted, vfs_mounted_notify_fn);
+EVENTHANDLER_DECLARE(vfs_unmounted, vfs_unmounted_notify_fn);
+
/* VLAN state change events */
struct ifnet;
typedef void (*vlan_config_fn)(void *, struct ifnet *, uint16_t);
@@ -231,7 +242,6 @@ EVENTHANDLER_DECLARE(process_exec, execlist_fn);
/*
* application dump event
*/
-struct thread;
typedef void (*app_coredump_start_fn)(void *, struct thread *, char *name);
typedef void (*app_coredump_progress_fn)(void *, struct thread *td, int byte_count);
typedef void (*app_coredump_finish_fn)(void *, struct thread *td);
OpenPOWER on IntegriCloud