On Wed, Apr 10, 2013 at 03:33:18PM +0100, Srinivas KANDAGATLA wrote:
> libfdt has code to add new property or node or extend a property to an
> arbitary value, however it cannot be used because all the library
> functions take preallocated fdt pointer limted to a size.
> 
> Adding realloc function into libfdt can help tools like fdtput to insert
> nodes or properties or extend a property.
> 
> Without this patch if we try to add a new node/property to a dtb, the
> libfdt errors with FDT_ERR_NOSPACE.
> 
> Signed-off-by: Srinivas Kandagatla <[email protected]>
> ---
>  libfdt/fdt_rw.c |   39 +++++++++++++++++++++++++++++++++++++++
>  libfdt/libfdt.h |    4 ++++
>  2 files changed, 43 insertions(+), 0 deletions(-)
> 
> diff --git a/libfdt/fdt_rw.c b/libfdt/fdt_rw.c
> index fdba618..e7766d0 100644
> --- a/libfdt/fdt_rw.c
> +++ b/libfdt/fdt_rw.c
> @@ -52,6 +52,7 @@
>  
>  #include <fdt.h>
>  #include <libfdt.h>
> +#include <stdlib.h>

This is kind of the heart of the matter.  libfdt is supposed to be
embeddeable into bootloaders and other weird and limited environments.
For this reason we can never directly include standard libc headers.
Instead *every* dependency of libfdt must be provided by libfdt_env.h
(which can be replaced depending on your build environment).

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: Digital signature

_______________________________________________
devicetree-discuss mailing list
[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss

Reply via email to