devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <dwg-8fk3Idey6ehBDgjK7y7TUQ@public.gmane.org>
To: Srinivas KANDAGATLA <srinivas.kandagatla-qxv4g6HH51o@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: Re: [RFC 1/2] libfdt: Add node and property realloc functions.
Date: Thu, 11 Apr 2013 11:46:32 +1000	[thread overview]
Message-ID: <20130411014632.GO8165@truffula.fritz.box> (raw)
In-Reply-To: <1365604398-18064-1-git-send-email-srinivas.kandagatla-qxv4g6HH51o@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 1541 bytes --]

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 <srinivas.kandagatla-qxv4g6HH51o@public.gmane.org>
> ---
>  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 #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 192 bytes --]

_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

  parent reply	other threads:[~2013-04-11  1:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-10 14:31 [RFC 0/2] Add node and property realloc functions Srinivas KANDAGATLA
     [not found] ` <1365604278-17956-1-git-send-email-srinivas.kandagatla-qxv4g6HH51o@public.gmane.org>
2013-04-10 14:33   ` [RFC 1/2] libfdt: " Srinivas KANDAGATLA
     [not found]     ` <1365604398-18064-1-git-send-email-srinivas.kandagatla-qxv4g6HH51o@public.gmane.org>
2013-04-11  1:46       ` David Gibson [this message]
2013-04-10 14:33   ` [RFC 2/2] fdtput: use libfdt " Srinivas KANDAGATLA
2013-04-11  1:44   ` [RFC 0/2] Add node and property " David Gibson
     [not found]     ` <20130411014439.GN8165-W9XWwYn+TF0XU02nzanrWNbf9cGiqdzd@public.gmane.org>
2013-04-11  6:52       ` Srinivas KANDAGATLA

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130411014632.GO8165@truffula.fritz.box \
    --to=dwg-8fk3idey6ehbdgjk7y7tuq@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=srinivas.kandagatla-qxv4g6HH51o@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).