Subject: 32 bit dev_t, Revision 3
To: None <tech-kern@NetBSD.ORG>
From: Todd Vierling <tv@NetBSD.ORG>
List: tech-kern
Date: 01/11/1998 20:32:45
Skip the diffs.  I have some thinking to do on some of the kernel source
first, but hopefully I can have something decent looking tomorrow anyway.

Here's another shot.


1. Our new dev_t will be split 12 bits major, 20 bits minor.  If the top 12
bits are zeroes, the dev_t is an "old" device when considering conversion in
the kernel.

2. The new major devcice numbers will be specific to a particular
architecture, but all machines in a particular ${MACHINE_ARCH} will use the
same device switch tables.  The major numbers will start at 1, to reserve 0
for an old dev_t flag.

3. Character and block device major numbers for a given device must match.
If a character device or a block device does not have a corresponding
counterpart, the counterpart will be unconfigured.  After transitioning the
character/block device API to distinguish character and block devices in
the function call arguments, the device switches will be merged.

4. When COMPAT_[09-13] is defined in the kernel, the macros major() and
minor() will include inlined support for an old-to-new device number
conversion table (one for block, and one for character).  Major numbers will
be converted by integers in the table, and minor numbers by functions
pointed to by the table. 

5. The old (pre-1.3 and some COMPAT_<os>) stat interfaces, if included by a
COMPAT_[09-13] option, will do direct searchs of the old-to-new table above
to demote new dev_t's to 16 bit dev_t's.  This can cause no-matches, which
should be listed as major number 255.  Programs _needing_ use of the major
and minor numbers of a dev_t should conceivably be recompiled, but this
gives _some_ useful values in the case where compatibility is required, such
as finding a process's tty device based on device number.  Compat routines
for other OS's may also require this inverse mapping, or may use a
"truncated" major device number. 

9. In the kernel, any direct equality comparisons of dev_t's will be changed
to use a new macro, devcmp(), which does the logic of:
    ((major(x) == major(y)) && (minor(x) == minor(y)))
when any of COMPAT_[09-13] are defined.  Without a compat option, it will
collapse to a binary compare.  This compare will include the old-to-new
remapping automatically, and is needed for cases like "mount -u /".

10. Device numbers stored in structures such as vattr in the kernel will not
change, that is, they can be either "old" or "new".

11. mknod(8) will be introduced to new command line options:
- to create nodes with a set number of major and minor bits
- to create nodes with a given 32 bit number

===== Todd Vierling (Personal =====
== "There's a myth that there is a scarcity of justice to go around, so
== that if we extend justice to 'those people,' it will somehow erode the
== quality of justice everyone else receives."  -- Maria Price