From 0af61b6c82d7ff02426a26bf435b7c6ee768a602 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sun, 12 Jan 2014 13:45:52 +0100 Subject: lib/cbfs_core.c: Supply size of file as well in cbfs_get_file_content Change-Id: I5b93e5321e470f19ad22ca2cfdb1ebf3b340b252 Signed-off-by: Vladimir Serbinenko Reviewed-on: http://review.coreboot.org/4659 Reviewed-by: Patrick Georgi Tested-by: build bot (Jenkins) --- src/lib/cbfs_core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/lib/cbfs_core.c') diff --git a/src/lib/cbfs_core.c b/src/lib/cbfs_core.c index 612fef2a6f..839b994cf3 100644 --- a/src/lib/cbfs_core.c +++ b/src/lib/cbfs_core.c @@ -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,6 +192,9 @@ void *cbfs_get_file_content(struct cbfs_media *media, const char *name, int type return NULL; } + if (sz) + *sz = ntohl(file->len); + return (void *)CBFS_SUBHEADER(file); } -- cgit v1.2.3