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>
This commit is contained in:
@@ -244,8 +244,19 @@ fdt_set_hdr_(size_dt_strings);
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user