Module Name:    src
Committed By:   christos
Date:           Tue Sep 18 23:42:52 UTC 2012

Modified Files:
        src/sys/fs/ptyfs: ptyfs_vfsops.c

Log Message:
let us get mounted multiple times.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/fs/ptyfs/ptyfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/ptyfs/ptyfs_vfsops.c
diff -u src/sys/fs/ptyfs/ptyfs_vfsops.c:1.43 src/sys/fs/ptyfs/ptyfs_vfsops.c:1.44
--- src/sys/fs/ptyfs/ptyfs_vfsops.c:1.43	Tue Sep 18 17:33:55 2012
+++ src/sys/fs/ptyfs/ptyfs_vfsops.c	Tue Sep 18 19:42:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptyfs_vfsops.c,v 1.43 2012/09/18 21:33:55 christos Exp $	*/
+/*	$NetBSD: ptyfs_vfsops.c,v 1.44 2012/09/18 23:42:52 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993, 1995
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.43 2012/09/18 21:33:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.44 2012/09/18 23:42:52 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -101,7 +101,6 @@ ptyfs__getpath(struct lwp *l, const stru
 	size_t len;
 	char *bp;
 	int error;
-	struct ptyfsmount *pmnt = mp->mnt_data;
 
 	rv = mp->mnt_stat.f_mntonname;
 	if (cwdi->cwdi_rdir == NULL)
@@ -242,9 +241,11 @@ ptyfs_mount(struct mount *mp, const char
 		return 0;
 	}
 
+#if 0
 	/* Don't allow more than one mount */
 	if (ptyfs_count)
 		return EBUSY;
+#endif
 
 	if (mp->mnt_flag & MNT_UPDATE)
 		return EOPNOTSUPP;
@@ -271,9 +272,10 @@ ptyfs_mount(struct mount *mp, const char
 	}
 
 	/* Point pty access to us */
-
-	ptm_ptyfspty.arg = mp;
-	ptyfs_save_ptm = pty_sethandler(&ptm_ptyfspty);
+	if (ptyfs_count == 0) {
+		ptm_ptyfspty.arg = mp;
+		ptyfs_save_ptm = pty_sethandler(&ptm_ptyfspty);
+	}
 	ptyfs_count++;
 	return 0;
 }
@@ -296,19 +298,21 @@ ptyfs_unmount(struct mount *mp, int mntf
 		flags |= FORCECLOSE;
 
 	if ((error = vflush(mp, 0, flags)) != 0)
-		return (error);
+		return error;
 
-	/* Restore where pty access was pointing */
-	(void)pty_sethandler(ptyfs_save_ptm);
-	ptyfs_save_ptm = NULL;
-	ptm_ptyfspty.arg = NULL;
+	ptyfs_count--;
+	if (ptyfs_count == 0) {
+		/* Restore where pty access was pointing */
+		(void)pty_sethandler(ptyfs_save_ptm);
+		ptyfs_save_ptm = NULL;
+		ptm_ptyfspty.arg = NULL;
+	}
 
 	/*
 	 * Finally, throw away the ptyfsmount structure
 	 */
 	free(mp->mnt_data, M_PTYFSMNT);
 	mp->mnt_data = NULL;
-	ptyfs_count--;
 
 	return 0;
 }

Reply via email to