FreeBSD device file path

Hello guys,
In linux we can find major number of a device under /proc/devices but I am not sure where we can find the major number of a device file in FreeBSD. Please let me know.

Thank You
 
fluca1978 said:
Uhm...I suspect that due to devfs(4) there is no major number at all.
Maybe someone can provide more information.

Seems to me that even OpenBSD, while not using devfs, does not assign major number to block devices (while it does with character ones).
 
Are you refering to the c in for example ada0s1c? That 'c' is for 'complete', not character. It existed long before block devices where removed.

An old 4.0 man page for disklabel(8) says:
Code:
Disk device name
     All disklabel forms require a disk device name, which should always be
     the raw "complete" (or "c") partition, for example /dev/rda0c.  disklabel
     understands the abbreviation da0, which it converts internally to
     /dev/rda0c.
 
No, I was referring to the c in the ls(1) output.
This is an example from one of my FreeBSD box:

Code:
# ls -l /dev/ad0*
[B]c[/B]rw-r-----  1 root  operator    0,  64 Oct 30 08:09 /dev/ad0                              
[B]c[/B]rw-r-----  1 root  operator    0,  65 Oct 30 08:09 /dev/ad0s1                            
[B]c[/B]rw-r-----  1 root  operator    0,  66 Oct 30 08:09 /dev/ad0s1a                           
[B]c[/B]rw-r-----  1 root  operator    0,  67 Oct 30 08:09 /dev/ad0s1b
 
Ah, that c. Yes, you are correct, that's to indicate a character device.
 
I've checked The Book (i.e., the McKusick's book) and the major number is still there for retro-compatibility, but it is no more used in FreeBSD. So I guess this also means that there is no way at all to get a major number of any device.
 
If I remember correctly you can tell just by listing the files. Taking fluca1978's example:
Code:
# ls -l /dev/ad0*
crw-r-----  1 root  operator    [b]0,  64[/b] Oct 30 08:09 /dev/ad0                              
crw-r-----  1 root  operator    [b]0,  65[/b] Oct 30 08:09 /dev/ad0s1                            
crw-r-----  1 root  operator    [b]0,  66[/b] Oct 30 08:09 /dev/ad0s1a                           
crw-r-----  1 root  operator    [b]0,  67[/b] Oct 30 08:09 /dev/ad0s1b
The numbers in bold should be the major and minor numbers. But I don't think they're of any use.
 
SirDice said:
If I remember correctly you can tell just by listing the files. Taking fluca1978's example:
Code:
# ls -l /dev/ad0*
crw-r-----  1 root  operator    [b]0,  64[/b] Oct 30 08:09 /dev/ad0                              
crw-r-----  1 root  operator    [b]0,  65[/b] Oct 30 08:09 /dev/ad0s1                            
crw-r-----  1 root  operator    [b]0,  66[/b] Oct 30 08:09 /dev/ad0s1a                           
crw-r-----  1 root  operator    [b]0,  67[/b] Oct 30 08:09 /dev/ad0s1b
The numbers in bold should be the major and minor numbers. But I don't think they're of any use.

Correct, the 0 is the major and the other are minor ones. The driver is in charge of selecting the new minor (i.e., the instance number), while the major was used as an index into the driver table within the kernel.
 
As a final note, the make_dev(9) specifies that even the unit number is no more required (as far as I understand) since it is returned automatically from the system and there is no way to specify the major number.
 
Back
Top