]> code.ossystems Code Review - openembedded-core.git/commitdiff
udev-cache: invalidate on rules.d changes
authorRichard Tollerton <rich.tollerton@ni.com>
Fri, 24 Jan 2014 06:44:01 +0000 (00:44 -0600)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 19 Dec 2014 17:54:15 +0000 (17:54 +0000)
Presently, the cache is not regenerated if udev rules are modified,
which may cause the cache to preserve an old configuration. To fix,
include the size, mtime, and filename of all udev rules in the system
configuration.

This change requires `stat`. If busybox supplies stat,
CONFIG_FEATURE_STAT_FORMAT must be enabled.

Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
meta/recipes-core/udev/udev/init
meta/recipes-core/udev/udev/udev-cache

index 32c677a8c00a22e6c64ad56eae2dab52210056c1..94dbba37deb1a88f46e9cedf3ef7959c76cd36ad 100644 (file)
@@ -22,9 +22,14 @@ DEVCACHE_REGEN="/dev/shm/udev-regen" # create to request cache regen
 CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices"
 [ -f /proc/atags ] && CMP_FILE_LIST="$CMP_FILE_LIST /proc/atags"
 
+# List of files whose metadata (size/mtime/name) will be included in cached
+# system state.
+META_FILE_LIST="lib/udev/rules.d/* etc/udev/rules.d/*"
+
 # Command to compute system configuration.
 sysconf_cmd () {
        cat -- $CMP_FILE_LIST
+       stat -L -c '%s %Y %n' -- $META_FILE_LIST | awk -F/ '{print $1 " " $NF;}'
 }
 
 [ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
@@ -76,6 +81,7 @@ case "$1" in
                            cat <<EOF
 udev: Not using udev cache because of changes detected in the following files:
 udev:     $CMP_FILE_LIST
+udev:     $META_FILE_LIST
 udev: The udev cache will be regenerated. To identify the detected changes,
 udev: compare the cached sysconf at   $SYSCONF_CACHED
 udev: against the current sysconf at  $SYSCONF_TMP
index 4d50876b64bd052ed4c899d03803eea9f291dc08..571463fa01e4b49bcaf7f9e41051ab41d5c3b5ab 100644 (file)
@@ -25,9 +25,14 @@ DEVCACHE_REGEN="/dev/shm/udev-regen" # create to request cache regen
 CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices"
 [ -f /proc/atags ] && CMP_FILE_LIST="$CMP_FILE_LIST /proc/atags"
 
+# List of files whose metadata (size/mtime/name) will be included in cached
+# system state.
+META_FILE_LIST="lib/udev/rules.d/* etc/udev/rules.d/*"
+
 # Command to compute system configuration.
 sysconf_cmd () {
        cat -- $CMP_FILE_LIST
+       stat -L -c '%s %Y %n' -- $META_FILE_LIST | awk -F/ '{print $1 " " $NF;}'
 }
 
 [ -f /etc/default/udev-cache ] && . /etc/default/udev-cache