David Hendricks uploaded patch set #2 to this change.
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@gtempaccount.com>
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@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 change 22490. To unsubscribe, visit settings.