Re: driver core: Do uevents have a semantic problem ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I guess this is still me not understanding the Linux Device Model.

> > I guess udev needs both types of events:
> > 
> > 1) physical device was detected
> > 2) device driver was bound  
> 
> 
> It needs more than just that:
> 	3) when a "struct device" is created within the kernel
> 
> Actually, udev doesn't need any of this as it doesn't do a ton of stuff
> anymore now that devtmpfs is the primary handler for all device nodes.
> not to say that udev doesn't still do a lot, but don't think of udev as
> the thing that manages the creation of /dev nodes, as it hasn't done
> that for a very long time now.

I didn't know the right terminology, after reading up on it,
("Linux Device Drivers, 3rd edition")
here is hopefully a better try.


I guess udev needs both types of events:

1) "struct device" was allocated
2) "struct device_driver" was bound to "struct device"
   (I think "matched" and then bound in kernel terminology ?)

Let me be concrete:
As far as I can tell udev handles file permissions and group ownership
for a lot of "/dev/*" nodes (and it creates appropriate symlinks).

My question is:
Should "udev" set file permissions and group ownership on
1) or 2) or both ?
(It also seems 2) very often is not communicated via a uevent,
so a "bind" event is not emitted.)

My thinking was it should only do that on 2).
Rationale:
My understanding is, that all the file operations for a /dev/* node
are implemented in code which implements a "struct device_driver".
Am I just wrong here and the file operations are actually done 
per "struct device" and not per "struct device_driver" or per both ?

So before I have bound a "struct device_driver" to a "struct device" 
it doesn't even make sense to try to do anything with a /dev/* node; 
or is this a mis-understanding ?

I guess you might set file permission, group ownership and create a 
symlink  once the /dev/* node exists 
(I don't know if this happens at 1) or 2)).

But my assumption is you might only run actions 
(like opening the /dev/* node and doing some ioctl) once a 
"struct device_driver" is bound to "struct device".

Probably I simply don't get it:
Maybe both "struct device" and "struct device_driver" might expose 
/dev/* node entries, with accompanying "struct file_operations" ?

with best regards
  Ingo



[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux