Re: what is the precise udev event that handles miscdevices?

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

 



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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux