<br><br><div class="gmail_quote">On Tue, Jul 5, 2011 at 1:21 PM, Abhijit Pawar <span dir="ltr"><<a href="mailto:apawar.linux@gmail.com">apawar.linux@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br><br><div class="gmail_quote"><div class="im">On 5 July 2011 13:01, Mandeep Sandhu <span dir="ltr"><<a href="mailto:mandeepsandhu.chd@gmail.com" target="_blank">mandeepsandhu.chd@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Oops, accidentally pressed send...<br>
<div><br>
On Tue, Jul 5, 2011 at 12:58 PM, Mandeep Sandhu<br>
<<a href="mailto:mandeepsandhu.chd@gmail.com" target="_blank">mandeepsandhu.chd@gmail.com</a>> wrote:<br>
> On Tue, Jul 5, 2011 at 12:29 PM, Paraneetharan Chandrasekaran<br>
> <<a href="mailto:paraneetharanc@gmail.com" target="_blank">paraneetharanc@gmail.com</a>> wrote:<br>
>> I think the thread originator is asking about how the application knows<br>
>> which device file to read or write.<br>
>> This is done by h/w management system udev. udev creates/manages device<br>
>> nodes in /dev/ dir and notifes applications based on the udev rules written<br>
>> (via HAL events or DBUS signals).<br>
><br>
> I don't think udev is involved in the read/write file ops. Udev is<br>
> responsible for handling hotplug events, doing certain actions based<br>
> on events (as indicated by udev rules),persistent naming of devices<br>
> etc...but not file i/o.<br>
><br>
> That, I think, is handled by the VFS layer. Each device node is<br>
> uniquely identified by it's MAJOR-MINOR number combo. I guess the VFS<br>
> layer uses this to pick the correct file-ops struct to communicate<br>
> with the device.<br>
<br>
</div>>Eg; when we try to open a device, say /dev/ttyS0, it's major-minor<br>
>numbers (eg: 64-4 on my machine) are used to lookup the file-ops<br>
>struct and from then on, the VFS passes the read/write calls to this<br>
>device driver.<br></blockquote></div><div><br>Yes. whenever we read or write to the device, the file operations structure would be invoked for the device. And this device is identified by the Major and Minor number combination.<br>
The device driver / kernel module at registration time mention what major and minor it would be servicing.<br><br>This is what I think it should work. Good to get confirmation though.<br></div></div></blockquote><div><br>
Udev creates the device node and loads the corresponding driver based on the major/minor no. So after this step udev is out of the picture and control goes on
particular device node and then file-operation will come into picture for read and write. It will try to read the data from cache (buffer cache) and if not avilable there then from disk...<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="gmail_quote"><div><br>Regards,<br><font color="#888888">Abhijit <br></font></div><div class="im">
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
HTH,<br>
<font color="#888888">-mandeep<br>
</font><div><div></div><div>><br>
> My info is a little dated, so plz CMIIW.<br>
><br>
> HTH,<br>
> -mandeep<br>
><br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</div></div></blockquote></div></div><br>
<br>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></blockquote></div><br>