From: "Kay Sievers" <kay.sievers@vrfy.org>
To: linux-kernel@vger.kernel.org
Subject: Re: Creating dev nodes from driver or via uevent?
Date: Wed, 15 Oct 2008 10:45:10 +0200 [thread overview]
Message-ID: <ac3eb2510810150145q4ee66c17xde59d966053d6e7f@mail.gmail.com> (raw)
In-Reply-To: <20081015063917.GA18487@true>
On Wed, Oct 15, 2008 at 8:39 AM, Fabiano Sidler <lists@fipscode.ch> wrote:
> Probably a very basic question, but is it better to directly mknod from a
> module's init funtion or to use the uevent/udev mechanism?
You better do not touch any userspace managed filesystem from inside
the kernel. No driver is doing that.
> If the latter,
> are there good overviews, explanations and comprehensive code samples
> especially for using udev, as well as how to package the userspace program
> creating the nodes along with a driver?
You do not package anything along with the driver, unless you have
_very_ special requirements for userspace device setup. Then you could
ship a udev rules file.
There is nothing special to do, just run udev, and register a "struct
device" inside the kernel's driver core, and you will see a device
node in /dev/ with the name of your kernel device, and the major/minor
you assigned to the struct device before registration.
Almost every Linux distro, and every driver in the kernel works that
way. I suggest looking at the current kernel code and running a Linux
distro and loading/unloading an existing module, to see it working.
You can also run "/sbin/udevadm monitor --env --kernel" to see the
"raw" kernel events "struct device" registration causes, and which
lets userspace create the device nodes.
Kay
prev parent reply other threads:[~2008-10-15 8:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-15 6:39 Fabiano Sidler
2008-10-15 7:23 ` Jike Song
2008-10-15 8:45 ` Kay Sievers [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=ac3eb2510810150145q4ee66c17xde59d966053d6e7f@mail.gmail.com \
--to=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®