Info on major/minor device mappings for device drivers

2006-02-23 Thread Andrew Smith
I know you are going to tell me to rtfm, it's bound to be in there but I
can't find anything relevant here so assume I'm stupid and please point me
at something obvious :P

I have just become acquainted with the differences between FreeBSD and
OpenBSD by porting over the ubtbcmfw driver which seems to build into my
Kernel quite happily and I can plug in the Blutonium based USB dongle and my
driver recognises it. great!..

However, programming device drivers on OpenBSD isn't quite like I was
expecting.. I have modified a few up to now but not brought a new one into
the tree before.

FreeBSD has a make_dev call to actually make the device nodes for the
driver. OpenBSD has makedev which I think does something similar, however,
the majority of the drivers that I have examined don't use it. They don't
actually seem to have anything within the driver itself that identifies with
me as a registration of major and minor device numbers that I can correlate
with a simple mknod command so I'm assuming that there is an element of
automatic assignment on the part of the device numbers (or maybe I missed
some macro that does something for you.. I don't know).

Looking at the counterpart driver for this device (ubt) I can't see any
reference to major, minor device numbers so I picked something more obvious.
the wd driver and I can't figure out how this maps to major number 16 at
all. (it's been a long day working from home and the smallest baby has been
screaming all day too :().

Can someone give me a hint or point me at a relevant man page about how
device numbers are managed in the Kernel source tree this would save me a
lot of head scratching... even at the risk of having to slap myself on the
forehead and shout DOH!.

-Andy



Re: Info on major/minor device mappings for device drivers

2006-02-23 Thread Ted Unangst
On 2/23/06, Andrew Smith [EMAIL PROTECTED] wrote:
 Looking at the counterpart driver for this device (ubt) I can't see any
 reference to major, minor device numbers so I picked something more obvious.
 the wd driver and I can't figure out how this maps to major number 16 at
 all. (it's been a long day working from home and the smallest baby has been
 screaming all day too :().

 Can someone give me a hint or point me at a relevant man page about how
 device numbers are managed in the Kernel source tree this would save me a
 lot of head scratching... even at the risk of having to slap myself on the
 forehead and shout DOH!.

see arch/arch/conf.c