mknod device numbers
Tom I Helbekkmo
tih at Hamartun.Priv.NO
Thu Nov 16 06:57:59 AEST 1995
On Wed, 15 Nov 1995, Milo Velimirovic 31 Wing 785-8030 wrote:
> All of this is very installation specific. The major/minor numbers in the
> device inodes need to correspond exactly to the entries in the devtab
> structure in the kernel.
True enough. The example I gave was correct for the V6 distribution
that Ken Wellsch donated to the PUPS archive, and in which the file
/usr/sys/conf/c.c (generated by 'mkconf' in the same directory) ends
up with the following for the default "rkunix" with rk, tm and tc
drivers enabled, as per the script /usr/sys/run:
int (*bdevsw[])()
{
&nulldev, &nulldev, &rkstrategy, &rktab, /* rk */
&nodev, &nodev, &nodev, 0, /* rp */
&nodev, &nodev, &nodev, 0, /* rf */
&tmopen, &tmclose, &tmstrategy, &tmtab, /* tm */
&nulldev, &tcclose, &tcstrategy, &tctab, /* tc */
&nodev, &nodev, &nodev, 0, /* hs */
&nodev, &nodev, &nodev, 0, /* hp */
&nodev, &nodev, &nodev, 0, /* ht */
0
};
int (*cdevsw[])()
{
&klopen, &klclose, &klread, &klwrite, &klsgtty, /* console */
&nodev, &nodev, &nodev, &nodev, &nodev, /* pc */
&nodev, &nodev, &nodev, &nodev, &nodev, /* lp */
&nodev, &nodev, &nodev, &nodev, &nodev, /* dc */
&nodev, &nodev, &nodev, &nodev, &nodev, /* dh */
&nodev, &nodev, &nodev, &nodev, &nodev, /* dp */
&nodev, &nodev, &nodev, &nodev, &nodev, /* dj */
&nodev, &nodev, &nodev, &nodev, &nodev, /* dn */
&nulldev, &nulldev, &mmread, &mmwrite, &nodev, /* mem */
&nulldev, &nulldev, &rkread, &rkwrite, &nodev, /* rk */
&nodev, &nodev, &nodev, &nodev, &nodev, /* rf */
&nodev, &nodev, &nodev, &nodev, &nodev, /* rp */
&tmopen, &tmclose, &tmread, &tmwrite, &nodev, /* tm */
&nodev, &nodev, &nodev, &nodev, &nodev, /* hs */
&nodev, &nodev, &nodev, &nodev, &nodev, /* hp */
&nodev, &nodev, &nodev, &nodev, &nodev, /* ht */
0
};
The major device numbers are the offsets (counting from 0) in these
arrays, so rk has major 0 for the block device, 9 for the character
device. I would assume that this holds for V6 in general -- if one
were to add device drivers, one would surely extend these arrays at
their ends, not insert anything into them... :-)
-tih
--
Tom Ivar Helbekkmo
tih at Hamartun.Priv.NO
More information about the TUHS
mailing list