aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/pseudofs/pseudofs.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/fs/pseudofs/pseudofs.c')
-rw-r--r--sys/fs/pseudofs/pseudofs.c71
1 files changed, 8 insertions, 63 deletions
diff --git a/sys/fs/pseudofs/pseudofs.c b/sys/fs/pseudofs/pseudofs.c
index 26a1dcd4ad39..7a4e67455214 100644
--- a/sys/fs/pseudofs/pseudofs.c
+++ b/sys/fs/pseudofs/pseudofs.c
@@ -40,18 +40,13 @@
#include <sys/mount.h>
#include <sys/mutex.h>
#include <sys/proc.h>
-#include <sys/refcount.h>
#include <sys/sbuf.h>
-#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/vnode.h>
#include <fs/pseudofs/pseudofs.h>
#include <fs/pseudofs/pseudofs_internal.h>
-static int pfs_setup(struct pfs_info *pi, struct vfsconf *vfc);
-static int pfs_teardown(struct pfs_info *pi, struct vfsconf *vfc);
-
static MALLOC_DEFINE(M_PFSNODES, "pfs_nodes", "pseudofs nodes");
SYSCTL_NODE(_vfs, OID_AUTO, pfs, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
@@ -407,20 +402,10 @@ int
pfs_mount(struct pfs_info *pi, struct mount *mp)
{
struct statfs *sbp;
- int error = 0;
if (mp->mnt_flag & MNT_UPDATE)
return (EOPNOTSUPP);
- sx_xlock(&pi->pi_mountlock);
- if (pi->pi_root == NULL)
- error = pfs_setup(pi, mp->mnt_vfc);
- if (error == 0)
- refcount_acquire(&pi->pi_mounts);
- sx_xunlock(&pi->pi_mountlock);
- if (error != 0)
- return (error);
-
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_LOCAL;
mp->mnt_kern_flag |= MNTK_NOMSYNC;
@@ -459,23 +444,10 @@ pfs_cmount(struct mntarg *ma, void *data, uint64_t flags)
int
pfs_unmount(struct mount *mp, int mntflags)
{
- struct pfs_info *pi;
int error;
error = vflush(mp, 0, (mntflags & MNT_FORCE) ? FORCECLOSE : 0,
curthread);
- if (error != 0)
- return (error);
-
- pi = (struct pfs_info *)mp->mnt_data;
- sx_xlock(&pi->pi_mountlock);
- if (!refcount_release_if_not_last(&pi->pi_mounts)) {
- error = pfs_teardown(pi, mp->mnt_vfc);
- if (error == 0)
- refcount_release(&pi->pi_mounts);
- }
- sx_xunlock(&pi->pi_mountlock);
-
return (error);
}
@@ -502,35 +474,10 @@ pfs_statfs(struct mount *mp, struct statfs *sbp)
}
/*
- * Initialize pseudofs synchronization bits. These will generally be needed
- * in order to avoid problems with parallel mounting of pseudofs consumers.
- */
-int
-pfs_vfsinit(struct pfs_info *pi, struct vfsconf *vfc)
-{
-
- sx_init(&pi->pi_mountlock, "pfs mountlock");
- refcount_init(&pi->pi_mounts, 0);
- return (0);
-}
-
-int
-pfs_vfsuninit(struct pfs_info *pi, struct vfsconf *vfc)
-{
-
- MPASS(pi->pi_root == NULL);
- sx_destroy(&pi->pi_mountlock);
-
- if (bootverbose)
- printf("%s unregistered\n", pi->pi_name);
- return (0);
-}
-
-/*
* Initialize a pseudofs instance
*/
-static int
-pfs_setup(struct pfs_info *pi, struct vfsconf *vfc)
+int
+pfs_init(struct pfs_info *pi, struct vfsconf *vfc)
{
struct pfs_node *root;
int error;
@@ -560,20 +507,18 @@ pfs_setup(struct pfs_info *pi, struct vfsconf *vfc)
/*
* Destroy a pseudofs instance
*/
-static int
-pfs_teardown(struct pfs_info *pi, struct vfsconf *vfc)
+int
+pfs_uninit(struct pfs_info *pi, struct vfsconf *vfc)
{
int error;
- MPASS(pi->pi_root != NULL);
- error = (pi->pi_uninit)(pi, vfc);
- if (error != 0)
- return (error);
-
pfs_destroy(pi->pi_root);
pi->pi_root = NULL;
pfs_fileno_uninit(pi);
- return (0);
+ if (bootverbose)
+ printf("%s unregistered\n", pi->pi_name);
+ error = (pi->pi_uninit)(pi, vfc);
+ return (error);
}
/*