Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/wscons Split wsdisplay_usl_ioctl() into two function...
details: https://anonhg.NetBSD.org/src/rev/3b8fd76191d6
branches: trunk
changeset: 477519:3b8fd76191d6
user: mycroft <mycroft%NetBSD.org@localhost>
date: Tue Oct 19 00:03:18 1999 +0000
description:
Split wsdisplay_usl_ioctl() into two functions -- one which is screen-dependent
and one which isn't. The latter is now used for ttyEcfg, enabling the
VT-switching ioctls to work on it. (This allows Linux X servers to work when
/emul/linux/dev/tty0 is linked to /dev/ttyEcfg.)
diffstat:
sys/dev/wscons/wsdisplay.c | 12 ++-
sys/dev/wscons/wsdisplay_compat_usl.c | 116 +++++++++++++++++++--------------
sys/dev/wscons/wsdisplayvar.h | 7 +-
3 files changed, 82 insertions(+), 53 deletions(-)
diffs (212 lines):
diff -r 5a2ef583a2d6 -r 3b8fd76191d6 sys/dev/wscons/wsdisplay.c
--- a/sys/dev/wscons/wsdisplay.c Mon Oct 18 22:41:23 1999 +0000
+++ b/sys/dev/wscons/wsdisplay.c Tue Oct 19 00:03:18 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.30 1999/10/12 16:47:41 jdolecek Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.31 1999/10/19 00:03:18 mycroft Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -33,7 +33,7 @@
static const char _copyright[] __attribute__ ((unused)) =
"Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.";
static const char _rcsid[] __attribute__ ((unused)) =
- "$NetBSD: wsdisplay.c,v 1.30 1999/10/12 16:47:41 jdolecek Exp $";
+ "$NetBSD: wsdisplay.c,v 1.31 1999/10/19 00:03:18 mycroft Exp $";
#include <sys/param.h>
#include <sys/conf.h>
@@ -890,6 +890,12 @@
unit = WSDISPLAYUNIT(dev);
sc = wsdisplay_cd.cd_devs[unit];
+#ifdef WSDISPLAY_COMPAT_USL
+ error = wsdisplay_usl_ioctl1(sc, cmd, data, flag, p);
+ if (error >= 0)
+ return (error);
+#endif
+
if (ISWSDISPLAYCTL(dev))
return (wsdisplay_cfg_ioctl(sc, cmd, data, flag, p));
@@ -912,7 +918,7 @@
}
#ifdef WSDISPLAY_COMPAT_USL
- error = wsdisplay_usl_ioctl(sc, scr, cmd, data, flag, p);
+ error = wsdisplay_usl_ioctl2(sc, scr, cmd, data, flag, p);
if (error >= 0)
return (error);
#endif
diff -r 5a2ef583a2d6 -r 3b8fd76191d6 sys/dev/wscons/wsdisplay_compat_usl.c
--- a/sys/dev/wscons/wsdisplay_compat_usl.c Mon Oct 18 22:41:23 1999 +0000
+++ b/sys/dev/wscons/wsdisplay_compat_usl.c Tue Oct 19 00:03:18 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay_compat_usl.c,v 1.9 1999/05/30 21:13:04 christos Exp $ */
+/* $NetBSD: wsdisplay_compat_usl.c,v 1.10 1999/10/19 00:03:18 mycroft Exp $ */
/*
* Copyright (c) 1998
@@ -288,7 +288,71 @@
}
int
-wsdisplay_usl_ioctl(sc, scr, cmd, data, flag, p)
+wsdisplay_usl_ioctl1(sc, cmd, data, flag, p)
+ struct wsdisplay_softc *sc;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
+{
+ int idx, maxidx;
+
+ switch (cmd) {
+ case VT_OPENQRY:
+ maxidx = wsdisplay_maxscreenidx(sc);
+ for (idx = 0; idx <= maxidx; idx++) {
+ if (wsdisplay_screenstate(sc, idx) == 0) {
+ *(int *)data = idx + 1;
+ return (0);
+ }
+ }
+ return (ENXIO);
+ case VT_GETACTIVE:
+ idx = wsdisplay_getactivescreen(sc);
+ *(int *)data = idx + 1;
+ return (0);
+ case VT_ACTIVATE:
+ idx = *(int *)data - 1;
+ return (wsdisplay_switch((struct device *)sc, idx, 1));
+ case VT_WAITACTIVE:
+ idx = *(int *)data - 1;
+ return (wsscreen_switchwait(sc, idx));
+ case VT_GETSTATE:
+#define ss ((struct vt_stat *)data)
+ idx = wsdisplay_getactivescreen(sc);
+ ss->v_active = idx + 1;
+ ss->v_state = 0;
+ maxidx = wsdisplay_maxscreenidx(sc);
+ for (idx = 0; idx <= maxidx; idx++)
+ if (wsdisplay_screenstate(sc, idx) == EBUSY)
+ ss->v_state |= (1 << (idx + 1));
+#undef s
+ return (0);
+
+#ifdef WSDISPLAY_COMPAT_PCVT
+ case VGAPCVTID:
+#define id ((struct pcvtid *)data)
+ strcpy(id->name, "pcvt");
+ id->rmajor = 3;
+ id->rminor = 32;
+#undef id
+ return (0);
+#endif
+#ifdef WSDISPLAY_COMPAT_SYSCONS
+ case CONS_GETVERS:
+ *(int *)data = 0x200; /* version 2.0 */
+ return (0);
+#endif
+
+ default:
+ return (-1);
+ }
+
+ return (0);
+}
+
+int
+wsdisplay_usl_ioctl2(sc, scr, cmd, data, flag, p)
struct wsdisplay_softc *sc;
struct wsscreen *scr;
u_long cmd;
@@ -296,7 +360,7 @@
int flag;
struct proc *p;
{
- int res, idx, maxidx;
+ int res;
struct usl_syncdata *sd;
int req, intarg;
struct wskbd_bell_data bd;
@@ -345,36 +409,7 @@
}
#undef d
return (0);
- case VT_OPENQRY:
- maxidx = wsdisplay_maxscreenidx(sc);
- for (idx = 0; idx <= maxidx; idx++) {
- if (wsdisplay_screenstate(sc, idx) == 0) {
- *(int *)data = idx + 1;
- return (0);
- }
- }
- return (ENXIO);
- case VT_GETACTIVE:
- idx = wsdisplay_getactivescreen(sc);
- *(int *)data = idx + 1;
- return (0);
- case VT_ACTIVATE:
- idx = *(int *)data - 1;
- return (wsdisplay_switch((struct device *)sc, idx, 1));
- case VT_WAITACTIVE:
- idx = *(int *)data - 1;
- return (wsscreen_switchwait(sc, idx));
- case VT_GETSTATE:
-#define ss ((struct vt_stat *)data)
- idx = wsdisplay_getactivescreen(sc);
- ss->v_active = idx + 1;
- ss->v_state = 0;
- maxidx = wsdisplay_maxscreenidx(sc);
- for (idx = 0; idx <= maxidx; idx++)
- if (wsdisplay_screenstate(sc, idx) == EBUSY)
- ss->v_state |= (1 << (idx + 1));
-#undef s
- return (0);
+
case KDENABIO:
if (suser(p->p_ucred, &p->p_acflag) || securelevel > 1)
return (EPERM);
@@ -396,21 +431,6 @@
/* XXX ignore for now */
return (0);
-#ifdef WSDISPLAY_COMPAT_PCVT
- case VGAPCVTID:
-#define id ((struct pcvtid *)data)
- strcpy(id->name, "pcvt");
- id->rmajor = 3;
- id->rminor = 32;
-#undef id
- return (0);
-#endif
-#ifdef WSDISPLAY_COMPAT_SYSCONS
- case CONS_GETVERS:
- *(int *)data = 0x200; /* version 2.0 */
- return (0);
-#endif
-
default:
return (-1);
diff -r 5a2ef583a2d6 -r 3b8fd76191d6 sys/dev/wscons/wsdisplayvar.h
--- a/sys/dev/wscons/wsdisplayvar.h Mon Oct 18 22:41:23 1999 +0000
+++ b/sys/dev/wscons/wsdisplayvar.h Tue Oct 19 00:03:18 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplayvar.h,v 1.12 1999/10/12 16:47:41 jdolecek Exp $ */
+/* $NetBSD: wsdisplayvar.h,v 1.13 1999/10/19 00:03:18 mycroft Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -183,7 +183,10 @@
u_long cmd, caddr_t data,
int flag, struct proc *p));
-int wsdisplay_usl_ioctl __P((struct wsdisplay_softc *, struct wsscreen *,
+int wsdisplay_usl_ioctl1 __P((struct wsdisplay_softc *,
+ u_long, caddr_t, int, struct proc *));
+
+int wsdisplay_usl_ioctl2 __P((struct wsdisplay_softc *, struct wsscreen *,
u_long, caddr_t, int, struct proc *));
int wsdisplay_cfg_ioctl __P((struct wsdisplay_softc *sc,
Home |
Main Index |
Thread Index |
Old Index