Subject: Re: Time to fix a 25 year old misdesign
To: NetBSD Kernel Technical Discussion List <tech-kern@NetBSD.ORG>
From: Greg A. Woods <woods@weird.com>
List: tech-kern
Date: 10/16/2000 14:50:05
[ On Sunday, October 15, 2000 at 20:17:21 (+0200), Lennart Augustsson wrote: ]
> Subject: Re: Time to fix a 25 year old misdesign
>
> There is a certain elegance in the current design, but it also stops you
> from doing things that you'd like to do.
> I still think a design with a symmetry between "generate a driver reference"
> and "drop a driver reference" would be more elegant.
> Symmetry is beauty. :)

I'm still rather at a loss in trying to think of things that the driver
might need to do on individual close(2) calls that can't be done better
in the upper layers (modulo SIGIO which has its own logical restrictions
noted in my most recent posting -- remember SIGIO is a recent addon hack
to drivers too!).

Do you think my idea of separating init()/uninit() from open()/close()
would be the better way to provide such symmetry?  If so do you think
it's really worthwhile to go to the lengths that would be necessary to
re-design the driver API in this way though?

The fact that the driver open() routine is called for every open(2) is
more of where the hack is -- it's really just a way to enforce rare
features like exclusive access (when it's required by the hardware), and
other low-level restrictions (eg. requiring superuser access, etc.).

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>