Subject: Re: Fix for get/putwschar
To: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
From: Michael Lorenz <macallan@netbsd.org>
List: tech-kern
Date: 04/13/2006 20:32:35
--Signature_Thu__13_Apr_2006_20_32_35_-0400_mnnxFmJx=41Kzybg
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Hello,

> > Index: dev/wscons/wsdisplay_vcons.c
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > 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,=20
> >  	    long *);
> > =20
> > +static int  vcons_ioctl(void *, void *, u_long, caddr_t, int,
> > struct lwp *);
> >  static int  vcons_alloc_screen(void *, const struct wsscreen_descr
> >  *, void **,=20
> >  	    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);
> > =20
> >  /* 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 *);
>=20
> Is rasops_info semantically correct way to refer to a vcons screen?
> Admittedly I haven't checked it thoroughly, but I suspect - no.
> Michael?

These functions work on struct vcons_screen * - not much of a
difference since the first element in struct vcons_screen is a struct
rasops_info but using vcons_screen saves some casts and is more
logically correct since it needs the additional stuff in scruct
vcons_screen like character and attribute buffers.

> > @@ -361,6 +366,34 @@ vcons_redraw_screen(struct vcons_screen=20
> >  }
> > =20
> >  static int
> > +vcons_ioctl(void *v, void *vs, u_long cmd, caddr_t data, int flag,
> > +	struct lwp *l)
> > +{
> > +	struct vcons_data *vd =3D v;
> > +	int error;
> > +
> > +	switch (cmd) {
> > +	case WSDISPLAYIO_GETWSCHAR:
> > +		error =3D vcons_getwschar(vd->cookie,
> > +			(struct wsdisplay_char *)data);
> > +		break;
>=20
> vd->cookie is driver's cookie to vcons.  It cannot be rasops (see
> prototype in the previous hunk).  E.g. isgfb passes struct
> igsfb_devconfig as cookie.

This is wrong ( err, I mean uwe is right ). We get the screen cookie
passed in vs and that's what we need to hand over to
vcons_{put|get}char(). Should probably be tested for NULL before doing
anything with it. Would ioctl()s on the control device end up here?

have fun
Michael

--Signature_Thu__13_Apr_2006_20_32_35_-0400_mnnxFmJx=41Kzybg
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (NetBSD)

iQEUAwUBRD7to8pnzkX8Yg2nAQIIvwf4qw6fR20p3UovGbm0c7h6HklosH9EBX9u
sGIuCtpjF7fzbQMziXoTw6iE3IjOhdoNBrRmSBAwKhvt0zoQpWgP2N41+9xZRGnx
B043Mvqy9mno25jB2jTiMlvpFBvDiXMtmmvlzcgDG1eVRDaFBGZY68Wa/OnD6shA
n/RXBc+pK7yAV+2P7jzxHKMFZiyhWTS3yIHa32Hav7I3tIlXs8WcmC8DPWaQVFZV
qoHo3ERZQQkLpRm5J8NHEY4Bb21oJcfF3CcXrI4/rG2eqNAnJa9o/rgHXWPaZd4G
5ER3KJuGUgKwsVmNNmrF9ffBxZ7UnhoTyz/IQI+RQ6NZZJUfQB7W
=vC+o
-----END PGP SIGNATURE-----

--Signature_Thu__13_Apr_2006_20_32_35_-0400_mnnxFmJx=41Kzybg--