Subject: Re: Adding video mode info to struct wsscreen_descr
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 07/11/2002 08:48:54
>>> struct wsdisplay_softc {
>>> struct device sc_dv; /* <- HERE! */
>> There are some who consider that a bug, too...
(Like me - I'd love to see that botch die.)
> Why is is a bug?
Well, strictly, it's not truly a bug. But I think it's an interface
botch - a design bug, if you will. If nothing else, it means breaking
LKM binary compatability every time struct device grows, even if the
LKMs don't care about the new elements.
> In FreeBSD there is no such structure nesting and as a result you
> have to do ugly things to do simple things like get a device's name
> etc. What would be better?
What would be better? Try this: struct device has a void * pointer to
the softc; the softc begins with not a struct device but with a struct
device *. Instead of the pointer cast you do now (under NetBSD), you
do a member dereference and pointer follow.
It means that some operations involve one more memory reference. In my
opinion, the cleaner code is worth it, even if it does mean a flag day
for all drivers - and if you really can't afford that memory reference,
just do it once and cache the pointer.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse@rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B