Mailinglist Archive: opensuse-commit (1116 mails)
| < Previous | Next > |
commit udev for openSUSE:Factory
- From: root@xxxxxxxxxxxxxxx (h_root)
- Date: Thu, 19 Feb 2009 23:58:29 +0100
- Message-id: <20090219225830.0DF87678157@xxxxxxxxxxxxxxx>
Hello community,
here is the log from the commit of package udev for openSUSE:Factory
checked in at Thu Feb 19 23:58:29 CET 2009.
--------
--- udev/udev.changes 2009-01-23 11:23:06.000000000 +0100
+++ udev/udev.changes 2009-02-19 00:37:31.479500000 +0100
@@ -1,0 +2,8 @@
+Wed Feb 18 23:48:50 CET 2009 - kay.sievers@xxxxxxxxxx
+
+- new upstream release 138
+- block devices are watched for metadata changes from userspace
+ like mkfs, e2label, mkswap, ...
+- add .conf to /etc/modprobe.d/pnp-aliases
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
pnp-aliases
udev-137.tar.bz2
New:
----
pnp-aliases.conf
udev-138.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ udev.spec ++++++
--- /var/tmp/diff_new_pack.z22687/_old 2009-02-19 23:57:15.000000000 +0100
+++ /var/tmp/diff_new_pack.z22687/_new 2009-02-19 23:57:15.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package udev (Version 137)
+# spec file for package udev (Version 138)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -20,7 +20,7 @@
Name: udev
Url: http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
-Version: 137
+Version: 138
Release: 1
License: GPL v2 or later
Group: System/Kernel
@@ -33,7 +33,7 @@
Source0:
ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/%{name}-%{version}.tar.bz2
Source60: boot.udev
Source61: boot.udev_retry
-Source62: pnp-aliases
+Source62: pnp-aliases.conf
%description
udev's main task is to create and remove device nodes in /dev when a
@@ -51,7 +51,7 @@
Kay Sievers <Kay.Sievers@xxxxxxxx>
%package -n libudev-devel
-License: GPL v2 only; GPL v2 or later
+License: GPL v2 or later
Summary: Development files for libudev
Group: Development/Libraries/Other
Requires: libudev0 = %{version}-%{release}
@@ -151,7 +151,7 @@
cp rules/suse/*.rules $RPM_BUILD_ROOT/lib/udev/rules.d/
install -m755 -D %{S:60} $RPM_BUILD_ROOT/etc/init.d/boot.udev
install -m755 -D %{S:61} $RPM_BUILD_ROOT/etc/init.d/boot.udev_retry
-install -m644 -D %{S:62} $RPM_BUILD_ROOT/etc/modprobe.d/pnp-aliases
+install -m644 -D %{S:62} $RPM_BUILD_ROOT/etc/modprobe.d/pnp-aliases.conf
# install initial /dev + static devices (nodes are in the files section below)
mkdir -p $RPM_BUILD_ROOT/lib/udev/devices
mkdir -p $RPM_BUILD_ROOT/lib/udev/devices/pts
@@ -238,7 +238,7 @@
%config(noreplace) %{_sysconfdir}/udev/udev.conf
%config(noreplace) %{_sysconfdir}/scsi_id.config
%dir %{_sysconfdir}/modprobe.d/
-%{_sysconfdir}/modprobe.d/pnp-aliases
+%{_sysconfdir}/modprobe.d/pnp-aliases.conf
%{_mandir}/man?/*.[0-9]*
%doc docs/writing_udev_rules
# static devices, copied to /dev at every bootup
@@ -301,6 +301,11 @@
/%{_lib}/libvolume_id.so.*
%changelog
+* Wed Feb 18 2009 kay.sievers@xxxxxxxxxx
+- new upstream release 138
+- block devices are watched for metadata changes from userspace
+ like mkfs, e2label, mkswap, ...
+- add .conf to /etc/modprobe.d/pnp-aliases
* Fri Jan 23 2009 kay.sievers@xxxxxxxxxx
- new upstream release 137
- create "tape" system group
++++++ pnp-aliases.conf ++++++
# do not edit this file, it will be overwritten on update
# installed by udev
alias acpi*:PNP0700:* floppy
++++++ udev-137.tar.bz2 -> udev-138.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/autogen.sh new/udev-138/autogen.sh
--- old/udev-137/autogen.sh 2008-12-29 00:40:58.000000000 +0100
+++ new/udev-138/autogen.sh 2009-02-05 17:58:47.000000000 +0100
@@ -6,7 +6,8 @@
-Wmissing-declarations -Wmissing-prototypes \
-Wnested-externs -Wpointer-arith \
-Wpointer-arith -Wsign-compare -Wchar-subscripts \
--Wstrict-prototypes -Wshadow"
+-Wstrict-prototypes -Wshadow \
+-Wformat=2 -Wtype-limits"
args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux"
libdir=$(basename $(cd /lib/$(gcc -print-multi-os-directory); pwd))
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/ChangeLog new/udev-138/ChangeLog
--- old/udev-137/ChangeLog 2009-01-23 03:03:22.000000000 +0100
+++ new/udev-138/ChangeLog 2009-02-19 00:26:18.000000000 +0100
@@ -1,3 +1,39 @@
+Summary of changes from v137 to v138
+============================================
+
+David Zeuthen (1):
+ *_id: add model/vendor enc strings
+
+Karel Zak (2):
+ vol_id: fix ddf version string
+ vol_id: add missing id->type to swap0
+
+Kay Sievers (13):
+ man: fix grammar
+ version bump
+ fix NAME="" logic
+ rules: dm - add escape for uuid links with whitespace
+ test: add test for empty and non-existent ATTR
+ rules: fix md "change"/"remove" handling
+ autogen.sh: add more warnings
+ fix NAME= and OPTION+="string_escape=..." logic
+ rules: move OPTIONS to separate rule
+ use global "reload_config" flag
+ rules: add "watch" option to dm and md rules
+ rules: include loop block devices in persistent links
+ release 138
+
+Matthias Schwarzott (1):
+ rules: Gentoo update
+
+Miklos Vajna (1):
+ doc: writing udev rules - refer to 'udevadm info' instead of 'udevinfo'
+
+Scott James Remnant (2):
+ udevd: optionally watch device nodes with inotify
+ rules: update persistent storage rules to use inotify watches
+
+
Summary of changes from v136 to v137
============================================
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/configure new/udev-138/configure
--- old/udev-137/configure 2009-01-15 18:45:11.000000000 +0100
+++ new/udev-138/configure 2009-02-11 20:26:03.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for udev 137.
+# Generated by GNU Autoconf 2.63 for udev 138.
#
# Report bugs to <linux-hotplug@xxxxxxxxxxxxxxx>.
#
@@ -745,8 +745,8 @@
# Identity of this package.
PACKAGE_NAME='udev'
PACKAGE_TARNAME='udev'
-PACKAGE_VERSION='137'
-PACKAGE_STRING='udev 137'
+PACKAGE_VERSION='138'
+PACKAGE_STRING='udev 138'
PACKAGE_BUGREPORT='linux-hotplug@xxxxxxxxxxxxxxx'
ac_unique_file="udev/udevd.c"
@@ -1484,7 +1484,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures udev 137 to adapt to many kinds of systems.
+\`configure' configures udev 138 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1554,7 +1554,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of udev 137:";;
+ short | recursive ) echo "Configuration of udev 138:";;
esac
cat <<\_ACEOF
@@ -1659,7 +1659,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-udev configure 137
+udev configure 138
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1673,7 +1673,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by udev $as_me 137, which was
+It was created by udev $as_me 138, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
@@ -2391,7 +2391,7 @@
# Define the identity of the package.
PACKAGE='udev'
- VERSION='137'
+ VERSION='138'
cat >>confdefs.h <<_ACEOF
@@ -11628,7 +11628,7 @@
VOLID_LT_CURRENT=1
-VOLID_LT_REVISION=8
+VOLID_LT_REVISION=9
VOLID_LT_AGE=0
@@ -12357,7 +12357,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by udev $as_me 137, which was
+This file was extended by udev $as_me 138, which was
generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -12420,7 +12420,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-udev config.status 137
+udev config.status 138
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //;
s/[\\""\`\$]/\\\\&/g'`\\"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/configure.ac new/udev-138/configure.ac
--- old/udev-137/configure.ac 2009-01-15 18:45:05.000000000 +0100
+++ new/udev-138/configure.ac 2009-01-25 21:23:13.000000000 +0100
@@ -1,5 +1,5 @@
AC_INIT([udev],
- [137],
+ [138],
[linux-hotplug@xxxxxxxxxxxxxxx])
AC_PREREQ(2.60)
AC_CONFIG_SRCDIR([udev/udevd.c])
@@ -23,7 +23,7 @@
dnl /* libvolume_id version */
VOLID_LT_CURRENT=1
-VOLID_LT_REVISION=8
+VOLID_LT_REVISION=9
VOLID_LT_AGE=0
AC_SUBST(VOLID_LT_CURRENT)
AC_SUBST(VOLID_LT_REVISION)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/docs/writing_udev_rules/index.html
new/udev-138/docs/writing_udev_rules/index.html
--- old/udev-137/docs/writing_udev_rules/index.html 2008-10-16
18:03:43.000000000 +0200
+++ new/udev-138/docs/writing_udev_rules/index.html 2009-01-24
15:24:01.000000000 +0100
@@ -52,7 +52,7 @@
<li>Finding suitable information from sysfs
<ul>
<li><a href="#sysfstree">The sysfs tree</a></li>
- <li><a href="#udevinfo">udevinfo</a></li>
+ <li><a href="#udevadm">udevadm info</a></li>
<li><a href="#sysfsalt">Alternative methods</a></li>
</ul>
</li>
@@ -429,15 +429,15 @@
Although this serves as a useful introduction as to the structure of sysfs and
exactly how udev matches values, manually trawling through sysfs is both time
consuming and unnecessary.
</p>
-<a name="udevinfo"></a>
-<h3>udevinfo</h3>
+<a name="udevadm"></a>
+<h3>udevadm info</h3>
<p>
-Enter <em>udevinfo</em>, which is probably the most straightforward tool you
can use to construct rules. All you need to know is the sysfs device path of
the device in question. A trimmed example is shown below:
+Enter <em>udevadm info</em>, which is probably the most straightforward tool
you can use to construct rules. All you need to know is the sysfs device path
of the device in question. A trimmed example is shown below:
</p>
<blockquote><pre>
-# udevinfo -a -p /sys/block/sda
+# udevadm info -a -p /sys/block/sda
<span class="green"> looking at device '/block/sda':
KERNEL=="sda"
@@ -476,7 +476,7 @@
</pre></blockquote>
<p>
-As you can see, udevinfo simply produces a list of attributes you can use
as-is as match keys in your udev rules. From the above example, I could produce
(e.g.) either of the following two rules for this device:
+As you can see, udevadm info simply produces a list of attributes you can use
as-is as match keys in your udev rules. From the above example, I could produce
(e.g.) either of the following two rules for this device:
</p>
<blockquote><pre>
@@ -495,24 +495,24 @@
</p>
<p>
-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.
+Observe the effects of hierarchy in the udevadm info 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 udevadm info suggests.
</p>
<p>
-Another point to note is that it is common for text attributes to appear in
the udevinfo output to be padded with spaces (e.g. see ST3120827AS above). In
your rules, you can either specify the extra spaces, or you can cut them off as
I have done.
+Another point to note is that it is common for text attributes to appear in
the udevadm info output to be padded with spaces (e.g. see ST3120827AS above).
In your rules, you can either specify the extra spaces, or you can cut them off
as I have done.
</p>
<p>
-The only complication with using udevinfo is that you are required to know the
top-level device path (/sys/block/sda in the example above). This is not always
obvious. However, as you are generally writing rules for device nodes which
already exist, you can use udevinfo to look up the device path for you:
+The only complication with using udevadm info is that you are required to know
the top-level device path (/sys/block/sda in the example above). This is not
always obvious. However, as you are generally writing rules for device nodes
which already exist, you can use udevadm info to look up the device path for
you:
</p>
-<blockquote><pre># udevinfo -a -p $(udevinfo -q path -n
/dev/sda)</pre></blockquote>
+<blockquote><pre># udevadm info -a -p $(udevadm info -q path -n
/dev/sda)</pre></blockquote>
<a name="sysfsalt"></a>
<h3>Alternative methods</h3>
<p>
-Although udevinfo is almost certainly the most straightforward way of listing
the exact attributes you can build rules from, some users are happier with
other tools. Utilities such as <a
href="http://www.kroah.com/linux/usb/">usbview</a> display a similar set of
information, most of which can be used in rules.
+Although udevadm info is almost certainly the most straightforward way of
listing the exact attributes you can build rules from, some users are happier
with other tools. Utilities such as <a
href="http://www.kroah.com/linux/usb/">usbview</a> display a similar set of
information, most of which can be used in rules.
</p>
<h2>Advanced topics</h2>
@@ -659,11 +659,11 @@
<h3>USB Printer</h3>
<p>
-I power on my printer, and it is assigned device node <em>/dev/lp0</em>. Not
satisfied with such a bland name, I decide to use udevinfo to aid me in writing
a rule which will provide an alternative name:
+I power on my printer, and it is assigned device node <em>/dev/lp0</em>. Not
satisfied with such a bland name, I decide to use udevadm info to aid me in
writing a rule which will provide an alternative name:
</p>
<blockquote><pre>
-# udevinfo -a -p $(udevinfo -q path -n /dev/lp0)
+# udevadm info -a -p $(udevadm info -q path -n /dev/lp0)
looking at device '/class/usb/lp0':
KERNEL=="lp0"
SUBSYSTEM=="usb"
@@ -695,7 +695,7 @@
</p>
<p>
-A common complication with USB camera devices is that they usually identify
themselves as a disk with a single partition, in this case <em>/dev/sdb</em>
with <em>/dev/sdb1</em>. The sdb node is useless to me, but sdb1 is interesting
- this is the one I want to mount. There is a problem here that because sysfs
is chained, the useful attributes which udevinfo produces for /dev/sdb1 are
identical to the ones for /dev/sdb. This results in your rule potentially
matching <u>both</u> the raw disk and the partition, which is not what you
want, your rule should be <b>specific</b>.
+A common complication with USB camera devices is that they usually identify
themselves as a disk with a single partition, in this case <em>/dev/sdb</em>
with <em>/dev/sdb1</em>. The sdb node is useless to me, but sdb1 is interesting
- this is the one I want to mount. There is a problem here that because sysfs
is chained, the useful attributes which udevadm info produces for /dev/sdb1 are
identical to the ones for /dev/sdb. This results in your rule potentially
matching <u>both</u> the raw disk and the partition, which is not what you
want, your rule should be <b>specific</b>.
</p>
<p>
@@ -703,7 +703,7 @@
</p>
<blockquote><pre>
-# udevinfo -a -p $(udevinfo -q path -n /dev/sdb1)
+# udevadm info -a -p $(udevadm info -q path -n /dev/sdb1)
looking at device '/block/sdb/sdb1':
KERNEL=="sdb1"
SUBSYSTEM=="block"
@@ -781,7 +781,7 @@
<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.
+Note that the product string seems to vary from product to product, so make
sure that you check (using udevadm info) which one applies to you.
</p>
<a name="example-cdrom"></a>
@@ -808,11 +808,11 @@
</p>
<p>
-It makes sense to simply match the MAC address of your interface in the rule,
as this is unique. However, make sure that you use the <em>exact</em> MAC
address as shown as udevinfo, because if you do not match the case exactly,
your rule will not work.
+It makes sense to simply match the MAC address of your interface in the rule,
as this is unique. However, make sure that you use the <em>exact</em> MAC
address as shown as udevadm info, because if you do not match the case exactly,
your rule will not work.
</p>
<blockquote><pre>
-# udevinfo -a -p /sys/class/net/eth0
+# udevadm info -a -p /sys/class/net/eth0
looking at class device '/sys/class/net/eth0':
KERNEL=="eth0"
ATTR{address}=="00:52:8b:d5:04:48"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/extras/ata_id/ata_id.c
new/udev-138/extras/ata_id/ata_id.c
--- old/udev-137/extras/ata_id/ata_id.c 2009-01-06 19:40:47.000000000 +0100
+++ new/udev-138/extras/ata_id/ata_id.c 2009-02-19 00:24:52.000000000 +0100
@@ -49,6 +49,7 @@
struct udev *udev;
struct hd_driveid id;
char model[41];
+ char model_enc[256];
char serial[21];
char revision[9];
const char *node = NULL;
@@ -114,6 +115,9 @@
goto close;
}
+ memcpy (model, id.model, 40);
+ model[40] = '\0';
+ udev_util_encode_string(model, model_enc, sizeof(model_enc));
udev_util_replace_whitespace((char *) id.model, model, 40);
udev_util_replace_chars(model, NULL);
udev_util_replace_whitespace((char *) id.serial_no, serial, 20);
@@ -145,6 +149,7 @@
printf("ID_TYPE=disk\n");
}
printf("ID_MODEL=%s\n", model);
+ printf("ID_MODEL_ENC=%s\n", model_enc);
printf("ID_SERIAL=%s\n", serial);
printf("ID_REVISION=%s\n", revision);
printf("ID_BUS=ata\n");
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/extras/scsi_id/scsi_id.c
new/udev-138/extras/scsi_id/scsi_id.c
--- old/udev-137/extras/scsi_id/scsi_id.c 2008-12-02 19:18:30.000000000
+0100
+++ new/udev-138/extras/scsi_id/scsi_id.c 2009-02-19 00:24:52.000000000
+0100
@@ -59,6 +59,8 @@
static int export;
static char vendor_str[64];
static char model_str[64];
+static char vendor_enc_str[256];
+static char model_enc_str[256];
static char revision_str[16];
static char type_str[16];
@@ -501,6 +503,9 @@
if (retval)
return retval;
+ udev_util_encode_string(dev_scsi->vendor, vendor_enc_str,
sizeof(vendor_enc_str));
+ udev_util_encode_string(dev_scsi->model, model_enc_str,
sizeof(model_enc_str));
+
udev_util_replace_whitespace(dev_scsi->vendor, vendor_str,
sizeof(vendor_str));
udev_util_replace_chars(vendor_str, NULL);
udev_util_replace_whitespace(dev_scsi->model, model_str,
sizeof(model_str));
@@ -569,7 +574,9 @@
char serial_str[MAX_SERIAL_LEN];
printf("ID_VENDOR=%s\n", vendor_str);
+ printf("ID_VENDOR_ENC=%s\n", vendor_enc_str);
printf("ID_MODEL=%s\n", model_str);
+ printf("ID_MODEL_ENC=%s\n", model_enc_str);
printf("ID_REVISION=%s\n", revision_str);
printf("ID_TYPE=%s\n", type_str);
if (dev_scsi.serial[0] != '\0') {
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/extras/usb_id/usb_id.c
new/udev-138/extras/usb_id/usb_id.c
--- old/udev-137/extras/usb_id/usb_id.c 2009-01-22 19:23:17.000000000 +0100
+++ new/udev-138/extras/usb_id/usb_id.c 2009-02-19 00:24:52.000000000 +0100
@@ -38,6 +38,8 @@
static char vendor_str[64];
static char model_str[64];
+static char model_str_enc[256];
+static char vendor_str_enc[256];
static char serial_str[UTIL_NAME_SIZE];
static char revision_str[64];
static char type_str[64];
@@ -251,6 +253,7 @@
udev_device_get_sysname(dev_scsi));
goto fallback;
}
+ udev_util_encode_string(scsi_vendor, vendor_str_enc,
sizeof(vendor_str_enc));
udev_util_replace_whitespace(scsi_vendor, vendor_str,
sizeof(vendor_str)-1);
udev_util_replace_chars(vendor_str, NULL);
@@ -260,6 +263,7 @@
udev_device_get_sysname(dev_scsi));
goto fallback;
}
+ udev_util_encode_string(scsi_model, model_str_enc,
sizeof(model_str_enc));
udev_util_replace_whitespace(scsi_model, model_str,
sizeof(model_str)-1);
udev_util_replace_chars(model_str, NULL);
@@ -302,6 +306,7 @@
info(udev, "No USB vendor information available\n");
return 1;
}
+ udev_util_encode_string(usb_vendor, vendor_str_enc,
sizeof(vendor_str_enc));
udev_util_replace_whitespace(usb_vendor, vendor_str,
sizeof(vendor_str)-1);
udev_util_replace_chars(vendor_str, NULL);
}
@@ -319,6 +324,7 @@
dbg(udev, "No USB model information available\n");
return 1;
}
+ udev_util_encode_string(usb_model, model_str_enc,
sizeof(model_str_enc));
udev_util_replace_whitespace(usb_model, model_str,
sizeof(model_str)-1);
udev_util_replace_chars(model_str, NULL);
}
@@ -439,7 +445,9 @@
if (export) {
printf("ID_VENDOR=%s\n", vendor_str);
+ printf("ID_VENDOR_ENC=%s\n", vendor_str_enc);
printf("ID_MODEL=%s\n", model_str);
+ printf("ID_MODEL_ENC=%s\n", model_str_enc);
printf("ID_REVISION=%s\n", revision_str);
printf("ID_SERIAL=%s\n", serial);
if (serial_str[0] != '\0')
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/extras/volume_id/lib/ddf_raid.c
new/udev-138/extras/volume_id/lib/ddf_raid.c
--- old/udev-137/extras/volume_id/lib/ddf_raid.c 2008-10-16
18:03:43.000000000 +0200
+++ new/udev-138/extras/volume_id/lib/ddf_raid.c 2009-01-24
15:20:37.000000000 +0100
@@ -87,7 +87,7 @@
return -1;
found:
volume_id_set_uuid(id, ddf->guid, DDF_GUID_LENGTH, UUID_STRING);
- snprintf(id->type_version, DDF_REV_LENGTH, "%s", ddf->ddf_rev);
+ snprintf(id->type_version, DDF_REV_LENGTH + 1, "%s", ddf->ddf_rev);
volume_id_set_usage(id, VOLUME_ID_RAID);
id->type = "ddf_raid_member";
return 0;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/extras/volume_id/lib/linux_swap.c
new/udev-138/extras/volume_id/lib/linux_swap.c
--- old/udev-137/extras/volume_id/lib/linux_swap.c 2008-11-13
19:30:38.000000000 +0100
+++ new/udev-138/extras/volume_id/lib/linux_swap.c 2009-01-24
15:21:15.000000000 +0100
@@ -57,6 +57,7 @@
return -1;
if (memcmp(buf, "SWAP-SPACE", 10) == 0) {
+ id->type = "swap";
strcpy(id->type_version, "1");
goto found;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/NEWS new/udev-138/NEWS
--- old/udev-137/NEWS 2009-01-21 14:43:22.000000000 +0100
+++ new/udev-138/NEWS 2009-02-17 09:57:29.000000000 +0100
@@ -1,3 +1,11 @@
+udev 138
+========
+Bugfixes.
+
+Device nodes can be watched for changes with inotify with OPTIONS="watch".
+If closed after being opened for writing, a "change" uevent will occur.
+/dev/disk/by-{label,uuid}/* symlinks will be automatically updated.
+
udev 137
========
Bugfixes.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/rules/gentoo/40-gentoo.rules
new/udev-138/rules/gentoo/40-gentoo.rules
--- old/udev-137/rules/gentoo/40-gentoo.rules 2008-10-16 18:03:43.000000000
+0200
+++ new/udev-138/rules/gentoo/40-gentoo.rules 2009-01-27 11:55:41.000000000
+0100
@@ -1,12 +1,25 @@
# do not edit this file, it will be overwritten on update
-# capi devices
-KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20"
-KERNEL=="capi*", NAME="capi/%n"
-
# old devfs path, removing this could break systems
# Bug 195839
KERNEL=="md[0-9]*", SYMLINK+="md/%n"
KERNEL=="loop[0-9]*", SYMLINK+="loop/%n"
KERNEL=="ram[0-9]*", SYMLINK+="rd/%n"
+# keep devices after driver unload
+KERNEL=="ppp", OPTIONS+="ignore_remove"
+KERNEL=="tun", OPTIONS+="ignore_remove"
+
+
+# setting permissions
+SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usb"
+
+# dialout devices
+KERNEL=="ippp*|isdn*|dcbri*|rfcomm*|ttyACM[0-9]*|pilot", GROUP="dialout"
+
+# sound devices (oss)
+SUBSYSTEM=="snd", GROUP="audio"
+
+# Sony Vaio Jogdial sonypi device
+KERNEL=="sonypi", MODE="0666"
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/rules/gentoo/65-permissions.rules
new/udev-138/rules/gentoo/65-permissions.rules
--- old/udev-137/rules/gentoo/65-permissions.rules 2008-10-16
18:03:43.000000000 +0200
+++ new/udev-138/rules/gentoo/65-permissions.rules 1970-01-01
01:00:00.000000000 +0100
@@ -1,26 +0,0 @@
-# do not edit this file, it will be overwritten on update
-
-SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usb", MODE="664"
-
-# cdrom devices
-ENV{ID_CDROM}=="?*", GROUP="cdrom", MODE="660"
-KERNEL=="pktcdvd|pktcdvd[0-9]*", GROUP="cdrom", MODE="660"
-# assign cdrom-permission also to associated generic device (for cd-burning
...)
-SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="[45]", GROUP="cdrom",
MODE="660"
-
-
-# tape devices
-KERNEL=="st[0-9]*|nst[0-9]*|ht[0-9]*|nht[0-9]*|pt[0-9]*|npt[0-9]*", \
- GROUP="tape", MODE="660"
-SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="[18]", GROUP="tape",
MODE="660"
-
-# dialout devices
-KERNEL=="ippp*|isdn*|dcbri*|capi*|rfcomm*|ttyACM[0-9]*", GROUP="uucp"
-KERNEL=="pilot", GROUP="uucp"
-
-# sound devices (sound=alsa, snd=oss)
-SUBSYSTEM=="sound|snd", GROUP="audio"
-
-# Sony Vaio Jogdial sonypi device
-KERNEL=="sonypi", MODE="0666"
-
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/rules/packages/64-md-raid.rules
new/udev-138/rules/packages/64-md-raid.rules
--- old/udev-137/rules/packages/64-md-raid.rules 2008-11-06
08:01:15.000000000 +0100
+++ new/udev-138/rules/packages/64-md-raid.rules 2009-02-13
16:02:28.000000000 +0100
@@ -11,6 +11,7 @@
# container devices have a metadata version of e.g. 'external:ddf' and
# never leave state 'inactive'
ATTR{md/metadata_version}=="external:[A-Za-z]*",
ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
+TEST!="md/array_state", GOTO="md_end"
ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"
LABEL="md_ignore_state"
@@ -25,6 +26,7 @@
IMPORT{program}="vol_id --export $tempnode"
OPTIONS+="link_priority=100"
+OPTIONS+="watch"
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*",
SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*",
SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/rules/rules.d/60-persistent-storage.rules
new/udev-138/rules/rules.d/60-persistent-storage.rules
--- old/udev-137/rules/rules.d/60-persistent-storage.rules 2008-12-02
15:12:32.000000000 +0100
+++ new/udev-138/rules/rules.d/60-persistent-storage.rules 2009-02-15
17:27:59.000000000 +0100
@@ -10,7 +10,7 @@
SUBSYSTEM!="block", GOTO="persistent_storage_end"
# skip rules for inappropriate block devices
-KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*|btibm*",
GOTO="persistent_storage_end"
+KERNEL=="ram*|fd*|nbd*|gnbd*|dm-*|md*|btibm*", GOTO="persistent_storage_end"
# never access non-cdrom removable ide devices, the drivers are causing event
loops on open()
KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy",
GOTO="persistent_storage_end"
@@ -60,6 +60,9 @@
# probe filesystem metadata of disks
KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode"
+# watch for future changes
+KERNEL!="sr*", OPTIONS+="watch"
+
# by-label/by-uuid links (filesystem metadata)
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*",
SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*",
SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/rules/suse/64-device-mapper.rules
new/udev-138/rules/suse/64-device-mapper.rules
--- old/udev-137/rules/suse/64-device-mapper.rules 2008-10-16
18:03:43.000000000 +0200
+++ new/udev-138/rules/suse/64-device-mapper.rules 2009-02-13
16:00:04.000000000 +0100
@@ -9,13 +9,14 @@
ENV{DM_NAME}!="?*", GOTO="device_mapper_end"
SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}", OPTIONS+="string_escape=replace"
-ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}"
+ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}",
OPTIONS+="string_escape=replace"
ENV{DM_STATE}=="SUSPENDED", GOTO="device_mapper_end"
ENV{DM_TARGET_TYPES}=="|*error*", GOTO="device_mapper_end"
IMPORT{program}="vol_id --export $tempnode"
OPTIONS+="link_priority=-100"
+OPTIONS+="watch"
ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS+="link_priority=-90"
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*",
SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*",
SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/udev/Makefile.am new/udev-138/udev/Makefile.am
--- old/udev-137/udev/Makefile.am 2008-12-05 16:31:32.000000000 +0100
+++ new/udev-138/udev/Makefile.am 2009-02-11 19:27:48.000000000 +0100
@@ -16,6 +16,7 @@
udev.h \
udev-sysdeps.h \
udev-event.c \
+ udev-watch.c \
udev-node.c \
udev-rules.c \
udev-util.c \
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/udev/Makefile.in new/udev-138/udev/Makefile.in
--- old/udev-137/udev/Makefile.in 2009-01-15 18:45:10.000000000 +0100
+++ new/udev-138/udev/Makefile.in 2009-02-11 20:26:05.000000000 +0100
@@ -55,20 +55,20 @@
sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(noinst_PROGRAMS) $(sbin_PROGRAMS)
am__test_udev_SOURCES_DIST = udev.h udev-sysdeps.h udev-event.c \
- udev-node.c udev-rules.c udev-util.c lib/libudev.h \
- lib/libudev-private.h lib/libudev.c lib/libudev-list.c \
- lib/libudev-util.c lib/libudev-device.c \
+ udev-watch.c udev-node.c udev-rules.c udev-util.c \
+ lib/libudev.h lib/libudev-private.h lib/libudev.c \
+ lib/libudev-list.c lib/libudev-util.c lib/libudev-device.c \
lib/libudev-device-db-write.c lib/libudev-monitor.c \
lib/libudev-enumerate.c lib/libudev-queue.c lib/libudev-ctrl.c \
udev-selinux.c test-udev.c
@USE_SELINUX_TRUE@am__objects_1 = udev-selinux.$(OBJEXT)
-am__objects_2 = udev-event.$(OBJEXT) udev-node.$(OBJEXT) \
- udev-rules.$(OBJEXT) udev-util.$(OBJEXT) libudev.$(OBJEXT) \
- libudev-list.$(OBJEXT) libudev-util.$(OBJEXT) \
- libudev-device.$(OBJEXT) libudev-device-db-write.$(OBJEXT) \
- libudev-monitor.$(OBJEXT) libudev-enumerate.$(OBJEXT) \
- libudev-queue.$(OBJEXT) libudev-ctrl.$(OBJEXT) \
- $(am__objects_1)
+am__objects_2 = udev-event.$(OBJEXT) udev-watch.$(OBJEXT) \
+ udev-node.$(OBJEXT) udev-rules.$(OBJEXT) udev-util.$(OBJEXT) \
+ libudev.$(OBJEXT) libudev-list.$(OBJEXT) \
+ libudev-util.$(OBJEXT) libudev-device.$(OBJEXT) \
+ libudev-device-db-write.$(OBJEXT) libudev-monitor.$(OBJEXT) \
+ libudev-enumerate.$(OBJEXT) libudev-queue.$(OBJEXT) \
+ libudev-ctrl.$(OBJEXT) $(am__objects_1)
am_test_udev_OBJECTS = $(am__objects_2) test-udev.$(OBJEXT)
test_udev_OBJECTS = $(am_test_udev_OBJECTS)
am__DEPENDENCIES_1 =
@@ -76,9 +76,9 @@
am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2)
test_udev_DEPENDENCIES = $(am__DEPENDENCIES_3)
am__udevadm_SOURCES_DIST = udev.h udev-sysdeps.h udev-event.c \
- udev-node.c udev-rules.c udev-util.c lib/libudev.h \
- lib/libudev-private.h lib/libudev.c lib/libudev-list.c \
- lib/libudev-util.c lib/libudev-device.c \
+ udev-watch.c udev-node.c udev-rules.c udev-util.c \
+ lib/libudev.h lib/libudev-private.h lib/libudev.c \
+ lib/libudev-list.c lib/libudev-util.c lib/libudev-device.c \
lib/libudev-device-db-write.c lib/libudev-monitor.c \
lib/libudev-enumerate.c lib/libudev-queue.c lib/libudev-ctrl.c \
udev-selinux.c udevadm.c udevadm-info.c udevadm-control.c \
@@ -91,9 +91,9 @@
udevadm_OBJECTS = $(am_udevadm_OBJECTS)
udevadm_DEPENDENCIES = $(am__DEPENDENCIES_3)
am__udevd_SOURCES_DIST = udev.h udev-sysdeps.h udev-event.c \
- udev-node.c udev-rules.c udev-util.c lib/libudev.h \
- lib/libudev-private.h lib/libudev.c lib/libudev-list.c \
- lib/libudev-util.c lib/libudev-device.c \
+ udev-watch.c udev-node.c udev-rules.c udev-util.c \
+ lib/libudev.h lib/libudev-private.h lib/libudev.c \
+ lib/libudev-list.c lib/libudev-util.c lib/libudev-device.c \
lib/libudev-device-db-write.c lib/libudev-monitor.c \
lib/libudev-enumerate.c lib/libudev-queue.c lib/libudev-ctrl.c \
udev-selinux.c udevd.c
@@ -267,12 +267,13 @@
lib
common_ldadd = $(am__append_2)
-common_files = udev.h udev-sysdeps.h udev-event.c udev-node.c \
- udev-rules.c udev-util.c lib/libudev.h lib/libudev-private.h \
- lib/libudev.c lib/libudev-list.c lib/libudev-util.c \
- lib/libudev-device.c lib/libudev-device-db-write.c \
- lib/libudev-monitor.c lib/libudev-enumerate.c \
- lib/libudev-queue.c lib/libudev-ctrl.c $(am__append_1)
+common_files = udev.h udev-sysdeps.h udev-event.c udev-watch.c \
+ udev-node.c udev-rules.c udev-util.c lib/libudev.h \
+ lib/libudev-private.h lib/libudev.c lib/libudev-list.c \
+ lib/libudev-util.c lib/libudev-device.c \
+ lib/libudev-device-db-write.c lib/libudev-monitor.c \
+ lib/libudev-enumerate.c lib/libudev-queue.c lib/libudev-ctrl.c \
+ $(am__append_1)
udevd_SOURCES = \
$(common_files) \
udevd.c
@@ -412,6 +413,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udev-rules.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udev-selinux.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udev-util.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udev-watch.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udevadm-control.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udevadm-info.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udevadm-monitor.Po@am__quote@
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/udev/udev.7 new/udev-138/udev/udev.7
--- old/udev-137/udev/udev.7 2009-01-16 21:33:53.000000000 +0100
+++ new/udev-138/udev/udev.7 2009-02-11 20:26:33.000000000 +0100
@@ -221,7 +221,7 @@
.PP
A matching rule may specify the name of the device node, add a symlink
pointing to the node, or run a specified program as part of the event
handling\&. If no matching rule is found, the default device node name is
used\&.
.PP
-A rule may consist of a list of one or more key value pairs separated by a
comma\&. Each key has a distinct operation, depending on the used operator\&.
Valid operators are:
+A rule consists of a list of one or more key value pairs separated by a
comma\&. Each key has a distinct operation, depending on the used operator\&.
Valid operators are:
.PP
\fB==\fR
.RS 4
@@ -230,7 +230,7 @@
.PP
\fB!=\fR
.RS 4
-Compare for non\-equality\&.
+Compare for inequality\&.
.RE
.PP
\fB=\fR
@@ -461,6 +461,11 @@
.RS 4
Usually control and other possibly unsafe characters are replaced in strings
used for device naming\&. The mode of replacement can be specified with this
option\&.
.RE
+.PP
+\fBwatch\fR
+.RS 4
+Watch the device node with inotify, when closed after being opened for
writing, a change uevent will be synthesised\&.
+.RE
.RE
.PP
The
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/udev/udevadm-settle.c
new/udev-138/udev/udevadm-settle.c
--- old/udev-137/udev/udevadm-settle.c 2009-01-23 02:18:19.000000000 +0100
+++ new/udev-138/udev/udevadm-settle.c 2009-01-31 20:00:56.000000000 +0100
@@ -84,6 +84,8 @@
break;
usleep(1000 * 1000 / LOOP_PER_SECOND);
}
+
+ /* if we reached the timeout, print the list of remaining events */
if (loop <= 0) {
struct udev_list_entry *list_entry;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/udev/udevd.c new/udev-138/udev/udevd.c
--- old/udev-137/udev/udevd.c 2009-01-21 23:22:22.000000000 +0100
+++ new/udev-138/udev/udevd.c 2009-02-11 21:04:47.000000000 +0100
@@ -65,7 +65,6 @@
static struct udev_rules *rules;
static struct udev_ctrl *udev_ctrl;
static struct udev_monitor *kernel_monitor;
-static int inotify_fd = -1;
static volatile int sigchilds_waiting;
static volatile int udev_exit;
static volatile int reload_config;
@@ -195,8 +194,6 @@
/* child */
udev_monitor_unref(kernel_monitor);
udev_ctrl_unref(udev_ctrl);
- if (inotify_fd >= 0)
- close(inotify_fd);
logging_close();
logging_init("udevd-event");
setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY);
@@ -513,6 +510,57 @@
udev_ctrl_msg_unref(ctrl_msg);
}
+/* read inotify messages */
+static int handle_inotify(struct udev *udev)
+{
+ int nbytes, pos;
+ char *buf;
+ struct inotify_event *ev;
+
+ if ((ioctl(inotify_fd, FIONREAD, &nbytes) < 0) || (nbytes <= 0))
+ return 0;
+
+ buf = malloc(nbytes);
+ if (buf == NULL) {
+ err(udev, "error getting buffer for inotify, disable
watching\n");
+ close(inotify_fd);
+ inotify_fd = -1;
+ return 0;
+ }
+
+ read(inotify_fd, buf, nbytes);
+
+ for (pos = 0, ev = (struct inotify_event *)(buf + pos); pos < nbytes;
pos += sizeof(struct inotify_event) + ev->len) {
+ const char *syspath;
+
+ dbg(udev, "inotify event: %x for %d (%s)\n", ev->mask, ev->wd,
ev->len ? ev->name : "*");
+
+ syspath = udev_watch_lookup(udev, ev->wd);
+ if (syspath != NULL) {
+ dbg(udev, "inotify event: %x for %s\n", ev->mask,
syspath);
+ if (ev->mask & IN_CLOSE_WRITE) {
+ char filename[UTIL_PATH_SIZE];
+ int fd;
+
+ info(udev, "device %s closed, synthesising
'change'\n", syspath);
+ util_strlcpy(filename, syspath,
sizeof(filename));
+ util_strlcat(filename, "/uevent",
sizeof(filename));
+ fd = open(filename, O_WRONLY);
+ if (fd < 0 || write(fd, "change", 6) < 0)
+ info(udev, "error writing uevent:
%m\n");
+ close(fd);
+ }
+ if (ev->mask & IN_IGNORED)
+ udev_watch_end(udev, ev->wd);
+ } else {
+ reload_config = 1;
+ }
+ }
+
+ free (buf);
+ return 0;
+}
+
static void asmlinkage sig_handler(int signum)
{
switch (signum) {
@@ -838,7 +886,7 @@
sigaction(SIGHUP, &act, NULL);
/* watch rules directory */
- inotify_fd = inotify_init();
+ udev_watch_init(udev);
if (inotify_fd >= 0) {
if (udev_get_rules_path(udev) != NULL) {
inotify_add_watch(inotify_fd, udev_get_rules_path(udev),
@@ -857,10 +905,9 @@
inotify_add_watch(inotify_fd, filename,
IN_CREATE | IN_DELETE | IN_MOVE |
IN_CLOSE_WRITE);
}
- } else if (errno == ENOSYS)
- info(udev, "unable to use inotify, udevd will not monitor rule
files changes\n");
- else
- err(udev, "inotify_init failed: %m\n");
+
+ udev_watch_restore(udev);
+ }
/* in trace mode run one event after the other */
if (debug_trace) {
@@ -936,24 +983,8 @@
}
/* rules directory inotify watch */
- if (inotify_poll && (inotify_poll->revents & POLLIN)) {
- int nbytes;
-
- /* discard all possible events, we can just reload the
config */
- if ((ioctl(inotify_fd, FIONREAD, &nbytes) == 0) &&
nbytes > 0) {
- char *buf;
-
- reload_config = 1;
- buf = malloc(nbytes);
- if (buf == NULL) {
- err(udev, "error getting buffer for
inotify, disable watching\n");
- close(inotify_fd);
- inotify_fd = -1;
- }
- read(inotify_fd, buf, nbytes);
- free(buf);
- }
- }
+ if (inotify_poll && (inotify_poll->revents & POLLIN))
+ handle_inotify(udev);
handle_signals:
signal_received = 0;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/udev/udev-event.c
new/udev-138/udev/udev-event.c
--- old/udev-137/udev/udev-event.c 2009-01-21 10:28:36.000000000 +0100
+++ new/udev-138/udev/udev-event.c 2009-02-11 19:27:48.000000000 +0100
@@ -600,6 +600,14 @@
/* create new node and symlinks */
err = udev_node_add(dev, event->mode, event->uid, event->gid);
+
+ /* watch for changes */
+ if (event->inotify_watch && inotify_fd != -1) {
+ info(event->udev, "device will be watched for
changes\n");
+ udev_watch_begin(event->udev, event->dev);
+ } else {
+ udev_watch_clear(event->udev, event->dev);
+ }
goto exit;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/udev/udev.h new/udev-138/udev/udev.h
--- old/udev-137/udev/udev.h 2009-01-15 20:05:23.000000000 +0100
+++ new/udev-138/udev/udev.h 2009-02-11 19:27:48.000000000 +0100
@@ -75,9 +75,16 @@
unsigned int devlink_final:1;
unsigned int run_final:1;
unsigned int ignore_device:1;
+ unsigned int inotify_watch:1;
unsigned int trace:1;
};
+struct udev_watch {
+ struct udev_list_node node;
+ int handle;
+ char *name;
+};
+
/* udev-rules.c */
struct udev_rules;
extern struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names);
@@ -93,6 +100,15 @@
extern int udev_event_apply_subsys_kernel(struct udev_event *event, const char
*string,
char *result, size_t maxsize, int
read_value);
+/* udev-watch.c */
+extern int inotify_fd;
+extern void udev_watch_init(struct udev *udev);
+extern void udev_watch_restore(struct udev *udev);
+extern void udev_watch_begin(struct udev *udev, struct udev_device *dev);
+extern void udev_watch_clear(struct udev *udev, struct udev_device *dev);
+extern void udev_watch_end(struct udev *udev, int wd);
+extern const char *udev_watch_lookup(struct udev *udev, int wd);
+
/* udev-node.c */
extern int udev_node_mknod(struct udev_device *dev, const char *file, dev_t
devnum, mode_t mode, uid_t uid, gid_t gid);
extern int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid,
gid_t gid);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/udev/udev-rules.c
new/udev-138/udev/udev-rules.c
--- old/udev-137/udev/udev-rules.c 2009-01-21 14:40:00.000000000 +0100
+++ new/udev-138/udev/udev-rules.c 2009-02-11 19:27:48.000000000 +0100
@@ -140,6 +140,7 @@
TK_A_IGNORE_DEVICE,
TK_A_STRING_ESCAPE_NONE,
TK_A_STRING_ESCAPE_REPLACE,
+ TK_A_INOTIFY_WATCH,
TK_A_NUM_FAKE_PART, /* int */
TK_A_DEVLINK_PRIO, /* int */
TK_A_OWNER, /* val */
@@ -270,6 +271,7 @@
[TK_A_IGNORE_DEVICE] = "A IGNORE_DEVICE",
[TK_A_STRING_ESCAPE_NONE] = "A STRING_ESCAPE_NONE",
[TK_A_STRING_ESCAPE_REPLACE] = "A STRING_ESCAPE_REPLACE",
+ [TK_A_INOTIFY_WATCH] = "A INOTIFY_WATCH",
[TK_A_NUM_FAKE_PART] = "A NUM_FAKE_PART",
[TK_A_DEVLINK_PRIO] = "A DEVLINK_PRIO",
[TK_A_OWNER] = "A OWNER",
@@ -352,6 +354,7 @@
case TK_A_IGNORE_DEVICE:
case TK_A_STRING_ESCAPE_NONE:
case TK_A_STRING_ESCAPE_REPLACE:
+ case TK_A_INOTIFY_WATCH:
case TK_A_LAST_RULE:
case TK_A_IGNORE_REMOVE:
dbg(rules->udev, "%s\n", token_str(type));
@@ -1020,6 +1023,7 @@
case TK_A_IGNORE_DEVICE:
case TK_A_STRING_ESCAPE_NONE:
case TK_A_STRING_ESCAPE_REPLACE:
+ case TK_A_INOTIFY_WATCH:
case TK_A_IGNORE_REMOVE:
case TK_A_LAST_RULE:
break;
@@ -1131,7 +1135,6 @@
static int add_rule(struct udev_rules *rules, char *line,
const char *filename, unsigned int filename_off, unsigned
int lineno)
{
- int valid = 0;
char *linepos;
char *attr;
int physdev = 0;
@@ -1159,7 +1162,6 @@
goto invalid;
}
rule_add_key(&rule_tmp, TK_M_ACTION, op, value, NULL);
- valid = 1;
continue;
}
@@ -1169,7 +1171,6 @@
goto invalid;
}
rule_add_key(&rule_tmp, TK_M_DEVPATH, op, value, NULL);
- valid = 1;
continue;
}
@@ -1179,7 +1180,6 @@
goto invalid;
}
rule_add_key(&rule_tmp, TK_M_KERNEL, op, value, NULL);
- valid = 1;
continue;
}
@@ -1198,7 +1198,6 @@
rule_add_key(&rule_tmp, TK_M_SUBSYSTEM, op,
"subsystem|class|bus", NULL);
} else
rule_add_key(&rule_tmp, TK_M_SUBSYSTEM, op,
value, NULL);
- valid = 1;
continue;
}
@@ -1208,7 +1207,6 @@
goto invalid;
}
rule_add_key(&rule_tmp, TK_M_DRIVER, op, value, NULL);
- valid = 1;
continue;
}
@@ -1223,7 +1221,6 @@
} else {
rule_add_key(&rule_tmp, TK_A_ATTR, op, value,
attr);
}
- valid = 1;
continue;
}
@@ -1234,7 +1231,6 @@
goto invalid;
}
rule_add_key(&rule_tmp, TK_M_KERNELS, op, value, NULL);
- valid = 1;
continue;
}
@@ -1245,7 +1241,6 @@
goto invalid;
}
rule_add_key(&rule_tmp, TK_M_SUBSYSTEMS, op, value,
NULL);
- valid = 1;
continue;
}
@@ -1255,7 +1250,6 @@
goto invalid;
}
rule_add_key(&rule_tmp, TK_M_DRIVERS, op, value, NULL);
- valid = 1;
continue;
}
@@ -1277,7 +1271,6 @@
err(rules->udev, "do not reference parent sysfs
directories directly, "
"it may break with a future kernel, please
fix it in %s:%u", filename, lineno);
rule_add_key(&rule_tmp, TK_M_ATTRS, op, value, attr);
- valid = 1;
continue;
}
@@ -1296,13 +1289,11 @@
if (rule_add_key(&rule_tmp, TK_A_ENV, op,
value, attr) != 0)
goto invalid;
}
- valid = 1;
continue;
}
if (strcasecmp(key, "PROGRAM") == 0) {
rule_add_key(&rule_tmp, TK_M_PROGRAM, op, value, NULL);
- valid = 1;
continue;
}
@@ -1312,7 +1303,6 @@
goto invalid;
}
rule_add_key(&rule_tmp, TK_M_RESULT, op, value, NULL);
- valid = 1;
continue;
}
@@ -1321,15 +1311,12 @@
if (attr != NULL && strstr(attr, "program")) {
dbg(rules->udev, "IMPORT will be executed\n");
rule_add_key(&rule_tmp, TK_M_IMPORT_PROG, op,
value, NULL);
- valid = 1;
} else if (attr != NULL && strstr(attr, "file")) {
dbg(rules->udev, "IMPORT will be included as
file\n");
rule_add_key(&rule_tmp, TK_M_IMPORT_FILE, op,
value, NULL);
- valid = 1;
} else if (attr != NULL && strstr(attr, "parent")) {
dbg(rules->udev, "IMPORT will include the
parent values\n");
rule_add_key(&rule_tmp, TK_M_IMPORT_PARENT, op,
value, NULL);
- valid = 1;
} else {
/* figure it out if it is executable */
char file[UTIL_PATH_SIZE];
@@ -1354,11 +1341,9 @@
if (!lstat(file, &statbuf) && (statbuf.st_mode
& S_IXUSR)) {
dbg(rules->udev, "IMPORT will be
executed (autotype)\n");
rule_add_key(&rule_tmp,
TK_M_IMPORT_PROG, op, value, NULL);
- valid = 1;
} else {
dbg(rules->udev, "IMPORT will be
included as file (autotype)\n");
rule_add_key(&rule_tmp,
TK_M_IMPORT_FILE, op, value, NULL);
- valid = 1;
}
}
continue;
@@ -1378,7 +1363,6 @@
} else {
rule_add_key(&rule_tmp, TK_M_TEST, op, value,
NULL);
}
- valid = 1;
continue;
}
@@ -1389,26 +1373,22 @@
if (attr != NULL && strstr(attr, "ignore_error"))
flag = 1;
rule_add_key(&rule_tmp, TK_A_RUN, op, value, &flag);
- valid = 1;
continue;
}
if (strcasecmp(key, "WAIT_FOR") == 0 || strcasecmp(key,
"WAIT_FOR_SYSFS") == 0) {
rule_add_key(&rule_tmp, TK_M_WAITFOR, 0, value, NULL);
- valid = 1;
waitfor = 1;
continue;
}
if (strcasecmp(key, "LABEL") == 0) {
rule_tmp.rule.rule.label_off = add_string(rules, value);
- valid = 1;
continue;
}
if (strcasecmp(key, "GOTO") == 0) {
rule_add_key(&rule_tmp, TK_A_GOTO, 0, value, NULL);
- valid = 1;
continue;
}
@@ -1417,7 +1397,7 @@
rule_add_key(&rule_tmp, TK_M_NAME, op, value,
NULL);
} else {
if (value[0] == '\0')
- dbg(rules->udev, "name empty, node
creation suppressed\n");
+ info(rules->udev, "name empty, node
creation suppressed\n");
rule_add_key(&rule_tmp, TK_A_NAME, op, value,
NULL);
attr = get_key_attribute(rules->udev, key +
sizeof("NAME")-1);
if (attr != NULL) {
@@ -1443,7 +1423,6 @@
else
rule_add_key(&rule_tmp, TK_A_DEVLINK, op,
value, NULL);
rule_tmp.rule.rule.flags = 1;
- valid = 1;
continue;
}
@@ -1461,7 +1440,6 @@
rule_add_key(&rule_tmp, TK_A_OWNER, op, value,
NULL);
}
rule_tmp.rule.rule.flags = 1;
- valid = 1;
continue;
}
@@ -1479,7 +1457,6 @@
rule_add_key(&rule_tmp, TK_A_GROUP, op, value,
NULL);
}
rule_tmp.rule.rule.flags = 1;
- valid = 1;
continue;
}
@@ -1493,7 +1470,6 @@
else
rule_add_key(&rule_tmp, TK_A_MODE, op, value,
NULL);
rule_tmp.rule.rule.flags = 1;
- valid = 1;
continue;
}
@@ -1540,7 +1516,11 @@
rule_add_key(&rule_tmp, TK_A_NUM_FAKE_PART, 0,
NULL, &num);
dbg(rules->udev, "creation of partition nodes
requested\n");
}
- valid = 1;
+ pos = strstr(value, "watch");
+ if (pos != NULL) {
+ rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, 0,
NULL, NULL);
+ dbg(rules->udev, "inotify watch of device
requested\n");
+ }
continue;
}
err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename,
lineno);
@@ -1550,10 +1530,6 @@
err(rules->udev, "PHYSDEV* values are deprecated and not
available on recent kernels, "
"please fix it in %s:%u\n", filename, lineno);
- /* skip line if no valid key was found */
- if (!valid)
- goto invalid;
-
/* add rule token */
rule_tmp.rule.rule.token_count = 1 + rule_tmp.token_cur;
if (add_token(rules, &rule_tmp.rule) != 0)
@@ -2277,6 +2253,9 @@
break;
udev_device_set_num_fake_partitions(event->dev,
cur->key.num_fake_part);
break;
+ case TK_A_INOTIFY_WATCH:
+ event->inotify_watch = 1;
+ break;
case TK_A_DEVLINK_PRIO:
udev_device_set_devlink_priority(event->dev,
cur->key.devlink_prio);
break;
@@ -2398,24 +2377,19 @@
break;
if (cur->key.op == OP_ASSIGN_FINAL)
event->name_final = 1;
- if (name[0] == '\0') {
- free(event->name);
- event->name = NULL;
- break;
- }
util_strlcpy(name_str, name, sizeof(name_str));
udev_event_apply_format(event, name_str,
sizeof(name_str));
if (esc == ESCAPE_UNSET || esc ==
ESCAPE_REPLACE) {
count =
udev_util_replace_chars(name_str, "/");
if (count > 0)
info(event->udev, "%i
character(s) replaced\n", count);
- free(event->name);
- event->name = strdup(name_str);
- info(event->udev, "NAME '%s' %s:%u\n",
- event->name,
-
&rules->buf[rule->rule.filename_off],
- rule->rule.filename_line);
}
+ free(event->name);
+ event->name = strdup(name_str);
+ info(event->udev, "NAME '%s' %s:%u\n",
+ event->name,
+ &rules->buf[rule->rule.filename_off],
+ rule->rule.filename_line);
break;
}
case TK_A_DEVLINK:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/udev/udev-watch.c
new/udev-138/udev/udev-watch.c
--- old/udev-137/udev/udev-watch.c 1970-01-01 01:00:00.000000000 +0100
+++ new/udev-138/udev/udev-watch.c 2009-02-13 15:57:54.000000000 +0100
@@ -0,0 +1,232 @@
+/*
+ * Copyright (C) 2004-2008 Kay Sievers <kay.sievers@xxxxxxxx>
+ * Copyright (C) 2009 Canonical Ltd.
+ * Copyright (C) 2009 Scott James Remnant <scott@xxxxxxxxxxxx>
+ *
+ * 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, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <sys/types.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <dirent.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#ifdef HAVE_INOTIFY
+#include <sys/inotify.h>
+#endif
+
+#include "udev.h"
+
+int inotify_fd = -1;
+
+/* inotify descriptor, will be shared with rules directory;
+ * set to cloexec since we need our children to be able to add
+ * watches for us
+ */
+void udev_watch_init(struct udev *udev)
+{
+ inotify_fd = inotify_init();
+ if (inotify_fd >= 0) {
+ int flags;
+
+ flags = fcntl(inotify_fd, F_GETFD);
+ if (flags < 0)
+ flags = FD_CLOEXEC;
+ else
+ flags |= FD_CLOEXEC;
+ fcntl(inotify_fd, F_SETFD, flags);
+ } else if (errno == ENOSYS)
+ info(udev, "unable to use inotify, udevd will not monitor rule
files changes\n");
+ else
+ err(udev, "inotify_init failed: %m\n");
+}
+
+/* move any old watches directory out of the way, and then restore
+ * the watches
+ */
+void udev_watch_restore(struct udev *udev)
+{
+ char filename[UTIL_PATH_SIZE], oldname[UTIL_PATH_SIZE];
+
+ if (inotify_fd < 0)
+ return;
+
+ util_strlcpy(oldname, udev_get_dev_path(udev), sizeof(oldname));
+ util_strlcat(oldname, "/.udev/watch.old", sizeof(oldname));
+
+ util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename));
+ util_strlcat(filename, "/.udev/watch", sizeof(filename));
+
+ if (rename(filename, oldname) == 0) {
+ DIR *dir;
+ struct dirent *ent;
+
+ dir = opendir(oldname);
+ if (dir == NULL) {
+ err(udev, "unable to open old watches dir '%s', old
watches will not be restored: %m", oldname);
+ return;
+ }
+
+ while ((ent = readdir(dir)) != NULL) {
+ char path[UTIL_PATH_SIZE];
+ char buf[UTIL_PATH_SIZE];
+ ssize_t len;
+ struct udev_device *dev;
+
+ if (ent->d_name[0] < '0' || ent->d_name[0] > '9')
+ continue;
+
+ util_strlcpy(path, oldname, sizeof(path));
+ util_strlcat(path, "/", sizeof(path));
+ util_strlcat(path, ent->d_name, sizeof(path));
+
+ len = readlink(path, buf, sizeof(buf));
+ if (len <= 0) {
+ unlink(path);
+ continue;
+ }
+
+ buf[len] = '\0';
+ dbg(udev, "old watch to '%s' found\n", buf);
+ dev = udev_device_new_from_syspath(udev, buf);
+ if (dev == NULL) {
+ unlink(path);
+ continue;
+ }
+
+ info(udev, "restoring old watch on '%s'\n",
udev_device_get_devnode(dev));
+ udev_watch_begin(udev, dev);
+
+ udev_device_unref(dev);
+ unlink(path);
+ }
+
+ closedir(dir);
+ rmdir(oldname);
+
+ } else if (errno != ENOENT) {
+ err(udev, "unable to move watches dir '%s', old watches will
not be restored: %m", filename);
+ }
+}
+
+static const char *udev_watch_filename(struct udev *udev, int wd)
+{
+ static char filename[UTIL_PATH_SIZE];
+ char str[32];
+
+ sprintf(str, "%d", wd);
+ util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename));
+ util_strlcat(filename, "/.udev/watch/", sizeof(filename));
+ util_strlcat(filename, str, sizeof(filename));
+
+ return filename;
+}
+
+void udev_watch_begin(struct udev *udev, struct udev_device *dev)
+{
+ const char *filename;
+ int wd;
+
+ if (inotify_fd < 0)
+ return;
+
+ wd = inotify_add_watch(inotify_fd, udev_device_get_devnode(dev),
IN_CLOSE_WRITE);
+ if (wd < 0) {
+ err(udev, "inotify_add_watch(%d, %s, %o) failed: %m\n",
+ inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
+ }
+
+ filename = udev_watch_filename(udev, wd);
+ util_create_path(udev, filename);
+ unlink(filename);
+ symlink(udev_device_get_syspath(dev), filename);
+}
+
+void udev_watch_clear(struct udev *udev, struct udev_device *dev)
+{
+ static char filename[UTIL_PATH_SIZE];
+ DIR *dir;
+ struct dirent *ent;
+
+ util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename));
+ util_strlcat(filename, "/.udev/watch", sizeof(filename));
+
+ dir = opendir(filename);
+ if (dir == NULL)
+ return;
+
+ while ((ent = readdir(dir)) != NULL) {
+ char path[UTIL_PATH_SIZE];
+ char buf[UTIL_PATH_SIZE];
+ ssize_t len;
+
+ if (ent->d_name[0] < '0' || ent->d_name[0] > '9')
+ continue;
+
+ util_strlcpy(path, filename, sizeof(path));
+ util_strlcat(path, "/", sizeof(path));
+ util_strlcat(path, ent->d_name, sizeof(path));
+
+ len = readlink(path, buf, sizeof(buf));
+ if (len <= 0)
+ continue;
+
+ buf[len] = '\0';
+ if (strcmp(buf, udev_device_get_syspath(dev)))
+ continue;
+
+ /* this is the watch we're looking for */
+ info(udev, "clearing existing watch on '%s'\n",
udev_device_get_devnode(dev));
+ udev_watch_end(udev, atoi(ent->d_name));
+ }
+
+ closedir(dir);
+}
+
+void udev_watch_end(struct udev *udev, int wd)
+{
+ const char *filename;
+
+ if (inotify_fd < 0 || wd < 0)
+ return;
+
+ inotify_rm_watch(inotify_fd, wd);
+
+ filename = udev_watch_filename(udev, wd);
+ unlink(filename);
+}
+
+const char *udev_watch_lookup(struct udev *udev, int wd)
+{
+ const char *filename;
+ static char buf[UTIL_PATH_SIZE];
+ ssize_t len;
+
+ if (inotify_fd < 0 || wd < 0)
+ return NULL;
+
+ filename = udev_watch_filename(udev, wd);
+ len = readlink(filename, buf, sizeof(buf));
+ if (len > 0) {
+ buf[len] = '\0';
+
+ return buf;
+ }
+
+ return NULL;
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/udev-137/udev/udev.xml new/udev-138/udev/udev.xml
--- old/udev-137/udev/udev.xml 2009-01-16 21:32:25.000000000 +0100
+++ new/udev-138/udev/udev.xml 2009-02-11 19:27:48.000000000 +0100
@@ -90,7 +90,7 @@
pointing to the node, or run a specified program as part of the
event handling.
If no matching rule is found, the default device node name is
used.</para>
- <para>A rule may consist of a list of one or more key value pairs
separated by
+ <para>A rule consists of a list of one or more key value pairs
separated by
a comma. Each key has a distinct operation, depending on the used
operator. Valid
operators are:</para>
<variablelist>
@@ -104,7 +104,7 @@
<varlistentry>
<term><option>!=</option></term>
<listitem>
- <para>Compare for non-equality.</para>
+ <para>Compare for inequality.</para>
</listitem>
</varlistentry>
@@ -457,6 +457,13 @@
with this option.</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>watch</option></term>
+ <listitem>
+ <para>Watch the device node with inotify, when closed
after being opened for
+ writing, a change uevent will be synthesised.</para>
+ </listitem>
+ </varlistentry>
</variablelist>
</listitem>
</varlistentry>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-commit+help@xxxxxxxxxxxx
| < Previous | Next > |