Source-Changes-HG archive

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

[src/pgoyette-compat]: src/sys Separate COMPAT_BSDPTY stuff from tty COMPAT_6...



details:   https://anonhg.NetBSD.org/src/rev/93d72052f88c
branches:  pgoyette-compat
changeset: 830605:93d72052f88c
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Tue Sep 04 02:21:58 2018 +0000

description:
Separate COMPAT_BSDPTY stuff from tty COMPAT_60 stuff.  Enables
building of COMPAT_60 module whether or not COMPAT_BSDPTY is
defined in the kernel.

diffstat:

 sys/compat/common/tty_60.c |  12 ++++++------
 sys/compat/sys/ttycom.h    |   4 ++--
 sys/kern/tty.c             |  20 ++++++++++++++++----
 sys/kern/tty_ptm.c         |  11 +++--------
 sys/sys/tty.h              |  12 ++++++++++--
 5 files changed, 37 insertions(+), 22 deletions(-)

diffs (196 lines):

diff -r 91ef7bc08f09 -r 93d72052f88c sys/compat/common/tty_60.c
--- a/sys/compat/common/tty_60.c        Sat Aug 25 23:12:23 2018 +0000
+++ b/sys/compat/common/tty_60.c        Tue Sep 04 02:21:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tty_60.c,v 1.4.16.3 2018/03/18 23:34:25 pgoyette Exp $ */
+/*     $NetBSD: tty_60.c,v 1.4.16.4 2018/09/04 02:21:58 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty_60.c,v 1.4.16.3 2018/03/18 23:34:25 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_60.c,v 1.4.16.4 2018/09/04 02:21:58 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -92,14 +92,14 @@
  * COMPAT_60 versions of ttioctl and ptmioctl.
  */
 int
