Subject: Re: Time to fix a 25 year old misdesign
To: None <firstname.lastname@example.org>
From: Lennart Augustsson <email@example.com>
Date: 10/17/2000 05:42:30
Lennart Augustsson wrote:
> The old UNIX device driver interface is fundamentally broken. The
> problem is the following
> The driver routine open() is called every time the device
> is opened, but close() is only called on the last close.
In view of the discussion here, I have a modified proposal of a change
to the kernel driver API.
Add two new methods incref() and decref(). These methods are called
whenever the reference count of the device node changes. I.e., incref()
will be called on open()/dup()/fork() etc. and decref() will be called on
close()/exit() etc. These two methods will be passed the same arguments
as the open() method, and in addition also the current reference count.
These two methods are optional, if they are not there the driver will behave
exactly as before, if they are there they will be called.
* Don't call incref() on open() nor decref() on last close().
* Use one method, changeref(), that gets an extra argument that tells if what
the change is.