[OE-core] [PATCH 16/20] udev-cache: invalidate on rules.d changes

Ben Shelton ben.shelton at ni.com
Mon Aug 4 18:41:08 UTC 2014


From: Richard Tollerton <rich.tollerton at ni.com>

Presently, $DEVCACHE_CURRENT_SYSCONF doesn't change if rules are
modified, which may cause the cache to preserve an old configuration.
To fix, include `ls -l` output for all rules, which ought to be
reasonably fast to run on boot.

Natinst-Rally-ID: TA44427
Acked-by: Gratian Crisan <gratian.crisan at ni.com>
Natinst-ReviewBoard-ID: 58620
Signed-off-by: Richard Tollerton <rich.tollerton at ni.com>
---
 meta/recipes-core/udev/udev/init | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init
index e4a196f..3a52e98 100644
--- a/meta/recipes-core/udev/udev/init
+++ b/meta/recipes-core/udev/udev/init
@@ -63,9 +63,10 @@ case "$1" in
     # A list of files which are used as a criteria to judge whether the udev cache could be reused.
     CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices /proc/atags"
     if [ "$DEVCACHE" != "" ]; then
+	    RULELIST=`ls -l /lib/udev/rules.d/* /etc/udev/rules.d/* 2>/dev/null`
             if [ -e $DEVCACHE ]; then
 		    readfiles $CMP_FILE_LIST
-		    NEWDATA="$READDATA"
+		    NEWDATA="$READDATA$RULELIST"
 		    readfiles "$DEVCACHE_SYSCONF"
 		    OLDDATA="$READDATA"
 		    if [ "$OLDDATA" = "$NEWDATA" -a -f "$DEVCACHE" ]; then
@@ -77,7 +78,7 @@ case "$1" in
 			    # Output detailed reason why the cached /dev is not used
 			    if [ "$VERBOSE" != "no" ]; then
 				    echo "udev: udev cache not used"
-				    echo "udev: we use $CMP_FILE_LIST as criteria to judge whether the cache /dev could be resued"
+				    echo "udev: we use $CMP_FILE_LIST and ls -l [/lib][etc]/udev/rules.d/* as criteria to judge whether the cached /dev could be reused"
 				    echo "udev: olddata: $OLDDATA"
 				    echo "udev: newdata: $NEWDATA"
 			    fi
@@ -88,7 +89,7 @@ case "$1" in
 			    # If rootfs is not read-only, it's possible that a new udev cache would be generated;
 			    # otherwise, we do not bother to read files.
 			    readfiles $CMP_FILE_LIST
-			    echo "$READDATA" > "$DEVCACHE_CURRENT_SYSCONF"
+			    echo "$READDATA$RULELIST" > "$DEVCACHE_CURRENT_SYSCONF"
 		    fi
             fi
     fi
-- 
2.0.4




More information about the Openembedded-core mailing list