Subject: Re: Accessing driver from within kernel
To: Dave McConnell <firstname.lastname@example.org>
From: Martin Husemann <email@example.com>
Date: 05/07/1999 20:50:47
> More specifically, I want a network pseudo driver to be able to
> access a driver for a custom ISDN card. I also want the custom
> ISDN card to be accessible from use space.
Look at the way ISDN4BSD does it, it handles multiple (different) ISDN cards
and a few different pseudo devices accessing any of that cards.
It's two pointers to records of function pointers: one for functions
the ISDN card driver implements, one for functions the pseudo device
Example: when a packet arrives on a pseudo interface, this sends a dial
request message to userland. The userland daemon checks policies, selects
an ISDN card to use for the call and does an ioctl() to connect the pseudo
device and the hardware driver and allocate kernel state info for that
connection. It gets back a handle identifying that state info. All further
request from userland to kernel are done via that connection handle. Never
ever is a concrete ISDN card driver accessed by the userland daemon. So I end
up having three ISDN cards in one machine, but only needing one /dev/i4b.
There is userland access not to ISDN cards, but to B-channels, i.e. when
doing userland PPP (which I4B doesn't do right now). That is another pseudo
device driver, which gets connected to the hardware driver just like the
in-kernel PPP driver or the IP-over-HDLC driver.