diff options
author | jhb <jhb@FreeBSD.org> | 2003-03-24 21:15:35 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-03-24 21:15:35 +0000 |
commit | 98a481610a9dcb442e9c2e851c6ef2a330027e45 (patch) | |
tree | 41fad1aa97bccfd68308cf8a8ff0de8b8f243493 /sys/fs/pseudofs/pseudofs_vncache.c | |
parent | 01298a9735ccfad61628107327cfb25e49f8248b (diff) | |
download | FreeBSD-src-98a481610a9dcb442e9c2e851c6ef2a330027e45.zip FreeBSD-src-98a481610a9dcb442e9c2e851c6ef2a330027e45.tar.gz |
Replace the at_fork, at_exec, and at_exit functions with the slightly more
flexible process_fork, process_exec, and process_exit eventhandlers. This
reduces code duplication and also means that I don't have to go duplicate
the eventhandler locking three more times for each of at_fork, at_exec, and
at_exit.
Reviewed by: phk, jake, almost complete silence on arch@
Diffstat (limited to 'sys/fs/pseudofs/pseudofs_vncache.c')
-rw-r--r-- | sys/fs/pseudofs/pseudofs_vncache.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/fs/pseudofs/pseudofs_vncache.c b/sys/fs/pseudofs/pseudofs_vncache.c index c832925..2dc94fe 100644 --- a/sys/fs/pseudofs/pseudofs_vncache.c +++ b/sys/fs/pseudofs/pseudofs_vncache.c @@ -31,6 +31,7 @@ #include <sys/param.h> #include <sys/kernel.h> #include <sys/systm.h> +#include <sys/eventhandler.h> #include <sys/lock.h> #include <sys/malloc.h> #include <sys/mutex.h> @@ -45,7 +46,8 @@ static MALLOC_DEFINE(M_PFSVNCACHE, "pfs_vncache", "pseudofs vnode cache"); static struct mtx pfs_vncache_mutex; static struct pfs_vdata *pfs_vncache; -static void pfs_exit(struct proc *p); +static eventhandler_tag pfs_exit_tag; +static void pfs_exit(void *arg, struct proc *p); SYSCTL_NODE(_vfs_pfs, OID_AUTO, vncache, CTLFLAG_RW, 0, "pseudofs vnode cache"); @@ -80,8 +82,8 @@ pfs_vncache_load(void) { mtx_init(&pfs_vncache_mutex, "pseudofs_vncache", NULL, MTX_DEF | MTX_RECURSE); - /* XXX at_exit() can fail with ENOMEN */ - at_exit(pfs_exit); + pfs_exit_tag = EVENTHANDLER_REGISTER(process_exit, pfs_exit, NULL, + EVENTHANDLER_PRI_ANY); } /* @@ -90,7 +92,7 @@ pfs_vncache_load(void) void pfs_vncache_unload(void) { - rm_at_exit(pfs_exit); + EVENTHANDLER_DEREGISTER(process_exit, pfs_exit_tag); if (pfs_vncache_entries != 0) printf("pfs_vncache_unload(): %d entries remaining\n", pfs_vncache_entries); @@ -218,7 +220,7 @@ pfs_vncache_free(struct vnode *vp) * Free all vnodes associated with a defunct process */ static void -pfs_exit(struct proc *p) +pfs_exit(void *arg, struct proc *p) { struct pfs_vdata *pvd, *prev; |