From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: udev: provide temporary device nodes for callouts
Date: Thu, 10 Feb 2005 11:19:51 +0000 [thread overview]
Message-ID: <20050210111951.GA6920@vrfy.org> (raw)
I've added some code to udev to solve the problem of accessing devices
from a callout while no device node is created at that time, cause
obviously the callout runs to return the name for the node to be created.
Some programs need to access the device to read labels or serial numbers
from, but can't know where to create a temporary node, cause udev_root
may be at an unknown location or /tmp is read-only.
%N - create a temporary node and substitute its name
It will be created in udev_root as .tmp-<major>-<minor>
The node is removed after the namedev call.
%p - substitute the DEVPATH of the device
For scsi_id to be called from the command line.
%P - substitute the name of the parent device
The node name of the parent device is queried from the udevdb.
This makes it easy to name partitions after the main device,
especially if the main device gets its name from a callout
or to get the disklabel of the main device to name a partition.
%r - substitute udev_root
Needed to pass the absolute name of the parent device node
to a callout
The following examples of disklabel reading apply with different commandline
parameters also to scsi_id, that reads the serial number from the main device.
Name partitions after disklabel of the parent:
SUBSYSTEM="block", KERNEL="*[1-9]", PROGRAM="/sbin/udev_volume_id -l %r/%P" NAME="%c-part%n"
Name main device after disklabel and let partitions follow the name of
the main device. udevd serializes the events, so that we can be sure,
that the node of the main device is created before the partition event
tries to access it:
SUBSYSTEM="block", KERNEL="*[a-z]", PROGRAM="/sbin/udev_volume_id -l %N, NAME="%c"
SUBSYSTEM="block", KERNEL="*[1-9]", NAME="%P-part%n"
Name partitions after filestem label:
SUBSYSTEM="block", KERNEL="*[1-9]", PROGRAM="/sbin/udev_volume_id -l %N"
udev_volume_id does not longer create any temporary device node or searches
the parent device by itself. It expects the name of the node as illustrated
in the examples.
Thanks,
Kay
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
next reply other threads:[~2005-02-10 11:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-10 11:19 Kay Sievers [this message]
2005-02-10 17:26 ` udev: provide temporary device nodes for callouts Patrick Mansfield
2005-02-10 17:41 ` Kay Sievers
2005-02-10 17:43 ` Patrick Mansfield
2005-02-10 18:01 ` Kay Sievers
2005-02-10 18:05 ` Greg KH
2005-02-10 18:05 ` Patrick Mansfield
2005-02-10 18:18 ` Kay Sievers
2005-02-10 18:18 ` Patrick Mansfield
2005-02-10 18:26 ` 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=20050210111951.GA6920@vrfy.org \
--to=kay.sievers@vrfy.org \
--cc=linux-hotplug@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;
as well as URLs for NNTP newsgroup(s).