mirror of
https://github.com/dgibson/dtc.git
synced 2025-12-09 13:15:18 -05:00
libfdt: Implement fdt_move()
Implement the fdt_move() function for copying/moving device trees to a new buffer, or within an existing buffer.
This commit is contained in:
parent
ede25deae6
commit
423697628a
7 changed files with 119 additions and 24 deletions
21
fdt_ro.c
21
fdt_ro.c
|
|
@ -23,29 +23,10 @@
|
|||
|
||||
#include "libfdt_internal.h"
|
||||
|
||||
static int check_header(const struct fdt_header *fdt)
|
||||
{
|
||||
if (fdt_magic(fdt) == FDT_MAGIC) {
|
||||
/* Complete tree */
|
||||
if (fdt_version(fdt) < FDT_FIRST_SUPPORTED_VERSION)
|
||||
return FDT_ERR_BADVERSION;
|
||||
if (fdt_last_comp_version(fdt) > FDT_LAST_SUPPORTED_VERSION)
|
||||
return FDT_ERR_BADVERSION;
|
||||
} else if (fdt_magic(fdt) == SW_MAGIC) {
|
||||
/* Unfinished sequential-write blob */
|
||||
if (sw_size_dt_struct(fdt) == 0)
|
||||
return FDT_ERR_BADSTATE;
|
||||
} else {
|
||||
return FDT_ERR_BADMAGIC;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define OFFSET_CHECK_HEADER(fdt) \
|
||||
{ \
|
||||
int err; \
|
||||
if ((err = check_header(fdt)) != 0) \
|
||||
if ((err = _fdt_check_header(fdt)) != 0) \
|
||||
return OFFSET_ERROR(err); \
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue