MMC block major dev
It seems that the MMC block layer hasn't been assigned a major number. The code registers the block dev with a uninitialized variable. It then proceeds to create a mmc dir under devfs. Since I'm not using devfs this then poses a problem.
Some debug statements revealed that the driver ended up on major number 254. I'm not familiar with how kernel memory is initialized but using an uninitialized variable should result in random numbers. It seems to get 254 each time though. Can I count on this? (i.e. can I safely create device node files with this major).
Rgds
Pierre Ossman
Quoted 4 lines · Pierre Ossman
It seems that the MMC block layer hasn't been assigned a major number. The code registers the block dev with a uninitialized variable. It then proceeds to create a mmc dir under devfs. Since I'm not using devfs this then poses a problem.
First, "uninitialised variables" is a misdescription here. Variables declared outside the scope of functions are _always_ initialised even though there is no apparant assignment.
They're placed in the BSS, or "zero initialised" section. They have a well defined value. Zero.
Registering with the block layer with a major number of zero means "find me a free major number and assign that to me." This is nothing new. If devfs can't cope with that, devfs is buggy. Use udev instead.
Signature · 4 lines
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial coreQuoted 11 lines · Russell King
Quoted 3 lines · Pierre Ossman
It seems that the MMC block layer hasn't been assigned a major number. The code registers the block dev with a uninitialized variable. It then proceeds to create a mmc dir under devfs. Since I'm not using devfs this then poses a problem.
First, "uninitialised variables" is a misdescription here. Variables declared outside the scope of functions are _always_ initialised even though there is no apparant assignment.
Quoted 9 lines
They're placed in the BSS, or "zero initialised" section. They have a well defined value. Zero.
Registering with the block layer with a major number of zero means "find me a free major number and assign that to me." This is nothing new. If devfs can't cope with that, devfs is buggy. Use udev instead.
Ok. Please excuse my ignorance =)
My point was that I do not use a dynamic system for /dev so it would be nice to have a static major number. Since MMC now is a part of Linus' kernel maybe it's time for a permanent allocation?
Rgds
Pierre
Quoted 3 lines · Pierre Ossman
Quoted 3 lines
Registering with the block layer with a major number of zero means "find me a free major number and assign that to me." This is nothing new. If devfs can't cope with that, devfs is buggy. Use udev instead.
Registering with an ID of 0 is bad because you've no idea what existing device node you may reallocate and thus what permissions may be present for access unless you sweep all of storage.
Quoted 4 lines
Ok. Please excuse my ignorance =)
My point was that I do not use a dynamic system for /dev so it would be nice to have a static major number. Since MMC now is a part of Linus' kernel maybe it's time for a permanent allocation?
Agreed. It also needs reigstering with LANANA to avoid /dev namespace collisions irrespective of the device numbering and to ensure the namespace is common across all vendors regardless of their dev management tools. Without LANANA we'll get
#if UDEV_REDHAT
#elif UDEV_SUSE
#elif DEVFS_SUSE
#elif GENTOO
#endif
type stuff in programs .. 8(
Send the proposed /dev naming for the device and details in the same format as Documentation/devices.txt to [email protected], and Torben will either disagree with you or assign name and possibly numbers.
Alan
Quoted 5 lines · Pierre Ossman
Some debug statements revealed that the driver ended up on major number
254. I'm not familiar with how kernel memory is initialized but using an uninitialized variable should result in random numbers. It seems to get 254 each time though. Can I count on this? (i.e. can I safely create device node files with this major).
No.
Quoted 8 lines · Alan Cox
Quoted 3 lines · Pierre Ossman
Quoted 3 lines
Registering with the block layer with a major number of zero means "find me a free major number and assign that to me." This is nothing new. If devfs can't cope with that, devfs is buggy. Use udev instead.
Registering with an ID of 0 is bad because you've no idea what existing device node you may reallocate and thus what permissions may be present for access unless you sweep all of storage.
Surely the same arguments also apply to character drivers as well?
Quoted 1 line
From what you're saying, any use of these dynamic majors what so
ever is buggy. So WTF do we have this facility in the kernel in the first place?
What about dynamically assigning physical serial ports to ttyS numbers? I suggest that your argument also applies there as well. Also to SCSI disks, where if you load SCSI driver modules in a differnet order your disks all move about. It's all the same problem.
I suggest that someone submits a patch to rip out this apparantly buggy and useless feature, or at least make the kernel print a warning when its used such that people are aware of its dangerous nature.
Of course, if you do rip out dynamic majors then you _will_ need to have an assigned major number for PCMCIA driver services, and probably a bunch of other stuff.
I also seem to remember hearing that we will only be using dynamically assigned device numbers in the new expanded device space.
Signature · 4 lines
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial coreQuoted 1 line · Russell King
Surely the same arguments also apply to character drivers as well?
Beats me but I had this argument before 1.0 was out and lost.
Quoted 3 lines
Quoted 1 line
From what you're saying, any use of these dynamic majors what so
ever is buggy. So WTF do we have this facility in the kernel in the first place?
It makes sense if you have something truely managing your device space like devfs or udev.
Quoted 4 lines
I suggest that someone submits a patch to rip out this apparantly buggy and useless feature, or at least make the kernel print a warning when its used such that people are aware of its dangerous nature.
Once everyone is using udev its useful. It also works out for devices you never "give" to a user. The problem with MMC slots is they are the kind of thing you want to hand out to a user on the console of a machine in many situations.
Quoted 3 lines
Of course, if you do rip out dynamic majors then you _will_ need to have an assigned major number for PCMCIA driver services, and probably a bunch of other stuff.
PCMCIA is very careful to create and remove its nodes and make sure they don't ever become non root only.
Quoted 2 lines
I also seem to remember hearing that we will only be using dynamically assigned device numbers in the new expanded device space.
If and when everyone has udev happy then yes - although LANANA is still needed for name assignment between vendors. That or we give it to the LSB, and personally I'd rather LANANA did it 8)
Alan