Hello build bot (Jenkins), Brian Norris,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/22494
to look at the new patch set (#2).
Change subject: file: read in entire file (up to 4K) instead of stat()'ing for size ......................................................................
file: read in entire file (up to 4K) instead of stat()'ing for size
We use find_string() to check files in both /proc (e.g., /proc/device-tree/...) and /sys (e.g., /sys/bus/spi/devices/...). find_string() currently tries to iteratively read pieces of these files, using stat() to get the file size. However, this size is inaccurate on sysfs, as these files are often dynamically generated, so it reports a size of PAGE_SIZE (i.e., 4096).
Instead of trying to pre-determine the file size, let's read in the whole file (up to 4KiB - 1) and do a series of string searches to find any matching strings. The 4KiB limitation should be OK, since we're only looking for things like modalias and compatible strings.
As a side effect, this eliminates a lot of unnecessary strlen() calls, and allows us to again avoid hand-rolling strstr().
BUG=chrome-os-partner:51651 BRANCH=none TEST=`flashrom --wp-status` doesn't show log spam TEST=`flashrom --read /tmp/flashX` gives same results before/after
Change-Id: I2d053b18ba624f4ce3ebc1956b9e7945b693b0bc Signed-off-by: Brian Norris briannorris@chromium.org Reviewed-on: https://chromium-review.googlesource.com/335353 Reviewed-by: David Hendricks dhendrix@chromium.org --- M file.c 1 file changed, 41 insertions(+), 44 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/94/22494/2