Date: Sun, 17 Feb 2008 22:44:33 +0100 From: Ed Schouten <ed@fxq.nl> To: Poul-Henning Kamp <phk@phk.freebsd.dk> Cc: freebsd-arch@freebsd.org Subject: Re: Device minor number uniqueness Message-ID: <20080217214433.GY1340@hoeg.nl> In-Reply-To: <24779.1203284021@critter.freebsd.dk> References: <20080217212457.GX1340@hoeg.nl> <24779.1203284021@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] * Poul-Henning Kamp <phk@phk.freebsd.dk> wrote: > In message <20080217212457.GX1340@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@fxq.nl> WWW: http://g-rave.nl/ [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (FreeBSD) iEYEARECAAYFAke4qsEACgkQ52SDGA2eCwUgRgCfbdqW+LoyolgW1YbMzqvzVv/c PYkAoIBqkTfY8DYpZG2fk2LnM2ldB/6V =f2m+ -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080217214433.GY1340>
