Subject: Allocating device major numbers
To: 'BSD Kernel' <tech-kern@netbsd.org>
From: Ferrari, Stephen <smf@pirus.com>
List: tech-kern
Date: 11/14/2000 15:30:49
I've written a pseudo-device driver for NetBSD and I'm at the point where I
need to provide user hooks to an IOCTL, meaning that I need a device major
number. Currently I only plan the driver to be for my own use, so I could
just choose an arbitrary number which is unused for the architectures (i386
and MacPPC) and NetBSD release (1.4.2) that I plan to support; 29 seems to
fill the bill. But before I do this, a couple of questions:
* Is there much benefit to using a consistent number across
architectures, like my 29 above? I believe it's mostly for convenience,
e.g. 4 is typically (but not always) the major number in a mknod for a scsi
disk, and I would think that applications and other kernel code shouldn't
make assumptions about major numbers, but I'm not sure.
* Thinking ahead to the possibility that I might someday want to make
the driver available to the world or move to a future release of NetBSD, is
there some better method for choosing a major number to avoid conflicts with
other drivers? Or is this a needless concern, since new devices must be
added individually to the various architectures' conf.c's, and when it's
time to merge my changes for any reason, I have to examine things manually?
Thanks,
Stephen