public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* MMC block major dev
@ 2004-08-31 19:13 Pierre Ossman
  2004-08-31 19:15 ` Russell King
  2004-09-01 12:18 ` Alan Cox
  0 siblings, 2 replies; 7+ messages in thread
From: Pierre Ossman @ 2004-08-31 19:13 UTC (permalink / raw)
  To: Russell King, linux-kernel

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: MMC block major dev
  2004-08-31 19:13 MMC block major dev Pierre Ossman
@ 2004-08-31 19:15 ` Russell King
  2004-08-31 19:47   ` Pierre Ossman
  2004-09-01 12:18 ` Alan Cox
  1 sibling, 1 reply; 7+ messages in thread
From: Russell King @ 2004-08-31 19:15 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: linux-kernel

On Tue, Aug 31, 2004 at 09:13:52PM +0200, Pierre Ossman wrote:
> 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.

-- 
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 core

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: MMC block major dev
  2004-08-31 19:15 ` Russell King
@ 2004-08-31 19:47   ` Pierre Ossman
  2004-09-01 12:16     ` Alan Cox
  0 siblings, 1 reply; 7+ messages in thread
From: Pierre Ossman @ 2004-08-31 19:47 UTC (permalink / raw)
  To: Russell King, linux-kernel

Russell King wrote:

>On Tue, Aug 31, 2004 at 09:13:52PM +0200, Pierre Ossman wrote:
>  
>
>>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.
>
>  
>
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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: MMC block major dev
  2004-08-31 19:47   ` Pierre Ossman
@ 2004-09-01 12:16     ` Alan Cox
  2004-09-01 21:55       ` Russell King
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Cox @ 2004-09-01 12:16 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: Russell King, Linux Kernel Mailing List

On Maw, 2004-08-31 at 20:47, Pierre Ossman wrote:
> >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.

> 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 device@lanana.org, and Torben
will either disagree with you or assign name and possibly numbers.

Alan


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: MMC block major dev
  2004-08-31 19:13 MMC block major dev Pierre Ossman
  2004-08-31 19:15 ` Russell King
@ 2004-09-01 12:18 ` Alan Cox
  1 sibling, 0 replies; 7+ messages in thread
From: Alan Cox @ 2004-09-01 12:18 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: Russell King, Linux Kernel Mailing List

On Maw, 2004-08-31 at 20:13, Pierre Ossman wrote:
> 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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: MMC block major dev
  2004-09-01 21:55       ` Russell King
@ 2004-09-01 21:28         ` Alan Cox
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Cox @ 2004-09-01 21:28 UTC (permalink / raw)
  To: Russell King; +Cc: Pierre Ossman, Linux Kernel Mailing List

On Mer, 2004-09-01 at 22:55, Russell King wrote:
> 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.

> >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. 

> 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.

> 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.

> 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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: MMC block major dev
  2004-09-01 12:16     ` Alan Cox
@ 2004-09-01 21:55       ` Russell King
  2004-09-01 21:28         ` Alan Cox
  0 siblings, 1 reply; 7+ messages in thread
From: Russell King @ 2004-09-01 21:55 UTC (permalink / raw)
  To: Alan Cox; +Cc: Pierre Ossman, Linux Kernel Mailing List

On Wed, Sep 01, 2004 at 01:16:30PM +0100, Alan Cox wrote:
> On Maw, 2004-08-31 at 20:47, Pierre Ossman wrote:
> > >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?

>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.

-- 
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 core

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-09-01 22:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-31 19:13 MMC block major dev Pierre Ossman
2004-08-31 19:15 ` Russell King
2004-08-31 19:47   ` Pierre Ossman
2004-09-01 12:16     ` Alan Cox
2004-09-01 21:55       ` Russell King
2004-09-01 21:28         ` Alan Cox
2004-09-01 12:18 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox