Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/pgoyette-compat]: src/sys Initial pass at getting the tty stuff properly...
details: https://anonhg.NetBSD.org/src/rev/a7f9dae3bdf8
branches: pgoyette-compat
changeset: 321065:a7f9dae3bdf8
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Sun Mar 18 12:06:59 2018 +0000
description:
Initial pass at getting the tty stuff properly modularized. Subject
to review and revision.
diffstat:
sys/compat/common/compat_60_mod.c | 24 +++++++++++++++++++++---
sys/compat/common/compat_mod.c | 17 ++++++++++++++---
sys/compat/common/tty_60.c | 24 ++++++++++++++++++++++--
sys/kern/tty.c | 19 +++++++------------
sys/sys/tty.h | 5 +++--
5 files changed, 67 insertions(+), 22 deletions(-)
diffs (259 lines):
diff -r 65db40300fe7 -r a7f9dae3bdf8 sys/compat/common/compat_60_mod.c
--- a/sys/compat/common/compat_60_mod.c Sun Mar 18 09:00:55 2018 +0000
+++ b/sys/compat/common/compat_60_mod.c Sun Mar 18 12:06:59 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_60_mod.c,v 1.1.2.7 2018/03/18 09:00:55 pgoyette Exp $ */
+/* $NetBSD: compat_60_mod.c,v 1.1.2.8 2018/03/18 12:06:59 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.7 2018/03/18 09:00:55 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.8 2018/03/18 12:06:59 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -71,9 +71,18 @@
return 0;
}
+ error = kern_tty_60_init();
+ if (error != 0) {
+ kern_sa_60_fini();
+ kern_time_60_fini();
+ return 0;
+ }
+
#ifdef CPU_UCODE
error = kern_cpu_60_init();
if (error != 0) {
+ kern_tty_60_fini();
+ kern_sa_60_fini();
kern_time_60_fini();
return 0;
}
@@ -93,8 +102,17 @@
return error;
#endif
+ error = kern_tty_60_fini();
+ if (error != 0) {
+#ifdef CPU_UCODE
+ kern_cpu_60_init();
+#endif
+ return error;
+ }
+
error = kern_sa_60_fini();
if (error != 0) {
+ kern_tty_60_init();
#ifdef CPU_UCODE
kern_cpu_60_init();
#endif
@@ -103,6 +121,7 @@
error = kern_time_60_fini();
if (error != 0) {
+ kern_tty_60_init();
kern_sa_60_init();
#ifdef CPU_UCODE
kern_cpu_60_init();
@@ -110,7 +129,6 @@
return error;
}
-
return error;
}
diff -r 65db40300fe7 -r a7f9dae3bdf8 sys/compat/common/compat_mod.c
--- a/sys/compat/common/compat_mod.c Sun Mar 18 09:00:55 2018 +0000
+++ b/sys/compat/common/compat_mod.c Sun Mar 18 12:06:59 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_mod.c,v 1.24.14.15 2018/03/18 02:05:21 pgoyette Exp $ */
+/* $NetBSD: compat_mod.c,v 1.24.14.16 2018/03/18 12:06:59 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.15 2018/03/18 02:05:21 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.16 2018/03/18 12:06:59 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -92,7 +92,6 @@
MODULE_WITH_ALIASES(MODULE_CLASS_EXEC, compat, NULL, &compat_includes);
-int ttcompat(struct tty *, u_long, void *, int, struct lwp *);
#ifdef _MODULE
#ifdef COMPAT_16
@@ -255,11 +254,21 @@
if (error != 0) {
return error;
}
+#ifdef NOTYET /* XXX */
#ifdef COMPAT_43
+/* XXX
+ * XXX This would mean that compat_43 and compat_60 are mutually
+ * XXX exclusive. Rather we should save the original vector
+ * XXX value, and retore it if we unload. Note that compat_43
+ * XXX should "require" compat_60 to provide a definitive order
+ * XXX of initialization (ie, compat_60 first, then compat_43).
+ * XXX
KASSERT(ttcompatvec == NULL);
ttcompatvec = ttcompat;
if_43_init();
+ * XXX */
#endif
+#endif /* XXX NOTYET */
#ifdef COMPAT_40
if_40_init();
#endif
@@ -333,6 +342,7 @@
if (error != 0) {
return error;
}
+#ifdef NOTYET /* XXX */
#ifdef COMPAT_43
/* Unlink ttcompatvec. */
if (rw_tryenter(&ttcompat_lock, RW_WRITER)) {
@@ -344,6 +354,7 @@
return EBUSY;
}
#endif
+#endif /* NOTYET XXX */
#ifdef COMPAT_16
#if defined(COMPAT_SIGCONTEXT)
/*
diff -r 65db40300fe7 -r a7f9dae3bdf8 sys/compat/common/tty_60.c
--- a/sys/compat/common/tty_60.c Sun Mar 18 09:00:55 2018 +0000
+++ b/sys/compat/common/tty_60.c Sun Mar 18 12:06:59 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tty_60.c,v 1.4.16.1 2018/03/08 08:55:52 pgoyette Exp $ */
+/* $NetBSD: tty_60.c,v 1.4.16.2 2018/03/18 12:06:59 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.1 2018/03/08 08:55:52 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_60.c,v 1.4.16.2 2018/03/18 12:06:59 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -43,6 +43,8 @@
#include <sys/systm.h>
#include <sys/tty.h>
+
+#include <compat/common/compat_mod.h>
#include <compat/sys/ttycom.h>
/* convert struct ptmget to struct compat_60_ptmget */
@@ -114,3 +116,21 @@
return EPASSTHROUGH;
}
}
+
+int
+kern_tty_60_init(void)
+{
+
+ vec_compat_ttioctl_60 = compat_60_ttioctl;
+/* vec_compat_ptmioctl_60 = compat_60_ptmioctl; XXX NOT-YET */
+ return 0;
+}
+
+int
+kern_tty_60_fini(void)
+{
+ vec_compat_ttioctl_60 = NULL;
+/* vec_compat_ptmioctl_60 = NULL; XXX NOT-YET */
+
+ return 0;
+}
diff -r 65db40300fe7 -r a7f9dae3bdf8 sys/kern/tty.c
--- a/sys/kern/tty.c Sun Mar 18 09:00:55 2018 +0000
+++ b/sys/kern/tty.c Sun Mar 18 12:06:59 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.c,v 1.275 2017/10/25 08:12:39 maya Exp $ */
+/* $NetBSD: tty.c,v 1.275.2.1 2018/03/18 12:06:59 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 2017/10/25 08:12:39 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.275.2.1 2018/03/18 12:06:59 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -209,7 +209,7 @@
int tty_count;
kmutex_t tty_lock;
krwlock_t ttcompat_lock;
-int (*ttcompatvec)(struct tty *, u_long, void *, int, struct lwp *);
+int (*vec_compat_ttioctl_60)(struct tty *, u_long, void *, int, struct lwp *);
uint64_t tk_cancc;
uint64_t tk_nin;
@@ -1408,24 +1408,19 @@
default:
break;
}
-#ifdef COMPAT_60
- error = compat_60_ttioctl(tp, cmd, data, flag, l);
- if (error != EPASSTHROUGH)
- return error;
-#endif /* COMPAT_60 */
/* We may have to load the compat module for this. */
for (;;) {
rw_enter(&ttcompat_lock, RW_READER);
- if (ttcompatvec != NULL) {
+ if (vec_compat_ttioctl_60 != NULL) {
break;
}
rw_exit(&ttcompat_lock);
- (void)module_autoload("compat", MODULE_CLASS_ANY);
- if (ttcompatvec == NULL) {
+ (void)module_autoload("compat", MODULE_CLASS_EXEC);
+ if (vec_compat_ttioctl_60 == NULL) {
return EPASSTHROUGH;
}
}
- error = (*ttcompatvec)(tp, cmd, data, flag, l);
+ error = (*vec_compat_ttioctl_60)(tp, cmd, data, flag, l);
rw_exit(&ttcompat_lock);
return error;
}
diff -r 65db40300fe7 -r a7f9dae3bdf8 sys/sys/tty.h
--- a/sys/sys/tty.h Sun Mar 18 09:00:55 2018 +0000
+++ b/sys/sys/tty.h Sun Mar 18 12:06:59 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.h,v 1.94 2017/10/31 10:45:19 martin Exp $ */
+/* $NetBSD: tty.h,v 1.94.2.1 2018/03/18 12:07:00 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -313,7 +313,8 @@
int clalloc(struct clist *, int, int);
void clfree(struct clist *);
-extern int (*ttcompatvec)(struct tty *, u_long, void *, int, struct lwp *);
+extern int (*vec_compat_ttioctl_60)(struct tty *, u_long, void *, int,
+ struct lwp *);
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