Hello community,
here is the log from the commit of package udev
checked in at Wed Dec 19 15:31:11 CET 2007.
--------
--- udev/udev.changes 2007-11-13 21:39:42.000000000 +0100
+++ /mounts/work_src_done/STABLE/udev/udev.changes 2007-12-19 01:01:27.032424000 +0100
@@ -1,0 +2,8 @@
+Wed Dec 19 00:55:42 CET 2007 - kay.sievers@novell.com
+
+- new upstream release 118
+ volume_id: check if a device returns data before probing, so
+ we run only once into a timeout for dead devices
+ create_floppy_devices: fix for more than one floppy
+
+-------------------------------------------------------------------
Old:
----
udev-117.tar.bz2
New:
----
udev-118.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ udev.spec ++++++
--- /var/tmp/diff_new_pack.EN9498/_old 2007-12-19 15:30:42.000000000 +0100
+++ /var/tmp/diff_new_pack.EN9498/_new 2007-12-19 15:30:42.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package udev (Version 117)
+# spec file for package udev (Version 118)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -12,7 +12,7 @@
Name: udev
Url: http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
-Version: 117
+Version: 118
Release: 1
License: GPL v2 or later
Group: System/Kernel
@@ -76,6 +76,7 @@
Kay Sievers
%define extras "extras/scsi_id extras/volume_id extras/ata_id extras/usb_id extras/edd_id extras/cdrom_id extras/floppy extras/path_id extras/firmware extras/collect extras/rule_generator"
+
%prep
%setup
#%patch0 -p1
@@ -251,7 +252,13 @@
%files -n libvolume_id
%defattr(-,root,root)
/%{_lib}/libvolume_id.so.*
+
%changelog
+* Wed Dec 19 2007 - kay.sievers@novell.com
+- new upstream release 118
+ volume_id: check if a device returns data before probing, so
+ we run only once into a timeout for dead devices
+ create_floppy_devices: fix for more than one floppy
* Tue Nov 13 2007 - kay.sievers@novell.com
- new upstream release 117
all udev tools are merged into udevadm
++++++ boot.udev ++++++
--- udev/boot.udev 2007-11-12 20:53:21.000000000 +0100
+++ /mounts/work_src_done/STABLE/udev/boot.udev 2007-12-19 00:59:13.605173000 +0100
@@ -41,7 +41,7 @@
root_symlink_rule
# start udevd
- echo -n "Starting udevd "
+ echo -n "Starting udevd: "
$DAEMON $udevd_args
if [ $? -ne 0 ]; then
rc_status -v
@@ -56,29 +56,29 @@
rc_status -v
;;
stop)
- echo -n "Stopping udevd:"
+ echo -n "Stopping udevd: "
killproc $DAEMON
rc_status -v
;;
restart)
- echo -n "Restarting udevd:"
+ echo -n "Restarting udevd: "
killproc $DAEMON
$DAEMON $udevd_args
rc_status -v
;;
status)
- echo -n "Checking for udevd:"
+ echo -n "Checking for udevd: "
checkproc /sbin/udevd
rc_status -v
;;
reload)
- echo -n "Reloading udev rules:"
+ echo -n "Reloading udev rules: "
/sbin/udevadm control reload_rules
cp --preserve=all --recursive --update /lib/udev/devices/* /dev
rc_status -v
;;
force-reload)
- echo -n "Restarting udev and updating all device nodes:"
+ echo -n "Restarting udev and updating all device nodes: "
killproc $DAEMON
rm -rf /dev/.udev /dev/disk
cp --preserve=all --recursive --update /lib/udev/devices/* /dev
++++++ boot.udev_retry ++++++
--- udev/boot.udev_retry 2007-11-13 21:10:00.000000000 +0100
+++ /mounts/work_src_done/STABLE/udev/boot.udev_retry 2007-12-19 00:59:45.064681000 +0100
@@ -15,7 +15,7 @@
case "$1" in
start)
if test -d /dev/.udev/failed; then
- echo -n "Retry device configuration"
+ echo -n "Retry device configuration: "
udevadm trigger --retry-failed
rc_status $status -r -v
fi
++++++ udev-117.tar.bz2 -> udev-118.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/ChangeLog new/udev-118/ChangeLog
--- old/udev-117/ChangeLog 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/ChangeLog 2007-12-19 00:50:56.000000000 +0100
@@ -1,3 +1,30 @@
+Summary of changes from v117 to v118
+============================================
+
+Daniel Drake (1):
+ doc: update "writing udev rules"
+
+Hannes Reinecke (1):
+ volume_id: LVM - add uuid
+
+Kay Sievers (9):
+ remove udevstart
+ rules_generator: do not create rules with insufficient matches
+ man: udevadm settle - mention 180 seconds default timeout
+ libvolume_id: squashfs - add endianess support for LZMA compression
+ rules: add AOE rule
+ volume_id: md - add metadata minor version
+ volume_id: run only once into a timeout for unreadable devices
+ create_floppy_devices: fix logic for more than one floppy device
+ volume_id: also add readable check to probe_all()
+
+Matthias Schwarzott (1):
+ rules: Gentoo update
+
+Michael Prokop (1):
+ libvolume_id: squashfs+LZMA compression detection
+
+
Summary of changes from v116 to v117
============================================
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/docs/writing_udev_rules/index.html new/udev-118/docs/writing_udev_rules/index.html
--- old/udev-117/docs/writing_udev_rules/index.html 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/docs/writing_udev_rules/index.html 2007-12-19 00:50:56.000000000 +0100
@@ -7,6 +7,7 @@
<!--
.green { color: #003300; }
.blue { color: #0000CC; }
+ .maroon { color: maroon; }
//-->
</style>
<title>Writing udev rules</title>
@@ -16,7 +17,7 @@
<h1>Writing udev rules</h1>
by Daniel Drake (dsd)<br />
-Version 0.72<br /><br />
+Version 0.73<br /><br />
The most recent version of this document can always be found at: <br />
@@ -43,6 +44,7 @@
<li><a href="#syntax">Rule syntax</a></li>
<li><a href="#basic">Basic rules</a></li>
<li><a href="#sysfsmatch">Matching sysfs attributes</a></li>
+ <li><a href="#hierarchy">Device hierarchy</a></li>
<li><a href="#strsubst">String substitutions</a></li>
<li><a href="#strmatch">String matching</a></li>
</ul>
@@ -68,7 +70,7 @@
<li><a href="#example-printer">USB Printer</a></li>
<li><a href="#example-camera">USB Camera</a></li>
<li><a href="#example-usbhdd">USB Hard Disk</a></li>
- <li><a href="#example-usbcardreader">USB Hard Disk</a></li>
+ <li><a href="#example-usbcardreader">USB Card Reader</a></li>
<li><a href="#example-pilot">USB Palm Pilot</a></li>
<li><a href="#example-cdrom">CD/DVD drives</a></li>
<li><a href="#example-netif">Network interfaces</a></li>
@@ -112,7 +114,8 @@
<h3>History</h3>
<ul>
-<ul>October 2nd 2006 v0.72: Fixed a typo in one of the example rules.</li>
+<li>December 3rd 2007 v0.73: Update for new udev versions, and some miscellaneous improvements.</li>
+<li>October 2nd 2006 v0.72: Fixed a typo in one of the example rules.</li>
<li>June 10th 2006 v0.71: Misc changes based on recent feedback - thanks!</li>
<li>June 3rd 2006 v0.7: Complete rework, to be more suited for the modern-day udev.</li>
<li>May 9th 2005 v0.6: Misc updates, including information about udevinfo, groups and permissions, logging, and udevtest.</li>
@@ -238,6 +241,10 @@
The above rule includes one match key (<em>KERNEL</em>) and one assignment key (<em>NAME</em>). The semantics of these keys and their properties will be detailed later. It is important to note that the match key is related to its value through the equality operator (==), whereas the assignment key is related to its value through the assignment operator (=).
</p>
+<p>
+Be aware that udev does not support any form of line continuation. Do not insert any line breaks in your rules, as this will cause udev to see your one rule as multiple rules and will not work as expected.
+</p>
+
<a name="basic"></a>
<h3>Basic Rules</h3>
@@ -248,7 +255,7 @@
<ul>
<li><b>KERNEL</b> - match against the kernel name for the device</li>
<li><b>SUBSYSTEM</b> - match against the subsystem of the device</li>
-<li><b>DRIVER</b> - match against the driver name for the device</li>
+<li><b>DRIVER</b> - match against the name of the driver backing the device</li>
</ul>
<p>
@@ -290,19 +297,39 @@
</p>
<p>
-Many drivers export information like this into sysfs, and udev allows us to incorporate sysfs-matching into our rules, using the <em>SYSFS</em> key with a slightly different syntax.
+Many drivers export information like this into sysfs, and udev allows us to incorporate sysfs-matching into our rules, using the <em>ATTR</em> key with a slightly different syntax.
</p>
<p>
-Here are some examples of rules which match data from sysfs. Further detail will be provided later in this document which will aid you in writing rules based on sysfs attributes.
+Here is an example rule which matches a single attribute from sysfs. Further detail will be provided later in this document which will aid you in writing rules based on sysfs attributes.
</p>
<blockquote><pre>
-KERNEL=="sda", SYSFS{model}=="ST3120827AS", SYMLINK+="my_hard_disk"
-SUBSYSTEM=="block", SYSFS{size}=="234441648", SYMLINK+="my_disk"
-BUS=="usb", SYSFS{manufacturer}=="OLYMPUS", SYSFS{product}=="X250,D560Z,C350Z", SYMLINK+="camera"
+SUBSYSTEM=="block", ATTR{size}=="234441648", SYMLINK+="my_disk"
</pre></blockquote>
+<a name="hierarchy"></a>
+<h3>Device hierarchy</h3>
+
+<p>
+The Linux kernel actually represents devices in a tree-like structure, and this information is exposed through sysfs and useful when writing rules. For example, the device representation of my hard disk device is a child of the SCSI disk device, which is in turn a child of the Serial ATA controller device, which is in turn a child of the PCI bus device. It is likely that you will find yourself needing to refer to information from a parent of the device in question, for example the serial number of my hard disk device is not exposed at the device level, it is exposed by its direct parent at the SCSI disk level.
+</p>
+
+<p>
+The four main match keys introduced so far (KERNEL/SUBSYSTEM/DRIVER/ATTR) only match against values corresponding to the device in question, and do not match values from parent devices. udev provides variants of the match keys that will search upwards through the tree:
+</p>
+
+<ul>
+<li><b>KERNELS</b> - match against the kernel name for the device, or the kernel name for any of the parent devices</li>
+<li><b>SUBSYSTEMS</b> - match against the subsystem of the device, or the subsystem of any of the parent devices</li>
+<li><b>DRIVERS</b> - match against the name of the driver backing the device, or the name of the driver backing any of the parent devices</li>
+<li><b>ATTRS</b> - match a sysfs attribute of the device, or a sysfs attribute of any of the parent devices</li>
+</ul>
+
+<p>
+With hierarchy considerations in mind, you may feel that rule writing is becoming a little complicated. Rest assured that there are tools that help out here, which will be introduced later.
+</p>
+
<a name="strsubst"></a>
<h3>String substitutions</h3>
@@ -371,17 +398,17 @@
</p>
<p>
-sysfs is actually a very simple structure. It is logically divided into directories. Each directory contains a number of files (<em>attributes</em>) which typically contain just one value. Some symbolic links are present, which link various parts of the tree together.
+sysfs is actually a very simple structure. It is logically divided into directories. Each directory contains a number of files (<em>attributes</em>) which typically contain just one value. Some symbolic links are present, which link devices to their parents. The hierarchical structure was touched upon above.
</p>
<p>
-Some directories are referred to as <em>top-level device paths</em>. These directories act as the top-level glue which chain other parts of sysfs to the device in question. Top-level device paths can be classified as sysfs directories which contain a <em>dev</em> file, the following command will list these for you:
+Some directories are referred to as <em>top-level device paths</em>. These directories represent actual devices that have corresponding device nodes. Top-level device paths can be classified as sysfs directories which contain a <em>dev</em> file, the following command will list these for you:
</p>
<blockquote><pre># find /sys -name dev</pre></blockquote>
<p>
-For example, on my system, the <em>/sys/block/sda</em> directory is the device path for my hard disk. It is chained to the controller through the <em>/sys/block/sda/device/</em> symbolic link, which is in turn chained to the device driver through the <em>/sys/block/sda/device/driver/</em> symbolic link.
+For example, on my system, the <em>/sys/block/sda</em> directory is the device path for my hard disk. It is linked to it's parent, the SCSI disk device, through the <em>/sys/block/sda/device</em> symbolic link.
</p>
<p>
@@ -394,7 +421,7 @@
</pre></blockquote>
<p>
-In a udev rule, I could use SYSFS{size}=="234441648" to identify this disk. As udev iterates through the entire device chain, I could alternatively opt to match attributes in another part of the chain (e.g. attributes in <em>/sys/class/block/sda/device/</em>), however there are some caveats when dealing with different parts of the chain which are described later.
+In a udev rule, I could use ATTR{size}=="234441648" to identify this disk. As udev iterates through the entire device chain, I could alternatively opt to match attributes in another part of the chain (e.g. attributes in <em>/sys/class/block/sda/device/</em>) using <em>ATTRS</em>, however there are some caveats when dealing with different parts of the chain which are described later.
</p>
<p>
@@ -414,30 +441,37 @@
<span class="green"> looking at device '/block/sda':
KERNEL=="sda"
SUBSYSTEM=="block"
- SYSFS{stat}==" 128535 2246 2788977 766188 73998 317300 3132216 5735004 0 516516 6503316"
- SYSFS{size}=="234441648"
- SYSFS{removable}=="0"
- SYSFS{range}=="16"
- SYSFS{dev}=="8:0"</span>
-
-<span class="blue"> looking at device '/devices/pci0000:00/0000:00:07.0/host0/target0:0:0/0:0:0:0':
- ID=="0:0:0:0"
- BUS=="scsi"
- DRIVER=="sd"
- SYSFS{ioerr_cnt}=="0x0"
- SYSFS{iodone_cnt}=="0x31737"
- SYSFS{iorequest_cnt}=="0x31737"
- SYSFS{iocounterbits}=="32"
- SYSFS{timeout}=="30"
- SYSFS{state}=="running"
- SYSFS{rev}=="3.42"
- SYSFS{model}=="ST3120827AS "
- SYSFS{vendor}=="ATA "
- SYSFS{scsi_level}=="6"
- SYSFS{type}=="0"
- SYSFS{queue_type}=="none"
- SYSFS{queue_depth}=="1"
- SYSFS{device_blocked}=="0"</span>
+ ATTR{stat}==" 128535 2246 2788977 766188 73998 317300 3132216 5735004 0 516516 6503316"
+ ATTR{size}=="234441648"
+ ATTR{removable}=="0"
+ ATTR{range}=="16"
+ ATTR{dev}=="8:0"</span>
+
+<span class="blue"> looking at parent device '/devices/pci0000:00/0000:00:07.0/host0/target0:0:0/0:0:0:0':
+ KERNELS=="0:0:0:0"
+ SUBSYSTEMS=="scsi"
+ DRIVERS=="sd"
+ ATTRS{ioerr_cnt}=="0x0"
+ ATTRS{iodone_cnt}=="0x31737"
+ ATTRS{iorequest_cnt}=="0x31737"
+ ATTRS{iocounterbits}=="32"
+ ATTRS{timeout}=="30"
+ ATTRS{state}=="running"
+ ATTRS{rev}=="3.42"
+ ATTRS{model}=="ST3120827AS "
+ ATTRS{vendor}=="ATA "
+ ATTRS{scsi_level}=="6"
+ ATTRS{type}=="0"
+ ATTRS{queue_type}=="none"
+ ATTRS{queue_depth}=="1"
+ ATTRS{device_blocked}=="0"</span>
+
+<span class="maroon"> looking at parent device '/devices/pci0000:00/0000:00:07.0':
+ KERNELS=="0000:00:07.0"
+ SUBSYSTEMS=="pci"
+ DRIVERS=="sata_nv"
+ ATTRS{vendor}=="0x10de"
+ ATTRS{device}=="0x037f"</span>
</pre></blockquote>
<p>
@@ -445,18 +479,22 @@
</p>
<blockquote><pre>
-SUBSYSTEM=="block", <span class="green">SYSFS{size}=="234441648",</span> NAME="my_hard_disk"
-BUS=="scsi", <span class="blue">SYSFS{model}=="ST3120827AS",</span> NAME="my_hard_disk"</pre></blockquote>
+<span class="green">SUBSYSTEM=="block"</span>, <span class="green">ATTR{size}=="234441648",</span> NAME="my_hard_disk"
+<span class="green">SUBSYSTEM="block"</span>, <span class="blue">SUBSYSTEMS=="scsi"</span>, <span class="blue">ATTRS{model}=="ST3120827AS",</span> NAME="my_hard_disk"</pre></blockquote>
<p>
-You may have noted the use of colour in the above examples. This is to demonstrate that you generally can <em>not</em> mix-and-match attributes from different sections of the udevinfo output - your rule will not work. For example, the following rule is <em>invalid</em>:
+You may have noted the use of colour in the above examples. This is to demonstrate that while it is legal to combine the attributes from the device in question and a <em>single</em> parent device, you cannot mix-and-match attributes from multiple parent devices - your rule will not work. For example, the following rule is <em>invalid</em> as it attempts to match attributes from two parent devices:
</p>
<blockquote><pre>
-SUBSYSTEM=="block", <span class="green">SYSFS{size}=="234441648",</span> <span class="blue">SYSFS{model}=="ST3120827AS",</span> NAME="my_hard_disk"</pre></blockquote>
+<span class="green">SUBSYSTEM=="block"</span>, <span class="blue">ATTRS{model}=="ST3120827AS"</span>, <span class="maroon">DRIVERS=="sata_nv"</span>, NAME="my_hard_disk"</pre></blockquote>
+
+<p>
+You are usually provided with a large number of attributes, and you must pick a number of them to construct your rule. In general, you want to choose attributes which identify your device in a persistent and human-recognisable way. In the examples above, I chose the size of my disk and its model number. I did not use meaningless numbers such as ATTRS{iodone_cnt}=="0x31737".
+</p>
<p>
-You are usually provided with a large number of attributes, and you must pick a number of them (from the same section) to construct your rule. In general, you want to choose attributes which identify your device in a persistent and human-recognisable way. In the examples above, I chose the size of my disk and its model number. I did not use meaningless numbers such as SYSFS{iodone_cnt}=="0x31737".
+Observe the effects of hierarchy in the udevinfo output. The <span class="green">green</span> section corresponding to the device in question uses the standard match keys such as KERNEL and ATTR. The <span class="blue">blue</span> and <span class="maroon">maroon</span> sections corresponding to parent devices use the parent-traversing variants such as SUBSYSTEMS and ATTRS. This is why the complexity introduced by the hierarchical structure is actually quite easy to deal with, just be sure to use the exact values that udevinfo suggests.
</p>
<p>
@@ -567,6 +605,10 @@
When <em>/usr/bin/my_program</em> is executed, various parts of the udev environment are available as environment variables, including key values such as <em>SUBSYSTEM</em>. You can also use the <em>ACTION</em> environment variable to detect whether the device is being connected or disconnected - ACTION will be either "add" or "remove" respectively.
</p>
+<p>
+udev does not run these programs on any active terminal, and it does not execute them under the context of a shell. Be sure to ensure your program is marked executable, if it is a shell script ensure it starts with an appropriate <a href="http://en.wikipedia.org/wiki/Shebang_(Unix)">shebang</a> (e.g. <code>#!/bin/sh</code>), and do not expect any standard output to appear on your terminal.
+</p>
+
<a name="env"></a>
<h3>Environment interaction</h3>
@@ -621,18 +663,24 @@
<blockquote><pre>
# udevinfo -a -p $(udevinfo -q path -n /dev/lp0)
-looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3':
-BUS=="usb"
-SYSFS{manufacturer}=="EPSON"
-SYSFS{product}=="USB Printer"
-SYSFS{serial}=="L72010011070626380"
+ looking at device '/class/usb/lp0':
+ KERNEL=="lp0"
+ SUBSYSTEM=="usb"
+ DRIVER==""
+ ATTR{dev}=="180:0"
+
+ looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb1/1-1':
+ SUBSYSTEMS=="usb"
+ ATTRS{manufacturer}=="EPSON"
+ ATTRS{product}=="USB Printer"
+ ATTRS{serial}=="L72010011070626380"
</pre></blockquote>
<p>
My rule becomes:
</p>
-<blockquote><pre>BUS=="usb", SYSFS{serial}=="L72010011070626380", SYMLINK+="epson_680"</pre></blockquote>
+<blockquote><pre>SUBSYSTEM=="usb", ATTRS{serial}=="L72010011070626380", SYMLINK+="epson_680"</pre></blockquote>
<a name="example-camera"></a>
<h3>USB Camera</h3>
@@ -655,22 +703,26 @@
<blockquote><pre>
# udevinfo -a -p $(udevinfo -q path -n /dev/sdb1)
- looking at device '/devices/pci0000:00/0000:00:02.0/usb2/2-1/2-1:1.0/host6/target6:0:0/6:0:0:0':
- ID=="6:0:0:0"
- BUS=="scsi"
- DRIVER=="sd"
- SYSFS{rev}=="1.00"
- SYSFS{model}=="X250,D560Z,C350Z"
- SYSFS{vendor}=="OLYMPUS "
- SYSFS{scsi_level}=="3"
- SYSFS{type}=="0"
+ looking at device '/block/sdb/sdb1':
+ KERNEL=="sdb1"
+ SUBSYSTEM=="block"
+
+ looking at parent device '/devices/pci0000:00/0000:00:02.1/usb1/1-1/1-1:1.0/host6/target6:0:0/6:0:0:0':
+ KERNELS=="6:0:0:0"
+ SUBSYSTEMS=="scsi"
+ DRIVERS=="sd"
+ ATTRS{rev}=="1.00"
+ ATTRS{model}=="X250,D560Z,C350Z"
+ ATTRS{vendor}=="OLYMPUS "
+ ATTRS{scsi_level}=="3"
+ ATTRS{type}=="0"
</pre></blockquote>
<p>
My rule:
</p>
-<blockquote><pre>KERNEL=="sd?1", BUS=="scsi", SYSFS{model}=="X250,D560Z,C350Z", SYMLINK+="camera"</pre></blockquote>
+<blockquote><pre>KERNEL=="sd?1", SUBSYSTEMS=="scsi", ATTRS{model}=="X250,D560Z,C350Z", SYMLINK+="camera"</pre></blockquote>
<a name="example-usbhdd"></a>
<h3>USB Hard Disk</h3>
@@ -683,7 +735,7 @@
Of course, if you have a 100GB USB hard disk, it is perfectly understandable that you might want to partition it, in which case we can take advantage of udev's string substitutions:
</p>
-<blockquote><pre>BUS=="usb", KERNEL=="sd*", SYSFS{product}=="USB 2.0 Storage Device", NAME="%k", SYMLINK+="usbhd%n"</pre></blockquote>
+<blockquote><pre>KERNEL=="sd*", SUBSYSTEMS="scsi", ATTRS{model}=="USB 2.0 Storage Device", SYMLINK+="usbhd%n"</pre></blockquote>
<p>
This rule creates symlinks such as:
@@ -710,7 +762,7 @@
One possible solution is to take advantage of the <em>all_partitions</em> option, which will create 16 partition nodes for every block device that the rule matches:
</p>
-<blockquote><pre>BUS=="usb", SYSFS{product}=="USB 2.0 CompactFlash Reader", SYMLINK+="cfrdr%n", OPTIONS+="all_partitions"</pre></blockquote>
+<blockquote><pre>KERNEL="sd*", SUBSYSTEMS=="scsi", ATTRS{model}=="USB 2.0 CompactFlash Reader", SYMLINK+="cfrdr%n", OPTIONS+="all_partitions"</pre></blockquote>
You will now have nodes named: cfrdr, cfrdr1, cfrdr2, cfrdr3, ..., cfrdr15.
@@ -725,7 +777,7 @@
<a href="http://www.clasohm.com/blog/one-entry?entry%5fid=12096">Carsten Clasohm's blog post</a> appears to be the definitive source for this. Carsten's rule is shown below:
</p>
-<blockquote><pre>BUS=="usb", SYSFS{product}=="Palm Handheld", KERNEL=="ttyUSB*", SYMLINK+="pilot"</pre></blockquote>
+<blockquote><pre>SUBSYSTEMS=="usb", ATTRS{product}=="Palm Handheld", KERNEL=="ttyUSB*", SYMLINK+="pilot"</pre></blockquote>
<p>
Note that the product string seems to vary from product to product, so make sure that you check (using udevinfo) which one applies to you.
@@ -743,8 +795,8 @@
</p>
<blockquote><pre>
-BUS=="ide", KERNEL=="hdc", SYMLINK+="dvd", GROUP="cdrom"
-BUS=="ide", KERNEL=="hdd", SYMLINK+="dvdrw", GROUP="cdrom"
+SUBSYSTEM=="block", KERNEL=="hdc", SYMLINK+="dvd", GROUP="cdrom"
+SUBSYSTEM=="block", KERNEL=="hdd", SYMLINK+="dvdrw", GROUP="cdrom"
</pre></blockquote>
<a name="example-netif"></a>
@@ -761,14 +813,15 @@
<blockquote><pre>
# udevinfo -a -p /sys/class/net/eth0
looking at class device '/sys/class/net/eth0':
- SYSFS{address}=="00:52:8b:d5:04:48"
+ KERNEL=="eth0"
+ ATTR{address}=="00:52:8b:d5:04:48"
</pre></blockquote>
<p>
Here is my rule:
</p>
-<blockquote><pre>KERNEL=="eth*", SYSFS{address}=="00:52:8b:d5:04:48", NAME="lan"</pre></blockquote>
+<blockquote><pre>KERNEL=="eth*", ATTR{address}=="00:52:8b:d5:04:48", NAME="lan"</pre></blockquote>
<p>
You will need to reload the net driver for this rule to take effect. You can either unload and reload the module, or simply reboot the system. You will also need to reconfigure your system to use "lan" rather than "eth0". I had some troubles getting this going (the interface wasn't being renamed) until I had completely dropped all references to eth0.
@@ -830,7 +883,7 @@
<p>
Copyright (C) 2003-2006 Daniel Drake.<br />
-This document is licensed under the <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License, Version 2</a>.
+This document is licensed under the <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License, Version 2</a>.
</p>
</body>
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/etc/udev/gentoo/40-video.rules new/udev-118/etc/udev/gentoo/40-video.rules
--- old/udev-117/etc/udev/gentoo/40-video.rules 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/etc/udev/gentoo/40-video.rules 2007-12-19 00:50:56.000000000 +0100
@@ -13,10 +13,10 @@
KERNEL=="nvidia*", GROUP="video"
KERNEL=="3dfx*", GROUP="video"
+# svgalib
+KERNEL=="svga*", GROUP="video"
+
# Framebuffer
-# do we need /dev/fb/0 really?
-# it conflicts with symlink /dev/fb -> /dev/fb0 upstream rules create
-#KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video"
KERNEL=="fb[0-9]*", GROUP="video"
# IEEE1394 (firewire) devices
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/etc/udev/rules.d/50-udev-default.rules new/udev-118/etc/udev/rules.d/50-udev-default.rules
--- old/udev-117/etc/udev/rules.d/50-udev-default.rules 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/etc/udev/rules.d/50-udev-default.rules 2007-12-19 00:50:56.000000000 +0100
@@ -78,6 +78,7 @@
KERNEL=="pktcdvd", NAME="pktcdvd/control"
KERNEL=="qft0", SYMLINK+="ftape"
SUBSYSTEM=="bsg", NAME="bsg/%k"
+SUBSYSTEM=="aoe", NAME="etherd/%k", GROUP="disk"
# network
KERNEL=="tun", NAME="net/%k", MODE="0666", OPTIONS+="ignore_remove"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/extras/floppy/create_floppy_devices.c new/udev-118/extras/floppy/create_floppy_devices.c
--- old/udev-117/extras/floppy/create_floppy_devices.c 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/extras/floppy/create_floppy_devices.c 2007-12-19 00:50:56.000000000 +0100
@@ -69,6 +69,7 @@
int main(int argc, char **argv)
{
char *dev;
+ char *devname;
char node[64];
int type = 0, i, fdnum, c;
int major = 2, minor;
@@ -123,12 +124,17 @@
}
dev = argv[optind];
- if (dev[strlen(dev) - 3] != 'f' || dev[strlen(dev) -2 ] != 'd') {
+ devname = strrchr(dev, '/');
+ if (devname != NULL)
+ devname = &devname[1];
+ else
+ devname = dev;
+ if (strncmp(devname, "fd", 2) != 0) {
fprintf(stderr,"Device '%s' is not a floppy device\n", dev);
return 1;
}
- fdnum = strtol(dev + 2, NULL, 10);
+ fdnum = strtol(&devname[2], NULL, 10);
if (fdnum < 0 || fdnum > 7) {
fprintf(stderr,"Floppy device number %d out of range (0-7)\n", fdnum);
return 1;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/extras/rule_generator/75-persistent-net-generator.rules new/udev-118/extras/rule_generator/75-persistent-net-generator.rules
--- old/udev-117/extras/rule_generator/75-persistent-net-generator.rules 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/extras/rule_generator/75-persistent-net-generator.rules 2007-12-19 00:50:56.000000000 +0100
@@ -44,6 +44,9 @@
# S/390 uses id matches only, do not use MAC address match
SUBSYSTEMS=="ccwgroup", ENV{COMMENT}="S/390 $driver device at $id", ENV{MATCHID}="$id", ENV{MATCHDRV}="$driver", ENV{MATCHADDR}=""
+# see if we got enough data to create a rule
+ENV{MATCHADDR}=="", ENV{MATCHID}=="", ENV{INTERFACE_NAME}=="", GOTO="persistent_net_generator_end"
+
# default comment
ENV{COMMENT}=="", ENV{COMMENT}="$env{SUBSYSTEM} device"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/extras/volume_id/lib/linux_raid.c new/udev-118/extras/volume_id/lib/linux_raid.c
--- old/udev-117/extras/volume_id/lib/linux_raid.c 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/extras/volume_id/lib/linux_raid.c 2007-12-19 00:50:56.000000000 +0100
@@ -87,7 +87,7 @@
uuid.ints[2] = 0;
uuid.ints[3] = 0;
}
- volume_id_set_uuid(id, uuid.bytes, 0, UUID_FOURINT);
+ volume_id_set_uuid(id, uuid.bytes, 0, UUID_MD);
snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u",
le32_to_cpu(mdp0->major_version),
le32_to_cpu(mdp0->minor_version),
@@ -103,7 +103,7 @@
uuid.ints[2] = 0;
uuid.ints[3] = 0;
}
- volume_id_set_uuid(id, uuid.bytes, 0, UUID_FOURINT);
+ volume_id_set_uuid(id, uuid.bytes, 0, UUID_MD);
snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u",
be32_to_cpu(mdp0->major_version),
be32_to_cpu(mdp0->minor_version),
@@ -131,10 +131,12 @@
if (le32_to_cpu(mdp1->magic) != MD_SB_MAGIC)
return -1;
- volume_id_set_uuid(id, mdp1->set_uuid, 0, UUID_FOURINT);
+ if (le32_to_cpu(mdp1->major_version) != 1)
+ return -1;
+
+ volume_id_set_uuid(id, mdp1->set_uuid, 0, UUID_MD);
volume_id_set_label_raw(id, mdp1->set_name, 32);
volume_id_set_label_string(id, mdp1->set_name, 32);
- snprintf(id->type_version, sizeof(id->type_version)-1, "%u", le32_to_cpu(mdp1->major_version));
volume_id_set_usage(id, VOLUME_ID_RAID);
id->type = "linux_raid_member";
return 0;
@@ -151,16 +153,22 @@
/* version 1.0 at the end of the device */
sboff = (size & ~(0x1000 - 1)) - 0x2000;
- if (volume_id_probe_linux_raid1(id, off + sboff, size) == 0)
+ if (volume_id_probe_linux_raid1(id, off + sboff, size) == 0) {
+ strcpy(id->type_version, "1.0");
return 0;
+ }
/* version 1.1 at the start of the device */
- if (volume_id_probe_linux_raid1(id, off, size) == 0)
+ if (volume_id_probe_linux_raid1(id, off, size) == 0) {
+ strcpy(id->type_version, "1.1");
return 0;
+ }
/* version 1.2 at 4k offset from the start */
- if (volume_id_probe_linux_raid1(id, off + 0x1000, size) == 0)
+ if (volume_id_probe_linux_raid1(id, off + 0x1000, size) == 0) {
+ strcpy(id->type_version, "1.2");
return 0;
+ }
return -1;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/extras/volume_id/lib/lvm.c new/udev-118/extras/volume_id/lib/lvm.c
--- old/udev-117/extras/volume_id/lib/lvm.c 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/extras/volume_id/lib/lvm.c 2007-12-19 00:50:56.000000000 +0100
@@ -38,6 +38,11 @@
uint8_t type[8];
} PACKED;
+struct lvm2_pv_header {
+ uint8_t id[32];
+ uint64_t devsize_xl;
+} PACKED;
+
#define LVM1_SB_OFF 0x400
#define LVM1_MAGIC "HM"
@@ -71,6 +76,7 @@
const uint8_t *buf;
unsigned int soff;
struct lvm2_super_block *lvm;
+ struct lvm2_pv_header *pvhdr;
dbg("probing at offset 0x%llx", (unsigned long long) off);
@@ -89,8 +95,13 @@
return -1;
found:
+ dbg("found at offset 0x%x (pv hdr offset 0x%x)",
+ soff, cpu_to_le32(lvm->offset_xl));
+ soff += cpu_to_le32(lvm->offset_xl);
+ pvhdr = (struct lvm2_pv_header *) &buf[soff];
memcpy(id->type_version, lvm->type, 8);
volume_id_set_usage(id, VOLUME_ID_RAID);
+ volume_id_set_uuid(id, pvhdr->id, 0, UUID_LVM);
id->type = "LVM2_member";
return 0;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/extras/volume_id/lib/Makefile new/udev-118/extras/volume_id/lib/Makefile
--- old/udev-117/extras/volume_id/lib/Makefile 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/extras/volume_id/lib/Makefile 2007-12-19 00:50:56.000000000 +0100
@@ -13,7 +13,7 @@
INSTALL_LIB = ${INSTALL} -m 755
SHLIB_CUR = 0
-SHLIB_REV = 81
+SHLIB_REV = 82
SHLIB_AGE = 0
SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/extras/volume_id/lib/squashfs.c new/udev-118/extras/volume_id/lib/squashfs.c
--- old/udev-117/extras/volume_id/lib/squashfs.c 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/extras/volume_id/lib/squashfs.c 2007-12-19 00:50:56.000000000 +0100
@@ -27,6 +27,7 @@
#include "util.h"
#define SQUASHFS_MAGIC 0x73717368
+#define SQUASHFS_MAGIC_LZMA 0x71736873
struct squashfs_super {
uint32_t s_magic;
@@ -50,12 +51,12 @@
if (sqs == NULL)
return -1;
- if (sqs->s_magic == SQUASHFS_MAGIC) {
+ if (sqs->s_magic == SQUASHFS_MAGIC || sqs->s_magic == SQUASHFS_MAGIC_LZMA) {
snprintf(id->type_version, sizeof(id->type_version), "%u.%u",
sqs->s_major, sqs->s_minor);
goto found;
}
- if (sqs->s_magic == bswap_32(SQUASHFS_MAGIC)) {
+ if (sqs->s_magic == bswap_32(SQUASHFS_MAGIC) || sqs->s_magic == bswap_32(SQUASHFS_MAGIC_LZMA)) {
snprintf(id->type_version, sizeof(id->type_version), "%u.%u",
bswap_16(sqs->s_major), bswap_16(sqs->s_minor));
goto found;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/extras/volume_id/lib/util.c new/udev-118/extras/volume_id/lib/util.c
--- old/udev-117/extras/volume_id/lib/util.c 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/extras/volume_id/lib/util.c 2007-12-19 00:50:56.000000000 +0100
@@ -274,9 +274,12 @@
case UUID_DCE:
count = 16;
break;
- case UUID_FOURINT:
+ case UUID_MD:
count = 35;
break;
+ case UUID_LVM:
+ count = 32;
+ break;
}
memcpy(id->uuid_raw, buf, count);
id->uuid_raw_len = count;
@@ -324,7 +327,7 @@
memcpy(id->uuid, buf, count);
id->uuid[count] = '\0';
break;
- case UUID_FOURINT:
+ case UUID_MD:
sprintf(id->uuid,
"%02x%02x%02x%02x:%02x%02x%02x%02x:%02x%02x%02x%02x:%02x%02x%02x%02x",
buf[0], buf[1], buf[2], buf[3],
@@ -332,6 +335,17 @@
buf[8], buf[9], buf[10], buf[11],
buf[12], buf[13], buf[14],buf[15]);
break;
+ case UUID_LVM:
+ sprintf(id->uuid,
+ "%c%c%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c%c%c",
+ buf[0], buf[1], buf[2], buf[3], buf[4], buf[5],
+ buf[6], buf[7], buf[8], buf[9],
+ buf[10], buf[11], buf[12], buf[13],
+ buf[14], buf[15], buf[16], buf[17],
+ buf[18], buf[19], buf[20], buf[21],
+ buf[22], buf[23], buf[24], buf[25],
+ buf[26], buf[27], buf[28], buf[29], buf[30], buf[31]);
+ break;
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/extras/volume_id/lib/util.h new/udev-118/extras/volume_id/lib/util.h
--- old/udev-117/extras/volume_id/lib/util.h 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/extras/volume_id/lib/util.h 2007-12-19 00:50:56.000000000 +0100
@@ -71,7 +71,8 @@
UUID_DOS,
UUID_64BIT_LE,
UUID_64BIT_BE,
- UUID_FOURINT,
+ UUID_MD,
+ UUID_LVM,
};
enum endian {
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/extras/volume_id/lib/volume_id.c new/udev-118/extras/volume_id/lib/volume_id.c
--- old/udev-117/extras/volume_id/lib/volume_id.c 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/extras/volume_id/lib/volume_id.c 2007-12-19 00:50:56.000000000 +0100
@@ -330,6 +330,14 @@
return 0;
}
+/* run only once into a timeout for unreadable devices */
+static int device_is_readable(struct volume_id *id)
+{
+ if (volume_id_get_buffer(id, 0x00, 0x200) != NULL)
+ return 1;
+ return 0;
+}
+
/**
* volume_id_probe_raid:
* @id: Probing context.
@@ -347,6 +355,9 @@
if (id == NULL)
return -EINVAL;
+ if (!device_is_readable(id))
+ return -1;
+
info("probing at offset 0x%llx, size 0x%llx",
(unsigned long long) off, (unsigned long long) size);
@@ -378,6 +389,9 @@
if (id == NULL)
return -EINVAL;
+ if (!device_is_readable(id))
+ return -1;
+
info("probing at offset 0x%llx, size 0x%llx",
(unsigned long long) off, (unsigned long long) size);
@@ -407,6 +421,9 @@
if (id == NULL)
return -EINVAL;
+ if (!device_is_readable(id))
+ return -1;
+
/* probe for raid first, because fs probes may be successful on raid members */
if (volume_id_probe_raid(id, off, size) == 0)
return 0;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/.gitignore new/udev-118/.gitignore
--- old/udev-117/.gitignore 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/.gitignore 2007-12-19 00:50:56.000000000 +0100
@@ -2,7 +2,6 @@
*.a
udevd
udevadm
-udevstart
udev_version.h
test-udev
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/Makefile new/udev-118/Makefile
--- old/udev-117/Makefile 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/Makefile 2007-12-19 00:50:56.000000000 +0100
@@ -16,7 +16,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
-VERSION = 117
+VERSION = 118
# set this to make use of syslog
USE_LOG = true
@@ -45,7 +45,6 @@
PROGRAMS = \
udevd \
udevadm \
- udevstart \
test-udev
HEADERS = \
@@ -314,7 +313,6 @@
test tests: all
@ cd test && ./udev-test.pl
- @ cd test && ./udevstart-test.pl
.PHONY: test tests
buildtest:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/RELEASE-NOTES new/udev-118/RELEASE-NOTES
--- old/udev-117/RELEASE-NOTES 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/RELEASE-NOTES 2007-12-19 00:50:56.000000000 +0100
@@ -1,3 +1,10 @@
+udev 118
+========
+Bugfixes.
+
+Udevstart is removed from the tree, it did not get installed for
+a long time now, and is long replaced by trigger and settle.
+
udev 117
========
Bugfixes.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/test/udevstart-test.pl new/udev-118/test/udevstart-test.pl
--- old/udev-117/test/udevstart-test.pl 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/test/udevstart-test.pl 1970-01-01 01:00:00.000000000 +0100
@@ -1,61 +0,0 @@
-#!/usr/bin/perl
-
-# udevstart-test
-#
-# runs udevstart in a temporary directory with our test sysfs-tree
-# and counts the created nodes to compare it with the expected numbers.
-#
-# Kay Sievers , 2005
-#
-
-use warnings;
-use strict;
-
-my $PWD = $ENV{PWD};
-my $sysfs = "sys/";
-my $udevstart_bin = "../udevstart";
-my $udev_root = "udev-root/"; # !!! directory will be removed !!!
-my $udev_db = ".udevdb";
-my $udev_conf = "udev-test.conf";
-my $udev_rules = "udev-test.rules";
-
-# set env
-$ENV{SYSFS_PATH} = $sysfs;
-$ENV{UDEV_CONFIG_FILE} = $udev_conf;
-
-# due to mknod restrictions
-if (!($<==0)) {
- print "Must have root permissions to run properly.\n";
- exit;
-}
-
-# prepare
-system("rm -rf $udev_root");
-mkdir($udev_root) || die "unable to create udev_root: $udev_root\n";
-
-# create config file
-open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf";
-print CONF "udev_root=\"$udev_root\"\n";
-print CONF "udev_db=\"$udev_db\"\n";
-print CONF "udev_rules=\"$udev_rules\"\n";
-close CONF;
-
-# create rules file
-open RULES, ">$udev_rules" || die "unable to create rules file: $udev_rules";
-print RULES "\n";
-close RULES;
-
-system("$udevstart_bin");
-my $block = int(`find $udev_root -type b -print | wc -l`);
-my $char = int(`find $udev_root -type c -print | wc -l`);
-
-print "block devices: $block/10\n";
-print "char devices: $char/91\n";
-print "\n";
-
-# cleanup
-system("rm -rf $udev_db");
-system("rm -rf $udev_root");
-unlink($udev_rules);
-unlink($udev_conf);
-
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/TODO new/udev-118/TODO
--- old/udev-117/TODO 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/TODO 2007-12-19 00:50:56.000000000 +0100
@@ -8,10 +8,6 @@
These things are deprecated and scheduled for removal in a future
udev version:
- o remove udevstart
- (we rely on the kernel "uevent"-triggers of kernel 2.6.15 and no longer
- want to guess event-properties from sysfs like udevstart is doing it)
-
o remove man page symlinks for old tool names
o some day, remove the symlinks to udevadm
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/udevadm.8 new/udev-118/udevadm.8
--- old/udev-117/udevadm.8 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/udevadm.8 2007-12-19 00:50:56.000000000 +0100
@@ -144,7 +144,7 @@
.PP
\fB\-\-timeout=\fR\fB\fIseconds\fR\fR
.RS 4
-Maximum seconds to wait for the queue to become empty\.
+Maximum number of seconds to wait for the event queue to become empty\. The default value is 180 seconds\.
.RE
.PP
\fB\-\-help\fR
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/udevadm.xml new/udev-118/udevadm.xml
--- old/udev-117/udevadm.xml 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/udevadm.xml 2007-12-19 00:50:56.000000000 +0100
@@ -197,7 +197,8 @@
<varlistentry>
<term><option>--timeout=<replaceable>seconds</replaceable></option></term>
<listitem>
- <para>Maximum seconds to wait for the queue to become empty.</para>
+ <para>Maximum number of seconds to wait for the event queue to become empty.
+ The default value is 180 seconds.</para>
</listitem>
</varlistentry>
<varlistentry>
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-117/udevstart.c new/udev-118/udevstart.c
--- old/udev-117/udevstart.c 2007-11-13 20:47:34.000000000 +0100
+++ new/udev-118/udevstart.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,359 +0,0 @@
-/*
- * quick and dirty way to populate a /dev directory
- *
- * Copyright (C) 2004 Harald Hoyer
- * Copyright (C) 2004 Greg Kroah-Hartman
- * Copyright (C) 2004-2006 Kay Sievers
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "udev.h"
-#include "udev_rules.h"
-#include "udev_selinux.h"
-
-static const char *udev_run_str;
-static const char *udev_log_str;
-static struct udev_rules rules;
-
-#ifdef USE_LOG
-void log_message(int priority, const char *format, ...)
-{
- va_list args;
-
- if (priority > udev_log_priority)
- return;
-
- va_start(args, format);
- vsyslog(priority, format, args);
- va_end(args);
-}
-#endif
-
-struct device {
- struct list_head node;
- char path[PATH_SIZE];
-};
-
-/* sort files in lexical order */
-static int device_list_insert(const char *path, struct list_head *device_list)
-{
- struct device *loop_device;
- struct device *new_device;
- const char *devpath = &path[strlen(sysfs_path)];
-
- dbg("insert: '%s'", devpath);
-
- list_for_each_entry(loop_device, device_list, node) {
- if (strcmp(loop_device->path, devpath) > 0) {
- break;
- }
- }
-
- new_device = malloc(sizeof(struct device));
- if (new_device == NULL) {
- dbg("error malloc");
- return -ENOMEM;
- }
-
- strlcpy(new_device->path, devpath, sizeof(new_device->path));
- list_add_tail(&new_device->node, &loop_device->node);
- dbg("add '%s'" , new_device->path);
- return 0;
-}
-
-/* list of devices that we should run last due to any one of a number of reasons */
-static char *last_list[] = {
- "/block/dm", /* on here because dm wants to have the block devices around before it */
- NULL,
-};
-
-/* list of devices that we should run first due to any one of a number of reasons */
-static char *first_list[] = {
- "/class/mem",
- "/class/tty",
- NULL,
-};
-
-static int add_device(const char *devpath)
-{
- struct sysfs_device *dev;
- struct udevice *udev;
- int retval = 0;
-
- /* clear and set environment for next event */
- clearenv();
- setenv("ACTION", "add", 1);
- setenv("UDEV_START", "1", 1);
- if (udev_log_str)
- setenv("UDEV_LOG", udev_log_str, 1);
- if (udev_run_str)
- setenv("UDEV_RUN", udev_run_str, 1);
-
- dev = sysfs_device_get(devpath);
- if (dev == NULL)
- return -1;
-
- udev = udev_device_init(NULL);
- if (udev == NULL)
- return -1;
-
- /* override built-in sysfs device */
- udev->dev = dev;
- strcpy(udev->action, "add");
-
- if (strcmp(udev->dev->subsystem, "net") != 0) {
- udev->devt = udev_device_get_devt(udev);
- if (major(udev->devt) == 0)
- return -1;
- }
-
- dbg("add '%s'", udev->dev->devpath);
- setenv("DEVPATH", udev->dev->devpath, 1);
- setenv("SUBSYSTEM", udev->dev->subsystem, 1);
-
- udev_rules_get_name(&rules, udev);
- if (udev->ignore_device) {
- dbg("device event will be ignored");
- goto exit;
- }
- if (udev->name[0] != '\0')
- retval = udev_device_event(&rules, udev);
- else
- info("device node creation supressed");
-
- if (retval == 0 && udev_run)
- udev_rules_run(udev);
-
-exit:
- udev_device_cleanup(udev);
- return 0;
-}
-
-static void exec_list(struct list_head *device_list)
-{
- struct device *loop_device;
- struct device *tmp_device;
- int i;
-
- /* handle the "first" type devices first */
- list_for_each_entry_safe(loop_device, tmp_device, device_list, node) {
- for (i = 0; first_list[i] != NULL; i++) {
- if (strncmp(loop_device->path, first_list[i], strlen(first_list[i])) == 0) {
- add_device(loop_device->path);
- list_del(&loop_device->node);
- free(loop_device);
- break;
- }
- }
- }
-
- /* handle the devices we are allowed to, excluding the "last" type devices */
- list_for_each_entry_safe(loop_device, tmp_device, device_list, node) {
- int found = 0;
- for (i = 0; last_list[i] != NULL; i++) {
- if (strncmp(loop_device->path, last_list[i], strlen(last_list[i])) == 0) {
- found = 1;
- break;
- }
- }
- if (found)
- continue;
-
- add_device(loop_device->path);
- list_del(&loop_device->node);
- free(loop_device);
- }
-
- /* handle the rest of the devices left over, if any */
- list_for_each_entry_safe(loop_device, tmp_device, device_list, node) {
- add_device(loop_device->path);
- list_del(&loop_device->node);
- free(loop_device);
- }
-}
-
-static int has_devt(const char *path)
-{
- char filename[PATH_SIZE];
- struct stat statbuf;
-
- snprintf(filename, sizeof(filename), "%s/dev", path);
- filename[sizeof(filename)-1] = '\0';
-
- if (stat(filename, &statbuf) == 0)
- return 1;
-
- return 0;
-}
-
-static void udev_scan_block(struct list_head *device_list)
-{
- char base[PATH_SIZE];
- DIR *dir;
- struct dirent *dent;
-
- snprintf(base, sizeof(base), "%s/block", sysfs_path);
- base[sizeof(base)-1] = '\0';
-
- dir = opendir(base);
- if (dir != NULL) {
- for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
- char dirname[PATH_SIZE];
- DIR *dir2;
- struct dirent *dent2;
-
- if (dent->d_name[0] == '.')
- continue;
-
- snprintf(dirname, sizeof(dirname), "%s/%s", base, dent->d_name);
- dirname[sizeof(dirname)-1] = '\0';
- if (has_devt(dirname))
- device_list_insert(dirname, device_list);
- else
- continue;
-
- /* look for partitions */
- dir2 = opendir(dirname);
- if (dir2 != NULL) {
- for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) {
- char dirname2[PATH_SIZE];
-
- if (dent2->d_name[0] == '.')
- continue;
-
- snprintf(dirname2, sizeof(dirname2), "%s/%s", dirname, dent2->d_name);
- dirname2[sizeof(dirname2)-1] = '\0';
-
- if (has_devt(dirname2))
- device_list_insert(dirname2, device_list);
- }
- closedir(dir2);
- }
- }
- closedir(dir);
- }
-}
-
-static void udev_scan_class(struct list_head *device_list)
-{
- char base[PATH_SIZE];
- DIR *dir;
- struct dirent *dent;
-
- snprintf(base, sizeof(base), "%s/class", sysfs_path);
- base[sizeof(base)-1] = '\0';
-
- dir = opendir(base);
- if (dir != NULL) {
- for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
- char dirname[PATH_SIZE];
- DIR *dir2;
- struct dirent *dent2;
-
- if (dent->d_name[0] == '.')
- continue;
-
- snprintf(dirname, sizeof(dirname), "%s/%s", base, dent->d_name);
- dirname[sizeof(dirname)-1] = '\0';
-
- dir2 = opendir(dirname);
- if (dir2 != NULL) {
- for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) {
- char dirname2[PATH_SIZE];
-
- if (dent2->d_name[0] == '.')
- continue;
-
- snprintf(dirname2, sizeof(dirname2), "%s/%s", dirname, dent2->d_name);
- dirname2[sizeof(dirname2)-1] = '\0';
-
- if (has_devt(dirname2) || strcmp(dent->d_name, "net") == 0)
- device_list_insert(dirname2, device_list);
- }
- closedir(dir2);
- }
- }
- closedir(dir);
- }
-}
-
-static void asmlinkage sig_handler(int signum)
-{
- switch (signum) {
- case SIGALRM:
- exit(1);
- case SIGINT:
- case SIGTERM:
- exit(20 + signum);
- }
-}
-
-int main(int argc, char *argv[], char *envp[])
-{
- LIST_HEAD(device_list);
- struct sigaction act;
-
- logging_init("udevstart");
- udev_config_init();
- selinux_init();
- dbg("version %s", UDEV_VERSION);
-
- udev_run_str = getenv("UDEV_RUN");
- udev_log_str = getenv("UDEV_LOG");
-
- /* disable all logging if not explicitely requested */
- if (udev_log_str == NULL)
- udev_log_priority = 0;
-
- /* set signal handlers */
- memset(&act, 0x00, sizeof(act));
- act.sa_handler = (void (*) (int))sig_handler;
- sigemptyset (&act.sa_mask);
- act.sa_flags = 0;
- sigaction(SIGALRM, &act, NULL);
- sigaction(SIGINT, &act, NULL);
- sigaction(SIGTERM, &act, NULL);
-
- /* trigger timeout to prevent hanging processes */
- alarm(UDEV_ALARM_TIMEOUT);
-
- sysfs_init();
- udev_rules_init(&rules, 1);
-
- udev_scan_class(&device_list);
- udev_scan_block(&device_list);
- exec_list(&device_list);
-
- udev_rules_cleanup(&rules);
- sysfs_cleanup();
- selinux_exit();
- logging_close();
- return 0;
-}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org