Hello Louis Yung-Chieh Lo, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/22490
to look at the new patch set (#2).
Change subject: Add a file utility library
......................................................................
Add a file utility library
This adds a library for BSD-licensed helper functions for dealing
with files.
Currently the library only has scanft() which was ported over from
mosys. This function recursively scans files in a filesystem tree
and can optionally match the beginning content. This is particularly
useful for searching for devices in sysfs, which may be infinitely
recursive (due to symlinks) and typically contain single values, such
as a module alias.
BUG=none
TEST=used in follow-up CLs to find I2C and SPI buses and addresses
Example test output using /sys/bus/i2c/devices/ as root path,
following 2 levels of symbolic links, physical i2c bus is 4 but
got shifted to 6:
gec_i2c_probe_programmer: probing for GEC on I2C...
gec_i2c_probe_programmer: chromeos-ec found in \
"/sys/bus/i2c/devices/i2c-6/6-001e/name"
gec_i2c_probe_programmer: bus: 6, addr: 0x1e
Change-Id: I6c86ad3a50748e6bdbaa6675b05e75ef714b3994
Reviewed-on: https://gerrit.chromium.org/gerrit/23466
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org(a)gtempaccount.com>
Commit-Ready: David Hendricks <dhendrix(a)chromium.org>
Tested-by: David Hendricks <dhendrix(a)chromium.org>
---
M Makefile
A file.c
A file.h
3 files changed, 175 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/90/22490/2
--
To view, visit https://review.coreboot.org/22490
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6c86ad3a50748e6bdbaa6675b05e75ef714b3994
Gerrit-Change-Number: 22490
Gerrit-PatchSet: 2
Gerrit-Owner: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Louis Yung-Chieh Lo <yjlou(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
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(a)chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/335353
Reviewed-by: David Hendricks <dhendrix(a)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
--
To view, visit https://review.coreboot.org/22494
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I2d053b18ba624f4ce3ebc1956b9e7945b693b0bc
Gerrit-Change-Number: 22494
Gerrit-PatchSet: 2
Gerrit-Owner: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Brian Norris <briannorris(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Hello build bot (Jenkins), Brian Norris,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/22493
to look at the new patch set (#2).
Change subject: file: add new helper functions to grok FDT nodes
......................................................................
file: add new helper functions to grok FDT nodes
This file is intended to help find SPI devices using the FDT.
Here's how it works:
Under /proc/device-tree there is a node called "aliases" where
each file is a device name with an instance (e.g. "spi0"). The
content of the file is the controller's memory-mapped address.
That info can be used to find the appropriate node directory to
search under /proc/device-tree, where we can recursively search
for "compatible" nodes and scan for the matching user-provided
compatible string.
For SPI devices, we need to look for the matching "compatible"
node and then read the corresponding "reg" node to obtain chip-
select number.
BUG=chrome-os-partner:43453
BRANCH=none
TEST=reads now work on danger without specifying a SPI device
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
Change-Id: I1f771bcca61de71daa54e358e058723d3fd37079
Reviewed-on: https://chromium-review.googlesource.com/310072
Commit-Ready: David Hendricks <dhendrix(a)chromium.org>
Tested-by: David Hendricks <dhendrix(a)chromium.org>
Reviewed-by: Brian Norris <briannorris(a)chromium.org>
---
M file.c
M file.h
2 files changed, 160 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/93/22493/2
--
To view, visit https://review.coreboot.org/22493
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I1f771bcca61de71daa54e358e058723d3fd37079
Gerrit-Change-Number: 22493
Gerrit-PatchSet: 2
Gerrit-Owner: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Brian Norris <briannorris(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Hello build bot (Jenkins), Brian Norris,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/22492
to look at the new patch set (#2).
Change subject: file: Re-implement file parsing function
......................................................................
file: Re-implement file parsing function
This re-does the original file parsing function to be a little bit
more robust. The old version just copied the file content and did
a string compare. The new version will read the file character-by-
character, comparing with the specified string as we go along, until
a match is found.
BUG=none
BRANCH=none
TEST=Works as expected on veyron_mickey to grok thru sysfs. Also
tested with an upcoming FDT-related patch to search thru procfs.
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
Change-Id: I6e3811acf352d85c3f43192f87388833a997dd2c
Reviewed-on: https://chromium-review.googlesource.com/310653
Reviewed-by: Brian Norris <briannorris(a)chromium.org>
---
M file.c
1 file changed, 58 insertions(+), 28 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/92/22492/2
--
To view, visit https://review.coreboot.org/22492
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6e3811acf352d85c3f43192f87388833a997dd2c
Gerrit-Change-Number: 22492
Gerrit-PatchSet: 2
Gerrit-Owner: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Brian Norris <briannorris(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Hello Julius Werner, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/22491
to look at the new patch set (#2).
Change subject: avoid unnecessary syscalls in scanft()
......................................................................
avoid unnecessary syscalls in scanft()
This adds a test to see if the path given to scanft() is a symlink
or a directory before calling opendir() and readdir(). This cuts
down on syscalls which can be very slow.
BUG=none
BRANCH=none
TEST="flashrom -p host -i RW_ELOG:/tmp/elog.bin -r -V" ran on pit a
few hundred milliseconds faster (without other optimizations applied)
Change-Id: Ib067cfda1ba3edbc0b1bba604fa5eb57c64501f2
Reviewed-on: https://chromium-review.googlesource.com/176580
Commit-Queue: David Hendricks <dhendrix(a)chromium.org>
Tested-by: David Hendricks <dhendrix(a)chromium.org>
Reviewed-by: Julius Werner <jwerner(a)chromium.org>
---
M file.c
1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/91/22491/2
--
To view, visit https://review.coreboot.org/22491
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ib067cfda1ba3edbc0b1bba604fa5eb57c64501f2
Gerrit-Change-Number: 22491
Gerrit-PatchSet: 2
Gerrit-Owner: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>