Source-Changes-HG archive

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

[src/netbsd-6]: src Pull up following revision(s) (requested by christos in t...



details:   https://anonhg.NetBSD.org/src/rev/b56cde1156f6
branches:  netbsd-6
changeset: 774621:b56cde1156f6
user:      riz <riz%NetBSD.org@localhost>
date:      Mon Oct 01 17:35:05 2012 +0000

description:
Pull up following revision(s) (requested by christos in ticket #566):
        sbin/mount_ptyfs/mount_ptyfs.8: revision 1.11
        sbin/mount_ptyfs/mount_ptyfs.8: revision 1.12
        sys/fs/ptyfs/ptyfs.h: revision 1.9
        sbin/mount_ptyfs/mount_ptyfs.c: revision 1.14
        sys/fs/ptyfs/ptyfs_vfsops.c: revision 1.43
        sys/fs/ptyfs/ptyfs_vfsops.c: revision 1.44
Does not make sense to mount this as NFS, so it is not a bug.
We can now mount multiple instances, but all of them show all the ptys.
let us get mounted multiple times.
remove -c and chroot option; they are always on now
Always do the chroot filename mapping; it is pointless not to do it.

diffstat:

 sbin/mount_ptyfs/mount_ptyfs.8 |  15 ++++-----------
 sbin/mount_ptyfs/mount_ptyfs.c |  22 ++++++----------------
 sys/fs/ptyfs/ptyfs.h           |   7 +------
 sys/fs/ptyfs/ptyfs_vfsops.c    |  31 +++++++++++++++++--------------
 4 files changed, 28 insertions(+), 47 deletions(-)

diffs (239 lines):

diff -r a522d16c597a -r b56cde1156f6 sbin/mount_ptyfs/mount_ptyfs.8
--- a/sbin/mount_ptyfs/mount_ptyfs.8    Sun Sep 30 19:00:33 2012 +0000
+++ b/sbin/mount_ptyfs/mount_ptyfs.8    Mon Oct 01 17:35:05 2012 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: mount_ptyfs.8,v 1.8.8.1 2012/09/13 22:28:15 riz Exp $
+.\"    $NetBSD: mount_ptyfs.8,v 1.8.8.2 2012/10/01 17:35:05 riz Exp $
 .\"
 .\"
 .\" Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 9, 2012
+.Dd September 19, 2012
 .Dt MOUNT_PTYFS 8
 .Os
 .Sh NAME
@@ -36,7 +36,6 @@
 .Nd mount the /dev/pts file system
 .Sh SYNOPSIS
 .Nm
-.Op Fl c
 .Op Fl g Ar group|gid
 .Op Fl m Ar mode
 .Op Fl o Ar options
@@ -63,10 +62,6 @@
 .Pp
 The options are as follows:
 .Bl -tag -width indent
-.It Fl c
-Allows
-.Ar ptyfs
-to be mounted inside a chrooted environment.
 .It Fl g Ar group|gid
 Specify the group ownership of the slave pseudo-tty.
 .It Fl m Ar mode
@@ -80,9 +75,6 @@
 .Pp
 .Nm
 specific options are
-.Dv chroot
-which corresponds to
-.Fl c ,
 .Dv group
 which corresponds to
 .Fl g ,
@@ -111,4 +103,5 @@
 utility first appeared in
 .Nx 3.0 .
 .Sh BUGS
-This filesystem may not be NFS-exported.
+When multiple instances are mounted, they all display the union of the ptys
+used in each instance, not just the ones used in the particular instance.
diff -r a522d16c597a -r b56cde1156f6 sbin/mount_ptyfs/mount_ptyfs.c
--- a/sbin/mount_ptyfs/mount_ptyfs.c    Sun Sep 30 19:00:33 2012 +0000
+++ b/sbin/mount_ptyfs/mount_ptyfs.c    Mon Oct 01 17:35:05 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mount_ptyfs.c,v 1.12 2011/08/29 14:35:02 joerg Exp $   */
+/*     $NetBSD: mount_ptyfs.c,v 1.12.4.1 2012/10/01 17:35:05 riz Exp $ */
 
 /*
  * Copyright (c) 1992, 1993, 1994
@@ -77,7 +77,7 @@
 #if 0
 static char sccsid[] = "@(#)mount_ptyfs.c      8.3 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: mount_ptyfs.c,v 1.12 2011/08/29 14:35:02 joerg Exp $");
+__RCSID("$NetBSD: mount_ptyfs.c,v 1.12.4.1 2012/10/01 17:35:05 riz Exp $");
 #endif
 #endif /* not lint */
 
@@ -100,14 +100,12 @@
 
 #define ALTF_GROUP     0x1
 #define ALTF_MODE      0x2
-#define ALTF_CHROOT    0x4
 
 static const struct mntopt mopts[] = {
        MOPT_STDOPTS,
        MOPT_GETARGS,
        { "group", 0, ALTF_GROUP, 1 },
        { "mode", 0, ALTF_MODE, 1 },
-       { "chroot", 0, ALTF_CHROOT, 1 },
        MOPT_NULL,
 };
 
@@ -165,7 +163,7 @@
        args.mode = S_IRUSR|S_IWUSR|S_IWGRP;
        args.flags = 0;
 
-       while ((ch = getopt(argc, argv, "cg:m:o:")) != -1)
+       while ((ch = getopt(argc, argv, "g:m:o:")) != -1)
                switch (ch) {
                case 'o':
                        altflags = 0;
@@ -176,13 +174,8 @@
                                args.gid = getgrp(getmntoptstr(mp, "group"));
                        if (altflags & ALTF_MODE)
                                args.mode = (mode_t)getmntoptnum(mp, "mode");
-                       if (altflags & ALTF_CHROOT)
-                               args.flags |= PTYFSMNT_CHROOT;
                        freemntopts(mp);
                        break;
-               case 'c':
-                       args.flags |= PTYFSMNT_CHROOT;
-                       break;
                case 'g':
                        args.gid = getgrp(optarg);
                        break;
@@ -210,11 +203,8 @@
        if (mount(MOUNT_PTYFS, canon_dir, mntflags, &args, sizeof args) == -1)
                err(1, "ptyfs on %s", canon_dir);
        if (mntflags & MNT_GETARGS) {
-               char buf[1024];
-               (void)snprintb(buf, sizeof(buf), PTYFSMNT_BITS, args.flags);
-               printf("version=%d, flags=%s\n", args.version, buf);
-               printf("version=%d, gid=%lu, mode=0%o flags=%s\n", args.version,
-                   (unsigned long)args.gid, args.mode, buf);
+               printf("version=%d, gid=%lu, mode=0%o\n", args.version,
+                   (unsigned long)args.gid, args.mode);
        }
        return 0;
 }
@@ -223,7 +213,7 @@
 usage(void)
 {
        (void)fprintf(stderr,
-           "Usage: %s [-c] [-g <group|gid>] [-m <mode>] [-o options] "
+           "Usage: %s [-g <group|gid>] [-m <mode>] [-o options] "
            "ptyfs mountpoint\n", getprogname());
        exit(1);
 }
diff -r a522d16c597a -r b56cde1156f6 sys/fs/ptyfs/ptyfs.h
--- a/sys/fs/ptyfs/ptyfs.h      Sun Sep 30 19:00:33 2012 +0000
+++ b/sys/fs/ptyfs/ptyfs.h      Mon Oct 01 17:35:05 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptyfs.h,v 1.8 2009/03/15 16:43:55 christos Exp $       */
+/*     $NetBSD: ptyfs.h,v 1.8.18.1 2012/10/01 17:35:05 riz Exp $       */
 
 /*
  * Copyright (c) 1993
@@ -124,11 +124,6 @@
 
 #define PTYFS_ARGSVERSION      2
 
-#define PTYFSMNT_CHROOT                0x01
-
-#define PTYFSMNT_BITS "\177\20" \
-    "b\00chroot\0"
-
 /*
  * Kernel stuff follows
  */
diff -r a522d16c597a -r b56cde1156f6 sys/fs/ptyfs/ptyfs_vfsops.c
--- a/sys/fs/ptyfs/ptyfs_vfsops.c       Sun Sep 30 19:00:33 2012 +0000
+++ b/sys/fs/ptyfs/ptyfs_vfsops.c       Mon Oct 01 17:35:05 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptyfs_vfsops.c,v 1.42 2010/01/08 11:35:09 pooka Exp $  */
+/*     $NetBSD: ptyfs_vfsops.c,v 1.42.18.1 2012/10/01 17:35:05 riz Exp $       */
 
 /*
  * Copyright (c) 1992, 1993, 1995
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.42 2010/01/08 11:35:09 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.42.18.1 2012/10/01 17:35:05 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -101,11 +101,9 @@
        size_t len;
        char *bp;
        int error;
-       struct ptyfsmount *pmnt = mp->mnt_data;
 
        rv = mp->mnt_stat.f_mntonname;
-       if (cwdi->cwdi_rdir == NULL ||
-           (pmnt->pmnt_flags & PTYFSMNT_CHROOT) == 0)
+       if (cwdi->cwdi_rdir == NULL)
                return rv;
 
        buf = malloc(MAXBUF, M_TEMP, M_WAITOK);
@@ -243,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;
@@ -272,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;
 }
@@ -297,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