Subject: Fix for get/putwschar
To: None <tech-kern@netbsd.org>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: tech-kern
Date: 04/13/2006 19:32:00
------=_Part_26930_29907718.1144949520571
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Attached is a patch to fix the get/putwschar functions. It:
- Removes the getwschar and putwschar accessops from the wsdisplay
devices.
- Handles these two functions from the drivers implementing them.
- Removes the void * pointers that they used to have in the past.
- Gets rid of the WSDISPLAY_CHARFUNCS kernel option; useless.
Time to review it.
PS: I'd be glad to know if these functions work with vcons-enabled
drivers such as vesafb. (The patch shouldn't change their behavior
though.)
--
Julio M. Merino Vidal <jmmv84@gmail.com>
The Julipedia - http://julipedia.blogspot.com/
------=_Part_26930_29907718.1144949520571
Content-Type: text/x-patch; name=patch.diff; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="patch.diff"
Index: arch/amd64/conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/conf/GENERIC,v
retrieving revision 1.91
diff -u -p -r1.91 GENERIC
--- arch/amd64/conf/GENERIC 12 Apr 2006 03:41:51 -0000 1.91
+++ arch/amd64/conf/GENERIC 13 Apr 2006 17:27:32 -0000
@@ -211,10 +211,6 @@ options PCDISPLAY_SOFTCURSOR
#options VGA_CONSOLE_SCREENTYPE="\"80x24\""
# work around a hardware bug that loaded fonts don't work; found on ATI cards
#options VGA_CONSOLE_ATI_BROKEN_FONTSEL
-# the following enables some functions to get mouse console support.
-# if you want a really secure system, it may be better not to enable them,
-# see wsmoused(8), section SECURITY CONSIDERATIONS for more info.
-#options WSDISPLAY_CHARFUNCS # mouse console support
# console scrolling support.
options WSDISPLAY_SCROLLSUPPORT
# enable VGA raster mode capable of displaying multilingual text on console
Index: arch/amd64/conf/INSTALL
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/conf/INSTALL,v
retrieving revision 1.50
diff -u -p -r1.50 INSTALL
--- arch/amd64/conf/INSTALL 12 Apr 2006 03:41:51 -0000 1.50
+++ arch/amd64/conf/INSTALL 13 Apr 2006 17:27:32 -0000
@@ -149,10 +149,6 @@ options PCDISPLAY_SOFTCURSOR
#options VGA_CONSOLE_SCREENTYPE="\"80x24\""
# work around a hardware bug that loaded fonts don't work; found on ATI cards
#options VGA_CONSOLE_ATI_BROKEN_FONTSEL
-# the following enables some functions to get mouse console support.
-# if you want a really secure system, it may be better not to enable them,
-# see wsmoused(8), section SECURITY CONSIDERATIONS for more info.
-#options WSDISPLAY_CHARFUNCS # mouse console support
# enable VGA raster mode capable of displaying multilingual text on console
#options VGA_RASTERCONSOLE
Index: arch/arm/iomd/vidcvideo.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/iomd/vidcvideo.c,v
retrieving revision 1.22
diff -u -p -r1.22 vidcvideo.c
--- arch/arm/iomd/vidcvideo.c 12 Apr 2006 19:38:22 -0000 1.22
+++ arch/arm/iomd/vidcvideo.c 13 Apr 2006 17:27:32 -0000
@@ -182,9 +182,7 @@ static const struct wsdisplay_accessops
vidcvideo_free_screen,
vidcvideo_show_screen,
NULL, /* load_font */
- NULL, /* pollc */
- NULL, /* getwschar */
- NULL /* putwschar */
+ NULL /* pollc */
};
Index: arch/cats/conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/cats/conf/GENERIC,v
retrieving revision 1.103
diff -u -p -r1.103 GENERIC
--- arch/cats/conf/GENERIC 28 Mar 2006 20:58:39 -0000 1.103
+++ arch/cats/conf/GENERIC 13 Apr 2006 17:27:33 -0000
@@ -188,10 +188,6 @@ options WSDISPLAY_COMPAT_USL # VT hand
options WSDISPLAY_COMPAT_RAWKBD # can get raw scancodes
# see dev/wscons/wskbdmap_mfii.h for implemented layouts
#options PCKBD_LAYOUT="(KB_DE | KB_NODEAD)"
-# the following enables some functions to get mouse console support.
-# if you want a really secure system, it may be better not to enable them,
-# see wsmoused(8), section SECURITY CONSIDERATIONS for more info.
-#options WSDISPLAY_CHARFUNCS # mouse console support
# Development and Debugging options
Index: arch/evbarm/conf/ARMADILLO9
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/conf/ARMADILLO9,v
retrieving revision 1.10
diff -u -p -r1.10 ARMADILLO9
--- arch/evbarm/conf/ARMADILLO9 13 Feb 2006 12:24:22 -0000 1.10
+++ arch/evbarm/conf/ARMADILLO9 13 Apr 2006 17:27:33 -0000
@@ -342,10 +342,6 @@ options WSEMUL_VT100 # VT100 / VT220 e
#options VGA_CONSOLE_SCREENTYPE="\"80x24\""
# work around a hardware bug that loaded fonts don't work; found on ATI cards
#options VGA_CONSOLE_ATI_BROKEN_FONTSEL
-# the following enables some functions to get mouse console support.
-# if you want a really secure system, it may be better not to enable them,
-# see wsmoused(8), section SECURITY CONSIDERATIONS for more info.
-#options WSDISPLAY_CHARFUNCS # mouse console support
# console scrolling support.
#options WSDISPLAY_SCROLLSUPPORT
# enable VGA raster mode capable of displaying multilingual text on console
Index: arch/evbarm/conf/TS7200
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/conf/TS7200,v
retrieving revision 1.25
diff -u -p -r1.25 TS7200
--- arch/evbarm/conf/TS7200 5 Feb 2006 05:01:49 -0000 1.25
+++ arch/evbarm/conf/TS7200 13 Apr 2006 17:27:33 -0000
@@ -479,10 +479,6 @@ options WSEMUL_VT100 # VT100 / VT220 e
#options VGA_CONSOLE_SCREENTYPE="\"80x24\""
# work around a hardware bug that loaded fonts don't work; found on ATI cards
#options VGA_CONSOLE_ATI_BROKEN_FONTSEL
-# the following enables some functions to get mouse console support.
-# if you want a really secure system, it may be better not to enable them,
-# see wsmoused(8), section SECURITY CONSIDERATIONS for more info.
-#options WSDISPLAY_CHARFUNCS # mouse console support
# console scrolling support.
#options WSDISPLAY_SCROLLSUPPORT
# enable VGA raster mode capable of displaying multilingual text on console
Index: arch/hp700/conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/hp700/conf/GENERIC,v
retrieving revision 1.64
diff -u -p -r1.64 GENERIC
--- arch/hp700/conf/GENERIC 28 Mar 2006 20:58:40 -0000 1.64
+++ arch/hp700/conf/GENERIC 13 Apr 2006 17:27:34 -0000
@@ -205,10 +205,6 @@ options PCDISPLAY_SOFTCURSOR
#options VGA_CONSOLE_SCREENTYPE="\"80x24\""
# work around a hardware bug that loaded fonts don't work; found on ATI cards
#options VGA_CONSOLE_ATI_BROKEN_FONTSEL
-# the following enables some functions to get mouse console support.
-# if you want a really secure system, it may be better not to enable them,
-# see wsmoused(8), section SECURITY CONSIDERATIONS for more info.
-#options WSDISPLAY_CHARFUNCS # mouse console support
# console scrolling support.
#options WSDISPLAY_SCROLLSUPPORT
# enable VGA raster mode capable of displaying multilingual text on console
Index: arch/i386/conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/conf/GENERIC,v
retrieving revision 1.742
diff -u -p -r1.742 GENERIC
--- arch/i386/conf/GENERIC 13 Apr 2006 00:30:19 -0000 1.742
+++ arch/i386/conf/GENERIC 13 Apr 2006 17:27:35 -0000
@@ -276,10 +276,6 @@ options PCDISPLAY_SOFTCURSOR
#options VGA_CONSOLE_SCREENTYPE="\"80x24\""
# work around a hardware bug that loaded fonts don't work; found on ATI cards
#options VGA_CONSOLE_ATI_BROKEN_FONTSEL
-# the following enables some functions to get mouse console support.
-# if you want a really secure system, it may be better not to enable them,
-# see wsmoused(8), section SECURITY CONSIDERATIONS for more info.
-#options WSDISPLAY_CHARFUNCS # mouse console support
# console scrolling support.
options WSDISPLAY_SCROLLSUPPORT
# enable VGA raster mode capable of displaying multilingual text on console
Index: arch/i386/conf/LAMB
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/conf/LAMB,v
retrieving revision 1.62
diff -u -p -r1.62 LAMB
--- arch/i386/conf/LAMB 28 Mar 2006 20:58:40 -0000 1.62
+++ arch/i386/conf/LAMB 13 Apr 2006 17:27:35 -0000
@@ -200,10 +200,6 @@ options PCDISPLAY_SOFTCURSOR
#options VGA_CONSOLE_SCREENTYPE="\"80x24\""
# work around a hardware bug that loaded fonts don't work; found on ATI cards
#options VGA_CONSOLE_ATI_BROKEN_FONTSEL
-# the following enables some functions to get mouse console support.
-# if you want a really secure system, it may be better not to enable them,
-# see wsmoused(8), section SECURITY CONSIDERATIONS for more info.
-#options WSDISPLAY_CHARFUNCS # mouse console support
# Kernel root file system and dump configuration.
config netbsd root on ? type ?
Index: arch/i386/conf/VIRTUALPC
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/conf/VIRTUALPC,v
retrieving revision 1.39
diff -u -p -r1.39 VIRTUALPC
--- arch/i386/conf/VIRTUALPC 28 Mar 2006 20:58:40 -0000 1.39
+++ arch/i386/conf/VIRTUALPC 13 Apr 2006 17:27:35 -0000
@@ -234,10 +234,6 @@ options PCDISPLAY_SOFTCURSOR
#options VGA_CONSOLE_SCREENTYPE="\"80x24\""
# work around a hardware bug that loaded fonts don't work; found on ATI cards
#options VGA_CONSOLE_ATI_BROKEN_FONTSEL
-# the following enables some functions to get mouse console support.
-# if you want a really secure system, it may be better not to enable them,
-# see wsmoused(8), section SECURITY CONSIDERATIONS for more info.
-#options WSDISPLAY_CHARFUNCS # mouse console support
# enable VGA raster mode capable of displaying multilingual text on console
#options VGA_RASTERCONSOLE
Index: arch/sgimips/conf/GENERIC32_IP2x
===================================================================
RCS file: /cvsroot/src/sys/arch/sgimips/conf/GENERIC32_IP2x,v
retrieving revision 1.47
diff -u -p -r1.47 GENERIC32_IP2x
--- arch/sgimips/conf/GENERIC32_IP2x 28 Mar 2006 20:58:41 -0000 1.47
+++ arch/sgimips/conf/GENERIC32_IP2x 13 Apr 2006 17:27:37 -0000
@@ -192,10 +192,6 @@ options WS_KERNEL_FG=WSCOL_GREEN
options WSDISPLAY_COMPAT_RAWKBD # can get raw scancodes
# see dev/pckbc/wskbdmap_mfii.c for implemented layouts
#options PCKBD_LAYOUT="(KB_DE | KB_NODEAD)"
-# the following enables some functions to get mouse console support.
-# if you want a really secure system, it may be better not to enable them,
-# see wsmoused(8), section SECURITY CONSIDERATIONS for more info.
-#options WSDISPLAY_CHARFUNCS # mouse console support
# Kernel root file system and dump configuration.
Index: arch/shark/conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/shark/conf/GENERIC,v
retrieving revision 1.60
diff -u -p -r1.60 GENERIC
--- arch/shark/conf/GENERIC 28 Mar 2006 20:58:41 -0000 1.60
+++ arch/shark/conf/GENERIC 13 Apr 2006 17:27:37 -0000
@@ -207,10 +207,6 @@ options WSDISPLAY_COMPAT_RAWKBD # can
#options PCDISPLAY_SOFTCURSOR
# modify the screen type of the console; defaults to "80x25"
#options VGA_CONSOLE_SCREENTYPE="\"80x24\""
-# the following enables some functions to get mouse console support.
-# if you want a really secure system, it may be better not to enable them,
-# see wsmoused(8), section SECURITY CONSIDERATIONS for more info.
-#options WSDISPLAY_CHARFUNCS # mouse console support
# console scrolling support.
#options WSDISPLAY_SCROLLSUPPORT
# enable VGA raster mode capable of displaying multilingual text on console
Index: arch/sparc64/dev/ffb.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/dev/ffb.c,v
retrieving revision 1.25
diff -u -p -r1.25 ffb.c
--- arch/sparc64/dev/ffb.c 12 Apr 2006 20:22:00 -0000 1.25
+++ arch/sparc64/dev/ffb.c 13 Apr 2006 17:27:38 -0000
@@ -136,8 +136,6 @@ struct wsdisplay_accessops ffb_accessops
ffb_show_screen,
NULL, /* load font */
NULL, /* pollc */
- NULL, /* getwschar */
- NULL, /* putwschar */
NULL, /* scroll */
};
Index: dev/ic/pcdisplay_subr.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/pcdisplay_subr.c,v
retrieving revision 1.31
diff -u -p -r1.31 pcdisplay_subr.c
--- dev/ic/pcdisplay_subr.c 12 Apr 2006 20:08:20 -0000 1.31
+++ dev/ic/pcdisplay_subr.c 13 Apr 2006 17:27:38 -0000
@@ -30,7 +30,6 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pcdisplay_subr.c,v 1.31 2006/04/12 20:08:20 jmmv Exp $");
-#include "opt_wsdisplay_compat.h" /* for WSDISPLAY_CHARFUNCS */
#include "opt_wsmsgattrs.h" /* for WSDISPLAY_CUSTOM_OUTPUT */
#include <sys/param.h>
@@ -291,15 +290,15 @@ pcdisplay_replaceattr(void *id, long old
}
#endif /* WSDISPLAY_CUSTOM_OUTPUT */
-#ifdef WSDISPLAY_CHARFUNCS
int
-pcdisplay_getwschar(void *id, struct wsdisplay_char *wschar)
+pcdisplay_getwschar(struct pcdisplayscreen *scr, struct wsdisplay_char *wschar)
{
- struct pcdisplayscreen *scr = id;
int off;
uint16_t chardata;
uint8_t attrbyte;
+ KASSERT(scr != NULL && wschar != NULL);
+
off = wschar->row * scr->type->ncols + wschar->col;
if (off >= scr->type->ncols * scr->type->nrows)
return -1;
@@ -322,13 +321,14 @@ pcdisplay_getwschar(void *id, struct wsd
}
int
-pcdisplay_putwschar(void *id, struct wsdisplay_char *wschar)
+pcdisplay_putwschar(struct pcdisplayscreen *scr, struct wsdisplay_char *wschar)
{
- struct pcdisplayscreen *scr = id;
int off;
uint16_t chardata;
uint8_t attrbyte;
+ KASSERT(scr != NULL && wschar != NULL);
+
off = wschar->row * scr->type->ncols + wschar->col;
if (off >= (scr->type->ncols * scr->type->nrows))
return -1;
@@ -348,4 +348,3 @@ pcdisplay_putwschar(void *id, struct wsd
return 0;
}
-#endif /* WSDISPLAY_CHARFUNCS */
Index: dev/ic/pcdisplayvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/pcdisplayvar.h,v
retrieving revision 1.16
diff -u -p -r1.16 pcdisplayvar.h
--- dev/ic/pcdisplayvar.h 16 Feb 2006 20:17:16 -0000 1.16
+++ dev/ic/pcdisplayvar.h 13 Apr 2006 17:27:38 -0000
@@ -90,5 +90,5 @@ void pcdisplay_copyrows(void *, int, int
void pcdisplay_eraserows(void *, int, int, long);
void pcdisplay_replaceattr(void *, long, long);
struct wsdisplay_char;
-int pcdisplay_getwschar(void *, struct wsdisplay_char *);
-int pcdisplay_putwschar(void *, struct wsdisplay_char *);
+int pcdisplay_getwschar(struct pcdisplayscreen *, struct wsdisplay_char *);
+int pcdisplay_putwschar(struct pcdisplayscreen *, struct wsdisplay_char *);
Index: dev/ic/vga.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/vga.c,v
retrieving revision 1.86
diff -u -p -r1.86 vga.c
--- dev/ic/vga.c 12 Apr 2006 19:38:23 -0000 1.86
+++ dev/ic/vga.c 13 Apr 2006 17:27:39 -0000
@@ -27,7 +27,7 @@
* rights to redistribute these changes.
*/
-/* for WSCONS_SUPPORT_PCVTFONTS and WSDISPLAY_CHARFUNCS */
+/* for WSCONS_SUPPORT_PCVTFONTS */
#include "opt_wsdisplay_compat.h"
/* for WSDISPLAY_CUSTOM_BORDER */
#include "opt_wsdisplay_border.h"
@@ -274,10 +274,6 @@ static void vga_free_screen(void *, void
static int vga_show_screen(void *, void *, int,
void (*)(void *, int, int), void *);
static int vga_load_font(void *, void *, struct wsdisplay_font *);
-#ifdef WSDISPLAY_CHARFUNCS
-static int vga_getwschar(void *, struct wsdisplay_char *);
-static int vga_putwschar(void *, struct wsdisplay_char *);
-#endif /* WSDISPLAY_CHARFUNCS */
#ifdef WSDISPLAY_CUSTOM_BORDER
static int vga_getborder(struct vga_config *, u_int *);
static int vga_setborder(struct vga_config *, u_int);
@@ -293,13 +289,6 @@ const struct wsdisplay_accessops vga_acc
vga_show_screen,
vga_load_font,
NULL,
-#ifdef WSDISPLAY_CHARFUNCS
- vga_getwschar,
- vga_putwschar,
-#else /* WSDISPLAY_CHARFUNCS */
- NULL,
- NULL,
-#endif /* WSDISPLAY_CHARFUNCS */
#ifdef WSDISPLAY_SCROLLSUPPORT
vga_scroll,
#else
@@ -771,6 +760,7 @@ int
vga_ioctl(void *v, void *vs, u_long cmd, caddr_t data, int flag, struct lwp *l)
{
struct vga_config *vc = v;
+ struct vgascreen *scr = vs;
const struct vga_funcs *vf = vc->vc_funcs;
switch (cmd) {
@@ -791,6 +781,14 @@ vga_ioctl(void *v, void *vs, u_long cmd,
vga_set_video(vc, *(int *)data == WSDISPLAYIO_VIDEO_ON);
return 0;
+ case WSDISPLAYIO_GETWSCHAR:
+ return pcdisplay_getwschar((struct pcdisplayscreen *)scr,
+ (struct wsdisplay_char *)data);
+
+ case WSDISPLAYIO_PUTWSCHAR:
+ return pcdisplay_putwschar((struct pcdisplayscreen *)scr,
+ (struct wsdisplay_char *)data);
+
#ifdef WSDISPLAY_CUSTOM_BORDER
case WSDISPLAYIO_GBORDER:
return (vga_getborder(vc, (u_int *)data));
@@ -1417,27 +1415,6 @@ vga_putchar(void *c, int row, int col, u
pcdisplay_putchar(c, row, col, uc, attr);
}
-
-#ifdef WSDISPLAY_CHARFUNCS
-int
-vga_getwschar(void *cookie, struct wsdisplay_char *wschar)
-{
- struct vgascreen *scr = cookie;
-
- if (scr == NULL) return 0;
- return (pcdisplay_getwschar(&scr->pcs, wschar));
-}
-
-int
-vga_putwschar(void *cookie, struct wsdisplay_char *wschar)
-{
- struct vgascreen *scr = cookie;
-
- if (scr == NULL) return 0;
- return (pcdisplay_putwschar(&scr->pcs, wschar));
-}
-#endif /* WSDISPLAY_CHARFUNCS */
-
#ifdef WSDISPLAY_CUSTOM_BORDER
static int
vga_getborder(struct vga_config *vc, u_int *valuep)
Index: dev/pci/machfb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/machfb.c,v
retrieving revision 1.41
diff -u -p -r1.41 machfb.c
--- dev/pci/machfb.c 12 Apr 2006 20:35:42 -0000 1.41
+++ dev/pci/machfb.c 13 Apr 2006 17:27:40 -0000
@@ -382,8 +382,6 @@ static struct wsdisplay_accessops mach64
NULL, /* vcons_show_screen */
NULL, /* load_font */
NULL, /* polls */
- NULL, /* getwschar */
- NULL, /* putwschar */
NULL, /* scroll */
};
Index: dev/pci/voodoofb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/voodoofb.c,v
retrieving revision 1.3
diff -u -p -r1.3 voodoofb.c
--- dev/pci/voodoofb.c 12 Apr 2006 23:11:56 -0000 1.3
+++ dev/pci/voodoofb.c 13 Apr 2006 17:27:41 -0000
@@ -198,8 +198,6 @@ struct wsdisplay_accessops voodoofb_acce
voodoofb_mmap,
NULL, /* load_font */
NULL, /* polls */
- NULL, /* getwschar */
- NULL, /* putwschar */
NULL, /* scroll */
};
Index: dev/sbus/p9100.c
===================================================================
RCS file: /cvsroot/src/sys/dev/sbus/p9100.c,v
retrieving revision 1.31
diff -u -p -r1.31 p9100.c
--- dev/sbus/p9100.c 12 Apr 2006 19:38:24 -0000 1.31
+++ dev/sbus/p9100.c 13 Apr 2006 17:27:41 -0000
@@ -250,8 +250,6 @@ struct wsdisplay_accessops p9100_accesso
NULL, /* vcons_show_screen */
NULL, /* load_font */
NULL, /* polls */
- NULL, /* getwschar */
- NULL, /* putwschar */
NULL, /* scroll */
};
#endif
Index: dev/sun/cgsix.c
===================================================================
RCS file: /cvsroot/src/sys/dev/sun/cgsix.c,v
retrieving revision 1.30
diff -u -p -r1.30 cgsix.c
--- dev/sun/cgsix.c 12 Apr 2006 19:38:24 -0000 1.30
+++ dev/sun/cgsix.c 13 Apr 2006 17:27:42 -0000
@@ -192,8 +192,6 @@ struct wsdisplay_accessops cgsix_accesso
cgsix_show_screen,
NULL, /* load_font */
NULL, /* pollc */
- NULL, /* getwschar */
- NULL, /* putwschar */
NULL /* scroll */
};
Index: dev/wscons/files.wscons
===================================================================
RCS file: /cvsroot/src/sys/dev/wscons/files.wscons,v
retrieving revision 1.37
diff -u -p -r1.37 files.wscons
--- dev/wscons/files.wscons 23 Feb 2006 08:01:59 -0000 1.37
+++ dev/wscons/files.wscons 13 Apr 2006 17:27:42 -0000
@@ -27,7 +27,6 @@ defparam opt_wsemul.h WSEMUL_VT100_HILI
defflag opt_wsdisplay_compat.h WSDISPLAY_COMPAT_USL
WSDISPLAY_COMPAT_RAWKBD
WSDISPLAY_COMPAT_PCVT WSDISPLAY_COMPAT_SYSCONS
- WSDISPLAY_CHARFUNCS
WSCONS_SUPPORT_PCVTFONTS
WSCONS_SUPPORT_ISO7FONTS
WSDISPLAY_SCROLLSUPPORT
Index: dev/wscons/wsdisplay.c
===================================================================
RCS file: /cvsroot/src/sys/dev/wscons/wsdisplay.c,v
retrieving revision 1.96
diff -u -p -r1.96 wsdisplay.c
--- dev/wscons/wsdisplay.c 13 Apr 2006 01:15:27 -0000 1.96
+++ dev/wscons/wsdisplay.c 13 Apr 2006 17:27:43 -0000
@@ -1134,28 +1134,6 @@ wsdisplay_internal_ioctl(struct wsdispla
return (error);
#undef d
-#if defined(WSDISPLAY_CHARFUNCS)
- case WSDISPLAYIO_GETWSCHAR:
-#define d ((struct wsdisplay_char *)data)
- if (!sc->sc_accessops->getwschar)
- return (EINVAL);
- return ((*sc->sc_accessops->getwschar)
- (scr->scr_dconf->emulcookie, d));
-#undef d
-
- case WSDISPLAYIO_PUTWSCHAR:
-#define d ((struct wsdisplay_char *)data)
- if (!sc->sc_accessops->putwschar)
- return (EINVAL);
- return ((*sc->sc_accessops->putwschar)
- (scr->scr_dconf->emulcookie, d));
-#undef d
-#else
- case WSDISPLAYIO_PUTWSCHAR:
- case WSDISPLAYIO_GETWSCHAR:
- return ENODEV;
-#endif /* WSDISPLAY_CHARFUNCS */
-
#ifdef WSDISPLAY_CUSTOM_OUTPUT
case WSDISPLAYIO_GMSGATTRS:
#define d ((struct wsdisplay_msgattrs *)data)
Index: dev/wscons/wsdisplay_vcons.c
===================================================================
RCS file: /cvsroot/src/sys/dev/wscons/wsdisplay_vcons.c,v
retrieving revision 1.5
diff -u -p -r1.5 wsdisplay_vcons.c
--- dev/wscons/wsdisplay_vcons.c 19 Feb 2006 03:51:03 -0000 1.5
+++ dev/wscons/wsdisplay_vcons.c 13 Apr 2006 17:27:43 -0000
@@ -60,6 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsdisplay_vc
static void vcons_dummy_init_screen(void *, struct vcons_screen *, int,
long *);
+static int vcons_ioctl(void *, void *, u_long, caddr_t, int, struct lwp *);
static int vcons_alloc_screen(void *, const struct wsscreen_descr *, void **,
int *, int *, long *);
static void vcons_free_screen(void *, void *);
@@ -87,8 +88,8 @@ static void vcons_putchar(void *, int, i
static void vcons_cursor(void *, int, int, int);
/* support for readin/writing text buffers. For wsmoused */
-static int vcons_putwschar(void *, struct wsdisplay_char *);
-static int vcons_getwschar(void *, struct wsdisplay_char *);
+static int vcons_putwschar(struct rasops_info *, struct wsdisplay_char *);
+static int vcons_getwschar(struct rasops_info *, struct wsdisplay_char *);
static void vcons_lock(struct vcons_screen *);
static void vcons_unlock(struct vcons_screen *);
@@ -107,11 +108,15 @@ vcons_init(struct vcons_data *vd, void *
vd->init_screen = vcons_dummy_init_screen;
vd->show_screen_cb = NULL;
+ /* keep a copy of the accessops that we replace below with our
+ * own wrappers */
+ vd->ioctl = ao->ioctl;
+
+ /* configure the accessops */
+ ao->ioctl = vcons_ioctl;
ao->alloc_screen = vcons_alloc_screen;
ao->free_screen = vcons_free_screen;
ao->show_screen = vcons_show_screen;
- ao->getwschar = vcons_getwschar;
- ao->putwschar = vcons_putwschar;
LIST_INIT(&vd->screens);
vd->active = NULL;
@@ -361,6 +366,34 @@ vcons_redraw_screen(struct vcons_screen
}
static int
+vcons_ioctl(void *v, void *vs, u_long cmd, caddr_t data, int flag,
+ struct lwp *l)
+{
+ struct vcons_data *vd = v;
+ int error;
+
+ switch (cmd) {
+ case WSDISPLAYIO_GETWSCHAR:
+ error = vcons_getwschar(vd->cookie,
+ (struct wsdisplay_char *)data);
+ break;
+
+ case WSDISPLAYIO_PUTWSCHAR:
+ error = vcons_putwschar(vd->cookie,
+ (struct wsdisplay_char *)data);
+ break;
+
+ default:
+ if (vd->ioctl != NULL)
+ error = (*vd->ioctl)(v, vs, cmd, data, flag, l);
+ else
+ error = EINVAL;
+ }
+
+ return error;
+}
+
+static int
vcons_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
int *curxp, int *curyp, long *defattrp)
{
@@ -622,9 +655,8 @@ vcons_cursor(void *cookie, int on, int r
/* methods to read/write characters via ioctl() */
static int
-vcons_putwschar(void *cookie, struct wsdisplay_char *wsc)
+vcons_putwschar(struct rasops_info *ri, struct wsdisplay_char *wsc)
{
- struct rasops_info *ri = cookie;
long attr;
ri->ri_ops.allocattr(ri, wsc->foreground, wsc->background,
@@ -634,9 +666,8 @@ vcons_putwschar(void *cookie, struct wsd
}
static int
-vcons_getwschar(void *cookie, struct wsdisplay_char *wsc)
+vcons_getwschar(struct rasops_info *ri, struct wsdisplay_char *wsc)
{
- struct rasops_info *ri = cookie;
struct vcons_screen *scr = ri->ri_hw;
long attr;
int offset = ri->ri_cols * wsc->row + wsc->col;
Index: dev/wscons/wsdisplay_vconsvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/wscons/wsdisplay_vconsvar.h,v
retrieving revision 1.3
diff -u -p -r1.3 wsdisplay_vconsvar.h
--- dev/wscons/wsdisplay_vconsvar.h 19 Feb 2006 03:51:03 -0000 1.3
+++ dev/wscons/wsdisplay_vconsvar.h 13 Apr 2006 17:27:43 -0000
@@ -85,6 +85,9 @@ struct vcons_data {
void (*init_screen)(void *, struct vcons_screen *, int,
long *);
+ /* accessops */
+ int (*ioctl)(void *, void *, u_long, caddr_t, int, struct lwp *);
+
/* rasops */
void (*copycols)(void *, int, int, int, int);
void (*erasecols)(void *, int, int, int, long);
Index: dev/wscons/wsdisplayvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/wscons/wsdisplayvar.h,v
retrieving revision 1.38
diff -u -p -r1.38 wsdisplayvar.h
--- dev/wscons/wsdisplayvar.h 12 Apr 2006 19:38:24 -0000 1.38
+++ dev/wscons/wsdisplayvar.h 13 Apr 2006 17:27:43 -0000
@@ -121,8 +121,6 @@ struct wsdisplay_accessops {
void (*) (void *, int, int), void *);
int (*load_font)(void *, void *, struct wsdisplay_font *);
void (*pollc)(void *, int);
- int (*getwschar)(void *, struct wsdisplay_char *);
- int (*putwschar)(void *, struct wsdisplay_char *);
void (*scroll)(void *, void *, int);
};
------=_Part_26930_29907718.1144949520571--