Subject: weighing the possibilities (dev_t)
To: None <tech-kern@NetBSD.ORG>
From: Todd Vierling <tv@NetBSD.ORG>
List: tech-kern
Date: 01/16/1998 08:28:35
Okay, people are saying I'm missing some points; people are saying Charles
is missing some points.  I'll weigh what I can see as advantages and
disadvantages of both procedures.  Please, if I've missed something here,
tell me and I will add it to the list and repost, but I'm not into the
mudslinging, so please send flame to /dev/null.

Contiguous bits for major and minor - Advantages:
- Cleaner coded, and becomes only a slight modification of the 16-bit system
  if compatibility drops out
- Can use a completely merged devsw as translation is done before use of
  a dev_t in the kernel
- It has overwhelming precedent

Disadvantages:
- Requires MAKEDEV and mknod(8) be updated at the same time, or that MAKEDEV
  be updated to use new mknod(8) flags before the change

Advantage or disadvantage, depending on the user:
- ls(1) displays old device nodes with a major number of zero, the
  reserved compatibility number
- Requires a separate kernel option to enable compatibility, so prompts
  users of -current to ask why a kernel doesn't boot (and receive the answer
  of updating mknod(8) and MAKEDEV, then adding appropriate kernel option)
- Forces us to renumber devices now and make the new numbers correspond
  between 
- A user who MAKEDEV's some 32 bit devices and falls back will be confused
  as to why functionality was lost; requires MAKEDEV to have a 16-bit option
  or default to such so devices get old node numbers

Neutral (usually "don't care"s):
- Makes the dev_t easier to read in a debugging dump of function arguments,
  or in a raw hexdump of a filesystem

Optional:
- MAKEDEV, when modified, could default to creating 16 bit nodes with the
  new mknod(8) (and the options of nmajorbits and nminorbits), allowing
  the 32 bit representations to change before 1.4 for new functionality

=====

Splitting minor into two parts - Advantages:
- Works on old or new MAKEDEV and mknod(8), even in different mixes

Disadvantages:
- Does not allow for a merged, renumbered device switch table; device
  numbers below the predefined N split of `old' and `new' are block/char
  dependent (as well as arch dependent)
- If compatibility left out, the remnants still exist (five operations for
  minor number to be stripped from a dev_t, and a table of N*2 null devices)

Advantage or disadvantage, depending on the user:
- ls(1) displays old and new device nodes in the same format
- The translation heuristic might be conditional on whether or not a device
  is renumbered, prompting an extra conditional translation layer
- A user who MAKEDEV's some 32 bit devices and falls back will be confused
  as to why functionality was lost; requires MAKEDEV to have a 16-bit option
  or default to such so devices get old node numbers

Neutral (usually "don't care"s):
- Difficult to decode a raw dev_t mentally or by hand

Optional:
- mknod(8) could be given the suggested nmajorbits and nminorbits, though
  these options are mutually exclusive with native 32-bit dev_t and are
  only usable when NFS-exporting to other OS's

=====
===== Todd Vierling (Personal tv@pobox.com) =====
== "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