On Wed, Feb 01, 2023 at 08:27:57 -0500, Brad Spencer wrote: > To add a bit... generally I have just added an entry to one of the > "major" files in sys/conf. However, I have noticed that in order for > the module to be able to use it, after the major file edit, I had to > rebuild the kernel as well. I have never been 100% sure that was proper > behavior, but it seems to be the case. That is, just editing the major > file and building or rebuilding the module has not been enough.
.Xr devsw_attach 9 Major numbers (mapping "foo" -> 42, so that a program that opens a node with major 42 gets to the device "foo") are a property of the kernel config, so yes, you need to rebuild the kernel when you introduce a new fixed major number. When the module is loaded, the driver tells the kernel, "I'm `foo'". It can also tell the kernel either "I'm ok with whatever major number you give me", or it can tell "I want a specific major number N". It's an error to request a specific major N that is already taken (either fixed in a major config file, or dynamically allocated to another driver). -uwe