diff options
author | des <des@FreeBSD.org> | 2001-10-02 22:22:42 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2001-10-02 22:22:42 +0000 |
commit | e96a60dd2786961389241d23ed0a7339ad562315 (patch) | |
tree | fd9ef87e5c16d90a6aebca36d3a60e2bf36c6089 /sys/fs/pseudofs/pseudofs_vncache.c | |
parent | 1a3f19d0368bb8140f71240821abfd58398b8676 (diff) | |
download | FreeBSD-src-e96a60dd2786961389241d23ed0a7339ad562315.zip FreeBSD-src-e96a60dd2786961389241d23ed0a7339ad562315.tar.gz |
Add a PFS_DISABLED flag; pfs_visible() automatically returns 0 if it is set
on the node in question. Also add two API functions for setting and clearing
this flag; setting it also reclaims all vnodes associated with the node.
Diffstat (limited to 'sys/fs/pseudofs/pseudofs_vncache.c')
-rw-r--r-- | sys/fs/pseudofs/pseudofs_vncache.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/sys/fs/pseudofs/pseudofs_vncache.c b/sys/fs/pseudofs/pseudofs_vncache.c index 191f85c..d040b08 100644 --- a/sys/fs/pseudofs/pseudofs_vncache.c +++ b/sys/fs/pseudofs/pseudofs_vncache.c @@ -92,6 +92,9 @@ void pfs_vncache_unload(void) { rm_at_exit(pfs_exit); + if (pfs_vncache_entries != 0) + printf("pfs_vncache_unload(): %d entries remaining\n", + pfs_vncache_entries); mtx_destroy(&pfs_vncache_mutex); } @@ -217,3 +220,38 @@ pfs_exit(struct proc *p) } mtx_unlock(&pfs_vncache_mutex); } + +/* + * Disable a pseudofs node, and free all vnodes associated with it + */ +int +pfs_disable(struct pfs_node *pn) +{ + struct pfs_vdata *pvd, *prev; + + if (pn->pn_flags & PFS_DISABLED) + return (0); + mtx_lock(&pfs_vncache_mutex); + pn->pn_flags |= PFS_DISABLED; + /* see the comment about the double loop in pfs_exit() */ + /* XXX linear search... not very efficient */ + for (pvd = pfs_vncache; pvd != NULL; pvd = pvd->pvd_next) { + while (pvd != NULL && pvd->pvd_pn == pn) { + prev = pvd->pvd_prev; + vgone(pvd->pvd_vnode); + pvd = prev ? prev->pvd_next : pfs_vncache; + } + } + mtx_unlock(&pfs_vncache_mutex); + return (0); +} + +/* + * Re-enable a disabled pseudofs node + */ +int +pfs_enable(struct pfs_node *pn) +{ + pn->pn_flags &= ~PFS_DISABLED; + return (0); +} |