libpayload: rename cbfs variable from name to vardata
The dynamically sized region after struct cbfs_file doesn't contain only the file name anymore. Change-Id: I3241cb2f0cbec3fcf4d3c27d638e2847e43f4761 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: http://review.coreboot.org/11676 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
parent
377d1db57d
commit
5c6dc72501
|
@ -97,8 +97,8 @@ const struct cbfs_header *cbfs_get_header(struct cbfs_media *media)
|
|||
/* public API starts here*/
|
||||
struct cbfs_file *cbfs_get_file(struct cbfs_media *media, const char *name)
|
||||
{
|
||||
const char *file_name;
|
||||
uint32_t offset, romsize, name_len;
|
||||
const char *vardata;
|
||||
uint32_t offset, romsize, vardata_len;
|
||||
const struct cbfs_header *header;
|
||||
struct cbfs_file file, *file_ptr;
|
||||
struct cbfs_media default_media;
|
||||
|
@ -153,29 +153,29 @@ struct cbfs_file *cbfs_get_file(struct cbfs_media *media, const char *name)
|
|||
offset += new_align;
|
||||
continue;
|
||||
}
|
||||
name_len = ntohl(file.offset) - sizeof(file);
|
||||
DEBUG(" - load entry 0x%x file name (%d bytes)...\n", offset,
|
||||
name_len);
|
||||
vardata_len = ntohl(file.offset) - sizeof(file);
|
||||
DEBUG(" - load entry 0x%x variable data (%d bytes)...\n",
|
||||
offset, vardata_len);
|
||||
|
||||
// load file name (arbitrary length).
|
||||
file_name = (const char*)media->map(
|
||||
media, offset + sizeof(file), name_len);
|
||||
if (file_name == CBFS_MEDIA_INVALID_MAP_ADDRESS) {
|
||||
vardata = (const char*)media->map(
|
||||
media, offset + sizeof(file), vardata_len);
|
||||
if (vardata == CBFS_MEDIA_INVALID_MAP_ADDRESS) {
|
||||
ERROR("ERROR: Failed to get filename: 0x%x.\n", offset);
|
||||
} else if (strcmp(file_name, name) == 0) {
|
||||
} else if (strcmp(vardata, name) == 0) {
|
||||
int file_offset = ntohl(file.offset),
|
||||
file_len = ntohl(file.len);
|
||||
DEBUG("Found file (offset=0x%x, len=%d).\n",
|
||||
offset + file_offset, file_len);
|
||||
media->unmap(media, file_name);
|
||||
media->unmap(media, vardata);
|
||||
file_ptr = media->map(media, offset,
|
||||
file_offset + file_len);
|
||||
media->close(media);
|
||||
return file_ptr;
|
||||
} else {
|
||||
DEBUG(" (unmatched file @0x%x: %s)\n", offset,
|
||||
file_name);
|
||||
media->unmap(media, file_name);
|
||||
vardata);
|
||||
media->unmap(media, vardata);
|
||||
}
|
||||
|
||||
// Move to next file.
|
||||
|
|
Loading…
Reference in New Issue