linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* udev: provide temporary device nodes for callouts
@ 2005-02-10 11:19 Kay Sievers
  2005-02-10 17:26 ` Patrick Mansfield
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Kay Sievers @ 2005-02-10 11:19 UTC (permalink / raw)
  To: linux-hotplug

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-02-10 18:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-10 11:19 udev: provide temporary device nodes for callouts Kay Sievers
2005-02-10 17:26 ` 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

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).