]> code.ossystems Code Review - openembedded-core.git/commitdiff
udev-cache: don't generate sysconf twice
authorRichard Tollerton <rich.tollerton@ni.com>
Mon, 8 Dec 2014 23:25:10 +0000 (17:25 -0600)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 19 Dec 2014 17:54:14 +0000 (17:54 +0000)
The udev initscript signals udev-cache to run by generating a new
sysconf; but udev-cache now overwrites that with its own copy. To
eliminate the needless sysconf generating in udev, we instead trigger
udev-cache to run by touching a new file $DEVCACHE_REGEN.

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

index ee7967063a3f7fbdac4532eb3d9184a6e683fd7a..337b6d4c11299abbb540d83bc266c2316a18089a 100644 (file)
@@ -16,6 +16,7 @@ export TZ=/etc/localtime
 [ -x @UDEVD@ ] || exit 1
 SYSCONF_CACHED="/etc/udev/cache.data"
 SYSCONF_TMP="/dev/shm/udev.cache"
+DEVCACHE_REGEN="/dev/shm/udev-regen" # create to request cache regen
 [ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
 [ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
 [ -f /etc/default/rcS ] && . /etc/default/rcS
@@ -62,6 +63,7 @@ case "$1" in
                             not_first_boot=1
                             [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
                             [ -e $SYSCONF_TMP ] && rm -f "$SYSCONF_TMP"
+                            [ -e "$DEVCACHE_REGEN" ] && rm -f "$DEVCACHE_REGEN"
                     else
                            # Output detailed reason why the cached /dev is not used
                            if [ "$VERBOSE" != "no" ]; then
@@ -70,12 +72,13 @@ case "$1" in
                                    echo "udev: cached sysconf:  $SYSCONF_CACHED"
                                    echo "udev: current sysconf: $SYSCONF_TMP"
                            fi
+                           touch "$DEVCACHE_REGEN"
                     fi
            else
                    if [ "$ROOTFS_READ_ONLY" != "yes" ]; then
                            # 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.
-                           cat -- "$CMP_FILE_LIST" > "$SYSCONF_TMP"
+                           touch "$DEVCACHE_REGEN"
                    fi
             fi
     fi
index e0e1c39488eebee2cc813389e6c1d1e16078073e..814ef54c3cc5de2ec41d0df9f03098d8be553f7c 100644 (file)
@@ -19,6 +19,7 @@ export TZ=/etc/localtime
 DEVCACHE_TMP="/dev/shm/udev-cache-tmp.tar"
 SYSCONF_CACHED="/etc/udev/cache.data"
 SYSCONF_TMP="/dev/shm/udev.cache"
+DEVCACHE_REGEN="/dev/shm/udev-regen" # create to request cache regen
 
 # 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"
@@ -30,7 +31,7 @@ if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
     exit 0
 fi
 
-if [ "$DEVCACHE" != "" -a -e "$SYSCONF_TMP" ]; then
+if [ "$DEVCACHE" != "" -a -e "$DEVCACHE_REGEN" ]; then
        echo "Populating dev cache"
        udevadm control --stop-exec-queue
         cat -- $CMP_FILE_LIST > "$SYSCONF_TMP"
@@ -40,6 +41,7 @@ if [ "$DEVCACHE" != "" -a -e "$SYSCONF_TMP" ]; then
        rm -f "${DEVCACHE_TMP}"
        mv "$SYSCONF_TMP" "$SYSCONF_CACHED"
        udevadm control --start-exec-queue
+       rm -f "$DEVCACHE_REGEN"
 fi
 
 exit 0