summaryrefslogtreecommitdiff
path: root/src/lib/cbfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/cbfs.c')
-rw-r--r--src/lib/cbfs.c72
1 files changed, 0 insertions, 72 deletions
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index d68aa39cc5..55a8536a36 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -68,78 +68,6 @@ void *cbfs_boot_map_with_leak(const char *name, uint32_t type, size_t *size)
return rdev_mmap(&fh.data, 0, fsize);
}
-int cbfs_locate(struct cbfsf *fh, const struct region_device *cbfs,
- const char *name, uint32_t *type)
-{
- size_t offset = 0;
-
- LOG("Locating '%s'\n", name);
-
- /* Try to scan the entire cbfs region looking for file name. */
- while (1) {
- struct cbfs_file file;
- const size_t fsz = sizeof(file);
- char *fname;
- int name_match;
- size_t datasz;
-
- DEBUG("Checking offset %zx\n", offset);
-
- /* Can't read file. Nothing else to do but bail out. */
- if (rdev_readat(cbfs, &file, offset, fsz) != fsz)
- break;
-
- if (memcmp(file.magic, CBFS_FILE_MAGIC, sizeof(file.magic))) {
- offset++;
- offset = ALIGN_UP(offset, CBFS_ALIGNMENT);
- continue;
- }
-
- file.len = ntohl(file.len);
- file.type = ntohl(file.type);
- file.offset = ntohl(file.offset);
-
- /* See if names match. */
- fname = rdev_mmap(cbfs, offset + fsz, file.offset - fsz);
-
- if (fname == NULL)
- break;
-
- name_match = !strcmp(fname, name);
- rdev_munmap(cbfs, fname);
-
- if (!name_match) {
- DEBUG(" Unmatched '%s' at %zx\n", fname, offset);
- offset += file.offset + file.len;
- offset = ALIGN_UP(offset, CBFS_ALIGNMENT);
- continue;
- }
-
- if (type != NULL && *type != file.type) {
- DEBUG(" Unmatched type %x at %zx\n", file.type, offset);
- offset += file.offset + file.len;
- offset = ALIGN_UP(offset, CBFS_ALIGNMENT);
- continue;
- }
-
- LOG("Found @ offset %zx size %x\n", offset, file.len);
- /* File and type match. Keep track of both the metadata and
- * the data for the file. */
- if (rdev_chain(&fh->metadata, cbfs, offset, file.offset))
- break;
- offset += file.offset;
- datasz = file.len;
- if (rdev_chain(&fh->data, cbfs, offset, datasz))
- break;
-
- /* Success. */
- return 0;
- }
-
- LOG("'%s' not found.\n", name);
- return -1;
-}
-
static size_t inflate(void *src, void *dst)
{
if (ENV_BOOTBLOCK || ENV_VERSTAGE)