-compat_60_ttioctl(struct tty *tp, u_long cmd, void *data, int flag,
+compat_60_ttioctl(dev_t dev, u_long cmd, void *data, int flag,
        struct lwp *l)
 {
 
        switch (cmd) {
        case COMPAT_60_TIOCPTMGET:
        case COMPAT_60_TIOCPTSNAME:
-               return compat_60_ptmget_ioctl(tp->t_dev, cmd, data, flag, l);
+               return compat_60_ptmget_ioctl(dev, cmd, data, flag, l);
        default:
                return EPASSTHROUGH;
        }
@@ -122,12 +122,12 @@
 {
 
        vec_compat_ttioctl_60 = compat_60_ttioctl;
-/*     vec_compat_ptmioctl_60 = compat_60_ptmioctl;    XXX NOT-YET */
+       vec_compat_ptmioctl_60 = compat_60_ptmioctl;
 }
 
 void
 kern_tty_60_fini(void)
 {
        vec_compat_ttioctl_60 = NULL;
-/*     vec_compat_ptmioctl_60 = NULL;                  XXX NOT-YET */
+       vec_compat_ptmioctl_60 = stub_compat_ptmioctl_60;
 }
diff -r 91ef7bc08f09 -r 93d72052f88c sys/compat/sys/ttycom.h
--- a/sys/compat/sys/ttycom.h   Sat Aug 25 23:12:23 2018 +0000
+++ b/sys/compat/sys/ttycom.h   Tue Sep 04 02:21:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ttycom.h,v 1.2 2012/10/19 17:16:55 apb Exp $   */
+/*     $NetBSD: ttycom.h,v 1.2.40.1 2018/09/04 02:21:58 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 #define COMPAT_60_TIOCPTSNAME   _IOR('t', 72, struct compat_60_ptmget)
 
 #ifdef _KERNEL
-int compat_60_ttioctl(struct tty *, u_long, void *, int, struct lwp *);
+int compat_60_ttioctl(dev_t, u_long, void *, int, struct lwp *);
 int compat_60_ptmioctl(dev_t, u_long, void *, int, struct lwp *);
 #endif
 
diff -r 91ef7bc08f09 -r 93d72052f88c sys/kern/tty.c
--- a/sys/kern/tty.c    Sat Aug 25 23:12:23 2018 +0000
+++ b/sys/kern/tty.c    Tue Sep 04 02:21:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tty.c,v 1.275.2.2 2018/04/07 04:12:19 pgoyette Exp $   */
+/*     $NetBSD: tty.c,v 1.275.2.3 2018/09/04 02:21:58 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.275.2.2 2018/04/07 04:12:19 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.275.2.3 2018/09/04 02:21:58 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -209,7 +209,11 @@
 int tty_count;
 kmutex_t tty_lock;
 krwlock_t ttcompat_lock;
-int (*vec_compat_ttioctl_60)(struct tty *, u_long, void *, int, struct lwp *);
+int (*vec_compat_ttioctl_60)(dev_t, u_long, void *, int, struct lwp *) = NULL;
+int (*vec_compat_ptmioctl_60)(dev_t, u_long, void *, int, struct lwp *) =
+    stub_compat_ptmioctl_60;
+
+struct ptm_pty *ptm = NULL;
 
 uint64_t tk_cancc;
 uint64_t tk_nin;
@@ -1420,7 +1424,7 @@
                                return EPASSTHROUGH;
                        }
                }
-               error = (*vec_compat_ttioctl_60)(tp, cmd, data, flag, l);
+               error = (*vec_compat_ttioctl_60)(tp->t_dev, cmd, data, flag, l);
                rw_exit(&ttcompat_lock);
                return error;
        }
@@ -3064,3 +3068,11 @@
     }
     return EAGAIN;
 }
+
+int
+stub_compat_ptmioctl_60(dev_t dev, u_long cmd, void *data, int flag,
+    struct lwp *l)
+{
+
+       return EPASSTHROUGH;
+}
diff -r 91ef7bc08f09 -r 93d72052f88c sys/kern/tty_ptm.c
--- a/sys/kern/tty_ptm.c        Sat Aug 25 23:12:23 2018 +0000
+++ b/sys/kern/tty_ptm.c        Tue Sep 04 02:21:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tty_ptm.c,v 1.37 2015/08/24 22:50:32 pooka Exp $       */
+/*     $NetBSD: tty_ptm.c,v 1.37.16.1 2018/09/04 02:21:58 pgoyette Exp $       */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty_ptm.c,v 1.37 2015/08/24 22:50:32 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_ptm.c,v 1.37.16.1 2018/09/04 02:21:58 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -56,9 +56,7 @@
 
 #include <miscfs/specfs/specdev.h>
 
-#ifdef COMPAT_60
 #include <compat/sys/ttycom.h>
-#endif /* COMPAT_60 */
 
 #include "ioconf.h"
 
@@ -85,7 +83,6 @@
 };
 #else
 
-static struct ptm_pty *ptm;
 int pts_major, ptc_major;
 
 static dev_t pty_getfree(void);
@@ -405,11 +402,9 @@
                        goto bad2;
                return 0;
        default:
-#ifdef COMPAT_60
-               error = compat_60_ptmioctl(dev, cmd, data, flag, l);
+               error = (*vec_compat_ptmioctl_60)(dev, cmd, data, flag, l);
                if (error != EPASSTHROUGH)
                        return error;
-#endif /* COMPAT_60 */
                DPRINTF(("ptmioctl EINVAL\n"));
                return EINVAL;
        }
diff -r 91ef7bc08f09 -r 93d72052f88c sys/sys/tty.h
--- a/sys/sys/tty.h     Sat Aug 25 23:12:23 2018 +0000
+++ b/sys/sys/tty.h     Tue Sep 04 02:21:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tty.h,v 1.94.2.1 2018/03/18 12:07:00 pgoyette Exp $    */
+/*     $NetBSD: tty.h,v 1.94.2.2 2018/09/04 02:21:58 pgoyette Exp $    */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -313,8 +313,16 @@
 int    clalloc(struct clist *, int, int);
 void   clfree(struct clist *);
 
-extern int (*vec_compat_ttioctl_60)(struct tty *, u_long, void *, int,
+extern int (*vec_compat_ttioctl_60)(dev_t, u_long, void *, int,
+    struct lwp *);
+extern int (*vec_compat_ptmioctl_60)(dev_t, u_long, void *, int,
     struct lwp *);
+int stub_compat_ptmioctl_60(dev_t, u_long, void *, int, struct lwp *);
+
+/* overwritten to be non-null if ptm(4) is present */
+
+struct ptm_pty;
+extern struct ptm_pty *ptm;
 
 unsigned char tty_getctrlchar(struct tty *, unsigned /*which*/);
 void tty_setctrlchar(struct tty *, unsigned /*which*/, unsigned char /*val*/);



Home | Main Index | Thread Index | Old Index