summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/udev/udev/udev-cache
diff options
context:
space:
mode:
authorRichard Tollerton <rich.tollerton@ni.com>2014-12-08 17:13:35 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-12-19 18:08:01 +0000
commit7f8634cc90bd09a5052dc4cf465c61003e3d05cd (patch)
tree4904ae289d860e5c1d68374ab87689d97026a215 /meta/recipes-core/udev/udev/udev-cache
parent24a159e16962477b105eeb144515fd16ddb3cdd0 (diff)
downloadpoky-7f8634cc90bd09a5052dc4cf465c61003e3d05cd.tar.gz
udev-cache: replace readfiles() with cmp
Currently, udev-cache system configurations are compared as shell string variables, read into memory with the readfiles() function. This is more complex, and significantly (27-41%) slower, than comparing them using `cmp`. (Performance was verified on both Cortex-A9 and Intel Nehalem systems.) So just use cmp. This requires a few other small changes: exclude /proc/atags from CMP_FILE_LIST if it doesn't exist to avoid errors in `cat` and `cmp`. `cmp -q` doesn't exist in busybox, so instead, redirect output to /dev/null. (From OE-Core rev: e8ea6a29ed3ab9892a3bc7ee8249f10688c0af29) Signed-off-by: Richard Tollerton <rich.tollerton@ni.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/udev/udev/udev-cache')
-rw-r--r--meta/recipes-core/udev/udev/udev-cache17
1 files changed, 3 insertions, 14 deletions
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
index a1410f5579..e0e1c39488 100644
--- a/meta/recipes-core/udev/udev/udev-cache
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -21,20 +21,10 @@ SYSCONF_CACHED="/etc/udev/cache.data"
21SYSCONF_TMP="/dev/shm/udev.cache" 21SYSCONF_TMP="/dev/shm/udev.cache"
22 22
23# A list of files which are used as a criteria to judge whether the udev cache could be reused. 23# A list of files which are used as a criteria to judge whether the udev cache could be reused.
24CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices /proc/atags" 24CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices"
25[ -f /proc/atags ] && CMP_FILE_LIST="$CMP_FILE_LIST /proc/atags"
25[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache 26[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
26 27
27readfiles () {
28 READDATA=""
29 for filename in $@; do
30 if [ -r $filename ]; then
31 while read line; do
32 READDATA="$READDATA$line"
33 done < $filename
34 fi
35 done
36}
37
38if [ "$ROOTFS_READ_ONLY" = "yes" ]; then 28if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
39 [ "$VERBOSE" != "no" ] && echo "udev-cache: read-only rootfs, skip generating udev-cache" 29 [ "$VERBOSE" != "no" ] && echo "udev-cache: read-only rootfs, skip generating udev-cache"
40 exit 0 30 exit 0
@@ -43,8 +33,7 @@ fi
43if [ "$DEVCACHE" != "" -a -e "$SYSCONF_TMP" ]; then 33if [ "$DEVCACHE" != "" -a -e "$SYSCONF_TMP" ]; then
44 echo "Populating dev cache" 34 echo "Populating dev cache"
45 udevadm control --stop-exec-queue 35 udevadm control --stop-exec-queue
46 readfiles $CMP_FILE_LIST 36 cat -- $CMP_FILE_LIST > "$SYSCONF_TMP"
47 echo "$READDATA" > "$SYSCONF_TMP"
48 find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \ 37 find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \
49 | xargs tar cf "${DEVCACHE_TMP}" -T- 38 | xargs tar cf "${DEVCACHE_TMP}" -T-
50 gzip < "${DEVCACHE_TMP}" > "$DEVCACHE" 39 gzip < "${DEVCACHE_TMP}" > "$DEVCACHE"