aboutsummaryrefslogtreecommitdiff
path: root/include/helpers.h
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.ibm.com>2020-05-12 11:44:50 -0400
committerAlexey Kardashevskiy <aik@ozlabs.ru>2020-05-13 11:25:23 +1000
commit8df4a179ab5a8a2e4a185998aa0dd5d8e80b254e (patch)
tree74abb178f4199319b4e87547291b270b8014cbf3 /include/helpers.h
parentd04fea6ab0431e81e43a9ce5b1ec33e0c2ea66eb (diff)
downloadSLOF-8df4a179ab5a8a2e4a185998aa0dd5d8e80b254e.zip
SLOF-8df4a179ab5a8a2e4a185998aa0dd5d8e80b254e.tar.gz
SLOF-8df4a179ab5a8a2e4a185998aa0dd5d8e80b254e.tar.bz2
elf: Implement elf_get_file_size to determine size of an ELF image
Implement elf_get_file_size to determine the size of an ELF image that has been loaded into a buffer much larger than the actual size of the original file. We determine the size by searching for the farthest offset declared by the ELF headers. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'include/helpers.h')
-rw-r--r--include/helpers.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/helpers.h b/include/helpers.h
index 47b2674..112184f 100644
--- a/include/helpers.h
+++ b/include/helpers.h
@@ -51,5 +51,7 @@ extern unsigned long SLOF_get_vtpm_unit(void);
const typeof(((type *)0)->member)* struct_ptr = (ptr); \
(type *)((char *)struct_ptr - offset_of(type, member)); })
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
+#define ROUNDUP(x,v) ((((x) + ((v) - 1)) / (v)) * (v))
+#define MAX(x,y) ((x) > (y) ? (x) : (y))
#endif