All of lore.kernel.org
 help / color / mirror / Atom feed
From: erkrishna@gmail.com (er krishna)
To: kernelnewbies@lists.kernelnewbies.org
Subject: interview question how does application connects to device
Date: Tue, 5 Jul 2011 13:42:53 +0530	[thread overview]
Message-ID: <CAMGjyMvRY+ipaFeysAnP1+-v81iQOvDnTzc4-7PYhkSXxidMLA@mail.gmail.com> (raw)
In-Reply-To: <CAJQzqVzVbiZMN4pQqjo+011OzpnchYUALubUjH=mRt6czNZrUw@mail.gmail.com>

On Tue, Jul 5, 2011 at 1:21 PM, Abhijit Pawar <apawar.linux@gmail.com>wrote:

>
>
> On 5 July 2011 13:01, Mandeep Sandhu <mandeepsandhu.chd@gmail.com> wrote:
>
>> Oops, accidentally pressed send...
>>
>> On Tue, Jul 5, 2011 at 12:58 PM, Mandeep Sandhu
>> <mandeepsandhu.chd@gmail.com> wrote:
>> > On Tue, Jul 5, 2011 at 12:29 PM, Paraneetharan Chandrasekaran
>> > <paraneetharanc@gmail.com> wrote:
>> >> I think the thread originator is asking about how the application knows
>> >> which device file to read or write.
>> >> This is done by h/w management system udev. udev creates/manages device
>> >> nodes in /dev/ dir and notifes applications based on the udev rules
>> written
>> >> (via HAL events or DBUS signals).
>> >
>> > I don't think udev is involved in the read/write file ops. Udev is
>> > responsible for handling hotplug events, doing certain actions based
>> > on events (as indicated by udev rules),persistent naming of devices
>> > etc...but not file i/o.
>> >
>> > That, I think, is handled by the VFS layer. Each device node is
>> > uniquely identified by it's MAJOR-MINOR number combo. I guess the VFS
>> > layer uses this to pick the correct file-ops struct to communicate
>> > with the device.
>>
>> >Eg; when we try to open a device, say /dev/ttyS0, it's major-minor
>> >numbers (eg: 64-4 on my machine) are used to lookup the file-ops
>> >struct and from then on, the VFS passes the read/write calls to this
>> >device driver.
>>
>
> 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.
> The device driver / kernel module at registration time mention what major
> and minor it would be servicing.
>
> This is what I think it should work. Good to get confirmation though.
>

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


>
> Regards,
> Abhijit
>
>>
>> HTH,
>> -mandeep
>> >
>> > My info is a little dated, so plz CMIIW.
>> >
>> > HTH,
>> > -mandeep
>> >
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110705/3c26c3a7/attachment.html 

  reply	other threads:[~2011-07-05  8:12 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAOQuo6Nf9-uXBbHOi1_tpBmBOVPzuBtW699=ywDGSsfT_NVphA@mail.gmail.com>
2011-07-05  4:15 ` interview question how does application connects to device Bond
2011-07-05  5:43   ` Prashant Shah
2011-07-17 15:10     ` Bond
2011-07-17 15:34       ` Anuz Pratap Singh Tomar
2011-07-17 15:40         ` Bond
2011-07-17 15:47           ` Anuz Pratap Singh Tomar
2011-07-17 15:52             ` Bond
2011-07-17 16:06               ` Mulyadi Santosa
2011-07-17 17:34                 ` Bond
2011-07-17 17:49                   ` Anuz Pratap Singh Tomar
2011-07-17 19:25                   ` Greg Freemyer
2011-07-17 16:14               ` Anuz Pratap Singh Tomar
2011-07-17 17:31                 ` Bond
2011-07-05  6:51   ` Philipp Ittershagen
2011-07-05  6:59     ` Paraneetharan Chandrasekaran
2011-07-05  7:28       ` Mandeep Sandhu
2011-07-05  7:31         ` Mandeep Sandhu
2011-07-05  7:51           ` Abhijit Pawar
2011-07-05  8:12             ` er krishna [this message]
2011-07-05  9:13               ` Mandeep Sandhu
2011-07-05  9:38                 ` er krishna
2011-07-05 12:56   ` Greg Freemyer
2011-07-05 13:43     ` Mandeep Sandhu
2011-07-05 16:03       ` Greg Freemyer
2011-07-06  4:08         ` Abhijit Pawar
2011-07-06  4:43           ` Prashant Shah
2011-07-06  5:27             ` Abhijit Pawar
2011-07-11 17:43         ` StephanT
2011-07-11 18:13           ` Greg KH
2011-07-11 18:14           ` Greg Freemyer
     [not found]       ` <769A0B32-0869-4A2B-A005-D6AC0376D1E3@gmail.com>
2011-07-06  5:12         ` Mandeep Sandhu
2011-07-06 23:29           ` Javier Martinez Canillas
2011-07-07  3:20             ` Greg Freemyer
2011-07-07 12:51               ` Javier Martinez Canillas
2011-07-05 13:36   ` Shaz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMGjyMvRY+ipaFeysAnP1+-v81iQOvDnTzc4-7PYhkSXxidMLA@mail.gmail.com \
    --to=erkrishna@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.