Commit 60fd6846 authored by Ronald G. Minnich's avatar Ronald G. Minnich
Browse files

cbfs_locate: Optionally return file type

In some cases callers want to know if a file
exists and, if so, what its type is.

Modify cbfs_locate so that if the pointer is non-NULL,
but has the value 0, the type of the file that
matches the name will be returned.

Change-Id: Ic1349d358c3054207ccbccf3825db56784327ad0
Signed-off-by: default avatarRonald G. Minnich <>

Tested-by: default avatarbuild bot (Jenkins) <>
Reviewed-by: default avatarPatrick Georgi <>
parent 5a1f5400
......@@ -212,12 +212,18 @@ int cbfs_locate(struct cbfsf *fh, const struct region_device *cbfs,
if (cbfsf_file_type(fh, &ftype))
if (*type != ftype) {
if (*type != 0 && *type != ftype) {
DEBUG(" Unmatched type %x at %zx\n", ftype,
// *type being 0 means we want to know ftype.
// We could just do a blind assignment but
// if type is pointing to read-only memory
// that might be bad.
if (*type == 0)
*type = ftype;
LOG("Found @ offset %zx size %zx\n",
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment