Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs/ptyfs let us get mounted multiple times.



details:   https://anonhg.NetBSD.org/src/rev/426476755efc
branches:  trunk
changeset: 781630:426476755efc
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Sep 18 23:42:52 2012 +0000

description:
let us get mounted multiple times.

diffstat:

 sys/fs/ptyfs/ptyfs_vfsops.c |  28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diffs (80 lines):

diff -r 0edc2c72a66e -r 426476755efc sys/fs/ptyfs/ptyfs_vfsops.c
--- a/sys/fs/ptyfs/ptyfs_vfsops.c       Tue Sep 18 21:35:43 2012 +0000
+++ b/sys/fs/ptyfs/ptyfs_vfsops.c       Tue Sep 18 23:42:52 2012 +0000
@@ -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 @@
        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 @@
                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 @@
        }
 
        /* 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 @@
                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;
 }



Home | Main Index | Thread Index | Old Index