Subject: Re: switch table changes
To: Charles M. Hannum <>
From: None <>
List: tech-kern
Date: 12/14/1994 19:12:52
I suggest some more changes to the device switch tables:

1. Add a field for the name of the device driver.  Currently, there
are some places in the kernel, where tables with device names are used
for block devices.  The device name should be added to both block and
character devices, in case they are needed somewhere.

2. The switch table entries for a device driver should be included in
the device driver.  The [cb]devsw tables should only contain pointers
to these entries.  This way, all information about the driver, like
the names of function (fdopen/Fdopen), is contained in the driver
itself.  The 'fd' driver would define 'fd_bdevsw' and 'fd_cdevsw', and
the device switch tables in config.c only references these entries and
not all the functions in the driver.  It would also be possible to
make all the driver functions static, to prevent possible name

This would be similar to other configuration tables, like the table of
VFS filesystem types or VM pagers, where only pointers to structures
are used.

This also makes it easier to use loadable device drivers.  Since the
driver contains the complete entry, only a pointer to this entry must
be added to the switch table.

3. Currently, a fixed table is used to map block device numbers to
character device numbers.  It would be possible to include pointers in
the {b,c}devsw entry to point to the other type of entry.  In entries
for character devices, this pointer would be NULL.

Ralf Friedl