Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys tty(9): New function tty_unit for struct cdevsw::d_devto...
details: https://anonhg.NetBSD.org/src/rev/deb1f14c257b
branches: trunk
changeset: 364707:deb1f14c257b
user: riastradh <riastradh%NetBSD.org@localhost>
date: Thu Apr 07 21:46:51 2022 +0000
description:
tty(9): New function tty_unit for struct cdevsw::d_devtounit.
diffstat:
sys/kern/tty.c | 16 ++++++++++++++--
sys/sys/tty.h | 3 ++-
2 files changed, 16 insertions(+), 3 deletions(-)
diffs (54 lines):
diff -r ee258a01834e -r deb1f14c257b sys/kern/tty.c
--- a/sys/kern/tty.c Thu Apr 07 20:23:44 2022 +0000
+++ b/sys/kern/tty.c Thu Apr 07 21:46:51 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.c,v 1.300 2022/03/28 12:39:28 riastradh Exp $ */
+/* $NetBSD: tty.c,v 1.301 2022/04/07 21:46:51 riastradh Exp $ */
/*-
* Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.300 2022/03/28 12:39:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.301 2022/04/07 21:46:51 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -2901,6 +2901,18 @@
}
/*
+ * tty_unit: map dev_t to tty unit number, as with TTUNIT
+ *
+ * => defined as function for use with struct cdevsw::d_devtounit
+ * => not for drivers with different unit numbering, e.g. TTUNIT(d) >> 4
+ */
+int
+tty_unit(dev_t dev)
+{
+ return TTUNIT(dev);
+}
+
+/*
* ttyprintf_nolock: send a message to a specific tty, without locking.
*
* => should be used only by tty driver or anything that knows the
diff -r ee258a01834e -r deb1f14c257b sys/sys/tty.h
--- a/sys/sys/tty.h Thu Apr 07 20:23:44 2022 +0000
+++ b/sys/sys/tty.h Thu Apr 07 21:46:51 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.h,v 1.96 2022/03/28 12:39:28 riastradh Exp $ */
+/* $NetBSD: tty.h,v 1.97 2022/04/07 21:46:51 riastradh Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -312,6 +312,7 @@
void tty_free(struct tty *);
u_char *firstc(struct clist *, int *);
bool ttypull(struct tty *);
+int tty_unit(dev_t);
int clalloc(struct clist *, int, int);
void clfree(struct clist *);
Home |
Main Index |
Thread Index |
Old Index