summaryrefslogtreecommitdiff
path: root/core/udev
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2012-04-07 00:01:17 +0000
committerroot <root@rshg054.dnsready.net>2012-04-07 00:01:17 +0000
commit3d65494a8eda056377febda4642ce992e69a9371 (patch)
treedae57e04ca5f7d7490acbde87206eaa62695109d /core/udev
parentd9c1fc1bcca8fd5cd3566fc6b183fe23065778bc (diff)
Sat Apr 7 00:01:16 UTC 2012
Diffstat (limited to 'core/udev')
-rw-r--r--core/udev/0001-split-usr-always-read-config-files-from-lib-udev.patch80
-rw-r--r--core/udev/0002-reinstate-TIMEOUT-handling.patch146
-rw-r--r--core/udev/PKGBUILD39
-rw-r--r--core/udev/initcpio-install-udev6
4 files changed, 253 insertions, 18 deletions
diff --git a/core/udev/0001-split-usr-always-read-config-files-from-lib-udev.patch b/core/udev/0001-split-usr-always-read-config-files-from-lib-udev.patch
new file mode 100644
index 000000000..d4d162167
--- /dev/null
+++ b/core/udev/0001-split-usr-always-read-config-files-from-lib-udev.patch
@@ -0,0 +1,80 @@
+From f2bdace5bb68d4f3162f886b27210762d8b115b8 Mon Sep 17 00:00:00 2001
+From: Tom Gundersen <teg@jklm.no>
+Date: Sat, 3 Mar 2012 12:28:15 +0100
+Subject: [PATCH 1/2] split /usr: always read config files from /lib/udev
+
+This means we don't need a flagday in order to move udev to use
+/usr/lib/udev/rules.d
+---
+ src/libudev.c | 25 ++++++++++++++++---------
+ 1 file changed, 16 insertions(+), 9 deletions(-)
+
+diff --git a/src/libudev.c b/src/libudev.c
+index be24329..754d713 100644
+--- a/src/libudev.c
++++ b/src/libudev.c
+@@ -43,8 +43,8 @@ struct udev {
+ void *userdata;
+ char *sys_path;
+ char *dev_path;
+- char *rules_path[4];
+- unsigned long long rules_path_ts[4];
++ char *rules_path[5];
++ unsigned long long rules_path_ts[5];
+ int rules_path_count;
+ char *run_path;
+ struct udev_list properties_list;
+@@ -255,21 +255,26 @@ UDEV_EXPORT struct udev *udev_new(void)
+ goto err;
+
+ if (udev->rules_path[0] == NULL) {
+- /* /usr/lib/udev -- system rules */
+- udev->rules_path[0] = strdup(PKGLIBEXECDIR "/rules.d");
++ /* /lib/udev -- compat for system rules */
++ udev->rules_path[0] = strdup("/lib/udev/rules.d");
+ if (!udev->rules_path[0])
++ goto err;
++
++ /* /usr/lib/udev -- system rules */
++ udev->rules_path[1] = strdup(PKGLIBEXECDIR "/rules.d");
++ if (!udev->rules_path[1])
+ goto err;
+
+ /* /etc/udev -- local administration rules */
+- udev->rules_path[1] = strdup(SYSCONFDIR "/udev/rules.d");
+- if (!udev->rules_path[1])
++ udev->rules_path[2] = strdup(SYSCONFDIR "/udev/rules.d");
++ if (!udev->rules_path[2])
+ goto err;
+
+ /* /run/udev -- runtime rules */
+- if (asprintf(&udev->rules_path[2], "%s/rules.d", udev->run_path) < 0)
++ if (asprintf(&udev->rules_path[3], "%s/rules.d", udev->run_path) < 0)
+ goto err;
+
+- udev->rules_path_count = 3;
++ udev->rules_path_count = 4;
+ }
+
+ dbg(udev, "context %p created\n", udev);
+@@ -278,7 +283,8 @@ UDEV_EXPORT struct udev *udev_new(void)
+ dbg(udev, "dev_path='%s'\n", udev->dev_path);
+ dbg(udev, "sys_path='%s'\n", udev->sys_path);
+ dbg(udev, "run_path='%s'\n", udev->run_path);
+- dbg(udev, "rules_path='%s':'%s':'%s'\n", udev->rules_path[0], udev->rules_path[1], udev->rules_path[2]);
++ dbg(udev, "rules_path='%s':'%s':'%s':'%s'\n", udev->rules_path[0], udev->rules_path[1],
++ udev->rules_path[2], udev->rules_path[3]);
+ free(config_file);
+ return udev;
+ err:
+@@ -325,6 +331,7 @@ UDEV_EXPORT void udev_unref(struct udev *udev)
+ free(udev->rules_path[0]);
+ free(udev->rules_path[1]);
+ free(udev->rules_path[2]);
++ free(udev->rules_path[3]);
+ free(udev->run_path);
+ dbg(udev, "context %p released\n", udev);
+ free(udev);
+--
+1.7.9.5
+
diff --git a/core/udev/0002-reinstate-TIMEOUT-handling.patch b/core/udev/0002-reinstate-TIMEOUT-handling.patch
new file mode 100644
index 000000000..9d1d36fb6
--- /dev/null
+++ b/core/udev/0002-reinstate-TIMEOUT-handling.patch
@@ -0,0 +1,146 @@
+From 0a581062ee3e31e0c2aedc5eb64c60f52868b17f Mon Sep 17 00:00:00 2001
+From: Tom Gundersen <teg@jklm.no>
+Date: Thu, 15 Mar 2012 02:12:43 +0100
+Subject: [PATCH 2/2] reinstate TIMEOUT= handling
+
+Without treating events with timeouts specially some drivers would cause a
+30 seconds stall on boot: .
+
+I also received reports of some drivers not working at all, even after the
+timeout.
+
+We will remove this patch when more drivers have been fixed in the kernel (3.4?).
+
+This reverts 43d5c5f03645c4b842659f9b5bd0ae465e885e92 and
+57c6f8ae5f52a6e8ffc66a54966346f733dded39.
+---
+ TODO | 2 ++
+ src/libudev-device.c | 19 +++++++++++++++++++
+ src/libudev-private.h | 1 +
+ src/udevd.c | 13 ++++++++++---
+ 4 files changed, 32 insertions(+), 3 deletions(-)
+
+diff --git a/TODO b/TODO
+index 36e8440..c2e59b6 100644
+--- a/TODO
++++ b/TODO
+@@ -1,6 +1,8 @@
+ - find a way to tell udev to not cancel firmware
+ requests in initramfs
+
++ - remove TIMEOUT= handling
++
+ - move /lib/udev/devices/ to tmpfiles
+
+ - trigger --subsystem-match=usb/usb_device
+diff --git a/src/libudev-device.c b/src/libudev-device.c
+index 10f28b8..639c367 100644
+--- a/src/libudev-device.c
++++ b/src/libudev-device.c
+@@ -68,6 +68,7 @@ struct udev_device {
+ struct udev_list tags_list;
+ unsigned long long int seqnum;
+ unsigned long long int usec_initialized;
++ int timeout;
+ int devlink_priority;
+ int refcount;
+ dev_t devnum;
+@@ -160,6 +161,21 @@ static int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum)
+ return 0;
+ }
+
++int udev_device_get_timeout(struct udev_device *udev_device)
++{
++ return udev_device->timeout;
++}
++
++static int udev_device_set_timeout(struct udev_device *udev_device, int timeout)
++{
++ char num[32];
++
++ udev_device->timeout = timeout;
++ snprintf(num, sizeof(num), "%u", timeout);
++ udev_device_add_property(udev_device, "TIMEOUT", num);
++ return 0;
++}
++
+ const char *udev_device_get_devpath_old(struct udev_device *udev_device)
+ {
+ return udev_device->devpath_old;
+@@ -414,6 +430,8 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device,
+ udev_device_set_devpath_old(udev_device, &property[12]);
+ } else if (strncmp(property, "SEQNUM=", 7) == 0) {
+ udev_device_set_seqnum(udev_device, strtoull(&property[7], NULL, 10));
++ } else if (strncmp(property, "TIMEOUT=", 8) == 0) {
++ udev_device_set_timeout(udev_device, strtoull(&property[8], NULL, 10));
+ } else if (strncmp(property, "IFINDEX=", 8) == 0) {
+ udev_device_set_ifindex(udev_device, strtoull(&property[8], NULL, 10));
+ } else if (strncmp(property, "DEVMODE=", 8) == 0) {
+@@ -599,6 +617,7 @@ struct udev_device *udev_device_new(struct udev *udev)
+ udev_list_init(udev, &udev_device->sysattr_value_list, true);
+ udev_list_init(udev, &udev_device->sysattr_list, false);
+ udev_list_init(udev, &udev_device->tags_list, true);
++ udev_device->timeout = -1;
+ udev_device->watch_handle = -1;
+ /* copy global properties */
+ udev_list_entry_foreach(list_entry, udev_get_properties_list_entry(udev))
+diff --git a/src/libudev-private.h b/src/libudev-private.h
+index 5f5c64a..ec63b67 100644
+--- a/src/libudev-private.h
++++ b/src/libudev-private.h
+@@ -87,6 +87,7 @@ const char *udev_device_get_id_filename(struct udev_device *udev_device);
+ void udev_device_set_is_initialized(struct udev_device *udev_device);
+ int udev_device_add_tag(struct udev_device *udev_device, const char *tag);
+ void udev_device_cleanup_tags_list(struct udev_device *udev_device);
++int udev_device_get_timeout(struct udev_device *udev_device);
+ unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device);
+ void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized);
+ int udev_device_get_devlink_priority(struct udev_device *udev_device);
+diff --git a/src/udevd.c b/src/udevd.c
+index 1702217..88e9272 100644
+--- a/src/udevd.c
++++ b/src/udevd.c
+@@ -401,7 +401,7 @@ out:
+ }
+ }
+
+-static void event_run(struct event *event)
++static void event_run(struct event *event, bool force)
+ {
+ struct udev_list_node *loop;
+
+@@ -427,7 +427,7 @@ static void event_run(struct event *event)
+ return;
+ }
+
+- if (children >= children_max) {
++ if (!force && children >= children_max) {
+ if (children_max > 1)
+ info(event->udev, "maximum number (%i) of children reached\n", children);
+ return;
+@@ -461,6 +461,13 @@ static int event_queue_insert(struct udev_device *dev)
+
+ event->state = EVENT_QUEUED;
+ udev_list_node_append(&event->node, &event_list);
++
++ /* run all events with a timeout set immediately */
++ if (udev_device_get_timeout(dev) > 0) {
++ event_run(event, true);
++ return 0;
++ }
++
+ return 0;
+ }
+
+@@ -577,7 +584,7 @@ static void event_queue_start(struct udev *udev)
+ continue;
+ }
+
+- event_run(event);
++ event_run(event, false);
+ }
+ }
+
+--
+1.7.9.5
+
diff --git a/core/udev/PKGBUILD b/core/udev/PKGBUILD
index 114f524b9..082ed6213 100644
--- a/core/udev/PKGBUILD
+++ b/core/udev/PKGBUILD
@@ -1,4 +1,4 @@
-# $Id: PKGBUILD 153633 2012-03-16 22:34:33Z tomegun $
+# $Id: PKGBUILD 155730 2012-04-06 00:04:05Z tomegun $
# Maintainer: Tom Gundersen <teg@jklm.no>
# Contributor: Aaron Griffin <aaron@archlinux.org>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>
@@ -6,15 +6,16 @@
pkgname=udev
pkgver=181
-pkgrel=5
+pkgrel=9
pkgdesc="The userspace dev tools (udev)"
-depends=('util-linux' 'libusb-compat' 'glib2' 'kmod' 'pciutils' 'usbutils' 'acl')
+depends=('util-linux' 'glib2' 'kmod' 'pciutils' 'usbutils' 'bash' 'acl')
install=udev.install
arch=(i686 x86_64)
license=('GPL')
-makedepends=('gobject-introspection' 'gperf' 'libxslt' 'usbutils' 'kmod')
+makedepends=('gobject-introspection' 'gperf' 'libxslt')
source=(ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/$pkgname-$pkgver.tar.xz
- 0001-reinstate-TIMEOUT-handling.patch
+ 0001-split-usr-always-read-config-files-from-lib-udev.patch
+ 0002-reinstate-TIMEOUT-handling.patch
initcpio-hooks-udev
initcpio-install-udev)
url="http://git.kernel.org/?p=linux/hotplug/udev.git;a=summary"
@@ -25,19 +26,23 @@ options=(!makeflags !libtool)
build() {
cd $srcdir/$pkgname-$pkgver
- patch -p1 -i ../0001-reinstate-TIMEOUT-handling.patch
+ patch -p1 -i ../0001-split-usr-always-read-config-files-from-lib-udev.patch
+ patch -p1 -i ../0002-reinstate-TIMEOUT-handling.patch
./configure --prefix=/usr \
- --with-rootprefix= \
--sysconfdir=/etc \
- --libdir=/usr/lib \
- --libexecdir=/lib \
- --with-systemdsystemunitdir=/lib/systemd/system \
+ --libexecdir=/usr/lib \
+ --with-systemdsystemunitdir=/usr/lib/systemd/system \
+ --with-firmware-path=/usr/lib/firmware/updates:/lib/firmware/updates:/usr/lib/firmware:/lib/firmware \
--enable-udev_acl
make
}
-
+
+check() {
+ make -C "$pkgname-$pkgver" check
+}
+
package() {
cd $srcdir/$pkgname-$pkgver
make DESTDIR=${pkgdir} install
@@ -47,20 +52,24 @@ package() {
install -D -m644 ../initcpio-install-udev ${pkgdir}/usr/lib/initcpio/install/udev
# udevd moved, symlink to make life easy for restarting udevd manually
- ln -s ../../lib/udev/udevd ${pkgdir}/usr/bin/udevd
+ ln -s ../lib/udev/udevd ${pkgdir}/usr/bin/udevd
+ # and for users of the old /lib location (to go away soon)
+ mkdir -p ${pkgdir}/lib/udev
+ ln -s ../../usr/lib/udev/udevd ${pkgdir}/lib/udev/udevd
# the path to udevadm is hardcoded in some places
install -d ${pkgdir}/sbin
ln -s ../usr/bin/udevadm ${pkgdir}/sbin/udevadm
# Replace dialout/tape/cdrom group in rules with uucp/storage/optical group
- for i in $pkgdir/lib/udev/rules.d/*.rules; do
+ for i in $pkgdir/usr/lib/udev/rules.d/*.rules; do
sed -i -e 's#GROUP="dialout"#GROUP="uucp"#g;
s#GROUP="tape"#GROUP="storage"#g;
s#GROUP="cdrom"#GROUP="optical"#g' $i
done
}
md5sums=('0d7af750702620a871b9f9b98d8ad859'
- 'f758b3e62ab77a1a6b7be12bb900cb2d'
+ '02a0dbbdcba6c1eae3ef65b6b06bde1f'
+ 'a9fae85491a08d7759388c605389a8c5'
'a4dd853050bf2e0ae6b2e3d2c75499c2'
- 'ee0bfe91a20fff12cc25ab1d1e024853')
+ 'd2b16edc6d806b5dafdbbad43ae5a3de')
diff --git a/core/udev/initcpio-install-udev b/core/udev/initcpio-install-udev
index e7e2c0f60..6bc9cfb28 100644
--- a/core/udev/initcpio-install-udev
+++ b/core/udev/initcpio-install-udev
@@ -4,14 +4,14 @@ build() {
FILES="/etc/udev/udev.conf"
SCRIPT="udev"
- add_binary /lib/udev/udevd
+ add_binary /usr/lib/udev/udevd
add_binary /usr/bin/udevadm
for rules in 50-udev-default.rules 60-persistent-storage.rules 80-drivers.rules; do
- add_file "/lib/udev/rules.d/$rules"
+ add_file "/usr/lib/udev/rules.d/$rules"
done
for tool in ata_id scsi_id; do
- add_file "/lib/udev/$tool"
+ add_file "/usr/lib/udev/$tool"
done
}