Subject: dev_t again
To: None <tech-kern@NetBSD.ORG>
From: Charles M. Hannum <mycroft@mit.edu>
List: tech-kern
Date: 01/17/1998 09:59:36
For the sake of completeness, I propose two different ways of handling
device renumbering:

* Use a `translation table' consisting of one entry for each major
  number, containing:

  * a pointer to a function which translates the minor number, if any,
    and
  * the new major number.

  This leaves the normal path into the device drivers completely
  unchanged.

* Use a `translation table' consisting of one entry for each major
  number, containing:

  * a pointer to a function which takes a minor number and a version
    number indicating the minor number format, and returns an opaque
    cookie, and
  * the version number.

  This has the potential advantage that it allows the device driver to
  optimize future calls into itself, by rearranging the minor number,
  or whatever.  Some drivers might elect to simply use a softc for the
  opaque cookie (although this obviously wouldn't work for anything
  that uses `subunits').

  This might also make it somewhat easier to add alternate
  translations; e.g. so that emulated executables can use device nodes
  in the native format for the emulated OS.  (It would be kind of nice
  to be able to boot a NetBSD kernel with a file system from another
  OS...)

  A potential con is that this might encourage someone to implement
  something really disgusting.


Anyway, I don't feel strongly about either of these, but I thought I
should mention both possibilities.