Device minor number uniqueness

Ed Schouten ed at fxq.nl
Sun Feb 17 13:44:35 PST 2008


* Poul-Henning Kamp <phk at phk.freebsd.dk> wrote:
> In message <20080217212457.GX1340 at hoeg.nl>, Ed Schouten writes:
> 
> >After digging into some more source code, it turns out a lot of drivers
> >use minor number to store device numbers and such, but there is no real
> >reason why we should enforce drivers to use unique minor numbers.
> 
> the major & minor together combine to the userland concept of a
> "dev_t" which conforms to POSIX.
> 
> While I don't think POSIX demands that dev_t has to be unique per
> device, the amount of software that assumes them to be is not to
> be sneezed at.
> 
> If you just need a minor number to fill out the field, use the
> unit number allocation functions.

It seems this minor number is completely unrelated to the numbers that
are displayed through stat(2)'s st_rdev field. I just created about 400
device nodes without specifying a minor number and all nodes had a
unique number.

According to sysctl_devname() and devfs_getattr(), st_rdev is just based
on the inode number of the device.

-- 
 Ed Schouten <ed at fxq.nl>
 WWW: http://g-rave.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20080217/49b1840c/attachment.pgp


More information about the freebsd-arch mailing list