All of lore.kernel.org
 help / color / mirror / Atom feed
From: rpjday@crashcourse.ca (Robert P. J. Day)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Doubt in major and minor numbers
Date: Sun, 16 Nov 2014 06:20:21 -0500 (EST)	[thread overview]
Message-ID: <alpine.LFD.2.11.1411160616530.6027@localhost> (raw)
In-Reply-To: <CAHmg6GMjzbCEcL3GNEPQbtneiEtxPMC5AghxNhkVE5HhN-HsSg@mail.gmail.com>

On Sun, 16 Nov 2014, me storage wrote:

> Hi All,
>
> I am reading chapter 3 in LDD3 i checked same topics in LDD2 so i
> got some confusions.According to my understanding Major number is
> used by kernel to identify the driver i.e major number tells about
> driver . Minor number is used by the driver module to know about the
> device which is using this module i.e minor number related to device
> number can i any one please tell am i correct? if wrong please
> explain me a bit more

  for the most part, that is entirely correct -- the major number
identifies the driver (either block or char), and you can see the
current list of registered drivers with:

$ cat /proc/devices
Character devices:
  1 mem
  4 /dev/vc/0
  4 tty
  4 ttyS
  5 /dev/tty
  5 /dev/console
  5 /dev/ptmx
  7 vcs
 10 misc
 13 input
...
Character devices:
  1 mem
  4 /dev/vc/0
  4 tty
  4 ttyS
  5 /dev/tty
  5 /dev/console
  5 /dev/ptmx
  7 vcs
 10 misc
 13 input
...

and while the minor number *usually* then identifies a particular
instance of a device being controlled by that driver, it doesn't
*have* to. in fact, the driver is free to interpret the minor number
any way it wants but, as you suggest, it typically just refers to a
specific instance of a device.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

      reply	other threads:[~2014-11-16 11:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-16 11:09 Doubt in major and minor numbers me storage
2014-11-16 11:20 ` Robert P. J. Day [this message]

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=alpine.LFD.2.11.1411160616530.6027@localhost \
    --to=rpjday@crashcourse.ca \
    --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.