All of lore.kernel.org
 help / color / mirror / Atom feed
From: rpjday@crashcourse.ca (Robert P. J. Day)
To: kernelnewbies@lists.kernelnewbies.org
Subject: what is the precise udev event that handles miscdevices?
Date: Wed, 1 Apr 2015 08:34:35 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.2.11.1504010830520.16003@localhost> (raw)
In-Reply-To: <CADVatmNBmzXyUvuyv2fnt-f4GnFsaKXazy_EtjZE4C1nOfZUAg@mail.gmail.com>

On Wed, 1 Apr 2015, Sudip Mukherjee wrote:

> >   don't get smug. :-) i had sort of concluded there was no actual
> > udev rule i could point at, so it's just the case that udev
> > processes those events internally? is this written down anywhere?
> > everyone happily explains how misc devices get their /dev file
> > automatically, but no one i've seen goes that extra step to
> > explain how that happens.
>
> misc_register() is ultimately calling device_add() which is again
> calling device_create_file() , and this one is actually creating the
> node in /dev . (if i am not wrong).

  close, and now i can come across as an expert since i checked the
source file. :-) from drivers/base/core.c, in device_add():

        if (MAJOR(dev->devt)) {
                error = device_create_file(dev, &dev_attr_dev);
                if (error)
                        goto DevAttrError;

                error = device_create_sys_dev_entry(dev);
                if (error)
                        goto SysEntryError;

                devtmpfs_create_node(dev);
        }

so device_add() creates device_create_file(), then calls
devtmpfs_create_node() which, based on whether you selected that
devtmpfs CONFIG option, either creates the /dev file or does nothing.
it's all clear to me now ...

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:[~2015-04-01 12:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01 11:43 what is the precise udev event that handles miscdevices? Robert P. J. Day
2015-04-01 11:55 ` Greg KH
2015-04-01 12:04   ` Robert P. J. Day
2015-04-01 12:19     ` Sudip Mukherjee
2015-04-01 12:34       ` Robert P. J. Day [this message]
2015-04-01 11:59 ` Greg KH
2015-04-01 12:18   ` Robert P. J. Day
2015-04-01 12:45     ` Greg KH

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