Hello Julius Werner,
I'd like you to do a code review. Please visit
https://review.coreboot.org/22491
to review the following change.
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@chromium.org Tested-by: David Hendricks dhendrix@chromium.org Reviewed-by: Julius Werner jwerner@chromium.org --- M file.c 1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/91/22491/1
diff --git a/file.c b/file.c index 6f15ff9..8bc34aa 100644 --- a/file.c +++ b/file.c @@ -112,6 +112,8 @@ return NULL; else if (symdepth > 0) /* Follow if not too deep in */ symdepth--; + } else if (!S_ISDIR(s.st_mode)) { + return NULL; }
if ((dp = opendir(root)) == NULL)