diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2018-03-16 22:40:26 +1100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-07-19 07:01:12 +0200 |
commit | 9a7de8e2d05aade58020f10d48a69db4111ee5ac (patch) | |
tree | 03f6ba8214fbecbd1ffb942d7a1a7b3f06e18ebf /cpukit/include/libfdt.h | |
parent | libfdt: Safer access to memory reservations (diff) | |
download | rtems-9a7de8e2d05aade58020f10d48a69db4111ee5ac.tar.bz2 |
libfdt: Add fdt_header_size()
We have a couple of places within libfdt and its tests where we need to
find the size of the header, based on the version. Add a helper function
for it.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'cpukit/include/libfdt.h')
-rw-r--r-- | cpukit/include/libfdt.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cpukit/include/libfdt.h b/cpukit/include/libfdt.h index b50af54296..b81d046e54 100644 --- a/cpukit/include/libfdt.h +++ b/cpukit/include/libfdt.h @@ -245,7 +245,18 @@ fdt_set_hdr_(size_dt_struct); #undef fdt_set_hdr_ /** + * fdt_header_size - return the size of the tree's header + * @fdt: pointer to a flattened device tree + */ +size_t fdt_header_size_(uint32_t version); +static inline size_t fdt_header_size(const void *fdt) +{ + return fdt_header_size_(fdt_version(fdt)); +} + +/** * fdt_check_header - sanity check a device tree header + * @fdt: pointer to data which might be a flattened device tree * * fdt_check_header() checks that the given buffer contains what |