lib/cbfs_core.c: Supply size of file as well in cbfs_get_file_content

Change-Id: I5b93e5321e470f19ad22ca2cfdb1ebf3b340b252
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-on: http://review.coreboot.org/4659
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Tested-by: build bot (Jenkins)
This commit is contained in:
Vladimir Serbinenko
2014-01-12 13:45:52 +01:00
parent e4ac9c043a
commit 0af61b6c82
17 changed files with 47 additions and 32 deletions

View File

@ -173,10 +173,14 @@ struct cbfs_file *cbfs_get_file(struct cbfs_media *media, const char *name)
return NULL;
}
void *cbfs_get_file_content(struct cbfs_media *media, const char *name, int type)
void *cbfs_get_file_content(struct cbfs_media *media, const char *name,
int type, size_t *sz)
{
struct cbfs_file *file = cbfs_get_file(media, name);
if (sz)
*sz = 0;
if (file == NULL) {
ERROR("Could not find file '%s'.\n", name);
return NULL;
@ -188,7 +192,10 @@ void *cbfs_get_file_content(struct cbfs_media *media, const char *name, int type
return NULL;
}
return (void*)CBFS_SUBHEADER(file);
if (sz)
*sz = ntohl(file->len);
return (void *)CBFS_SUBHEADER(file);
}
int cbfs_decompress(int algo, void *src, void *dst, int len)