Subject: Re: wsdisplay ioctls
To: Garrett D'Amore <email@example.com>
From: Bill Studenmund <firstname.lastname@example.org>
Date: 05/12/2006 17:14:16
Content-Type: text/plain; charset=us-ascii
On Fri, May 12, 2006 at 02:23:07PM -0700, Garrett D'Amore wrote:
> After browsing, I notice that we are out of ioctl numbers for
> wsdisplay. Basically, wscons allocates ioctl codes 64-95 to wsdisplay.=
> They are all used up.
> I want to add more ioctls. E.g. ioctls for changing screen resolution,
> and some kind of ioctls for accleration.
> I notice that ioctls are allocated in a fashion that I *think* is
> wasteful. As an example:
> /* Cursor control: get and set position */
> #define WSDISPLAYIO_GCURPOS _IOR('W', 70, struct wsdisplay_curpos)
> #define WSDISPLAYIO_SCURPOS _IOW('W', 71, struct wsdisplay_curpos)
> These use two different values (70 & 71). It strikes me that the _IOR
> and _IOW macros add other bits, and that maybe it could have been
> possible to make them both use 70 (as an example).
Please don't do that. Our common behavior is to not overlap them, and I=20
don't see a strong need to here. While these aren't the strongest=20
examples, in general, keeping the numbers distinct makes it easy to figure=
out what ioctl is being used.
I agree though that there is a symmetry in having set and get use the same=
number. If you HAVE to start overlapping, they would be the best ones.
> Colormaps, video settings, and others have this property as well.
> There are a couple of ioctls which are recently used for splash screen
> support (SSPLASH and SPROGRESS). Apart from these, I *think* all the
> values have "escaped" into the field, and cannot easily be reclaimed
> without breaking some applications. (Though I think the number of
> applications in the field which actually use wsdisplay ioctls is
> probably quite small.)
> The mouse range has not used most of their numbers; neither has the
> keyboard. The range of numbers 128-255 also looks unused in wsconsio.
> So where should I add new ioctl numbers? In the upper empty range?=20
> Should I reclaim some old ioctl numbers, or reallocation them from empty
> kbd and mouse space? Should I move the splash stuff into its own
> *small* range?
I'd say either use some of the empty range, or give the display its own=20
other letter. The letters are a convenience to let us factor differet=20
things out. You can, however, overlap. The only requirement is that the=20
different layers your driver is mixed in with need not duplicate. i.e. if=
you're a serial port, you're also a tty. So don't use anything the tty=20
layer uses. Likewise your display is a tty, so don't use 't'. :-)
'w' only seems to be used by the watchdog system. So it'd be fair game I=20
Another option would be to use the fact that the "letters" really are=20
8-bit, and use 0x80 + 'W'. :-)
> And can I use the alternate numbers for IOR/IOW to change the values?=20
> (E.g. if I want to add a WSDISPLAY_SINFO to set the resolution or color
> depth, can I use the same numeric value as WSDISPLAY_GINFO, using IOW
> instead of IOR?)
I'd rather you not, but I realize that the space issues are real, so I=20
won't object if you decide to do this. However please only do it for NEW=20
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)
-----END PGP SIGNATURE-----