[RFC 0/2] Add node and property realloc functions.

Srinivas KANDAGATLA srinivas.kandagatla at st.com
Thu Apr 11 00:31:18 EST 2013


If you try to insert a new node or extend a property with large value, 
using fdtput you will notice that it always fails.

example:
fdtput -v -p -ts ./tst.dtb "/node-1" "property-1" "str10"
Error at 'node-1': FDT_ERR_NOSPACE

or

fdtput -v -c ./tst.dtb "/node-1"
Error at 'node-1': FDT_ERR_NOSPACE


fdtput -v  -ts ./tst.dtb "/node" "property" "very big value"
Decoding value:
	string: 'very big value'
Value size 15
Error at 'property': FDT_ERR_NOSPACE

All these error are returned from libfdt, as the size of the fdt passed
has not space to accomdate these new properties.

However,
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.

As libfdt has knowlege of how much space a new property or node can take.
This patch set attempts to fix this issue by adding new libary functions
fdt_realloc_property and fdt_realloc_node.

comments?

Srinivas Kandagatla (2):
  libfdt: Add node and property realloc functions.
  fdtput: use libfdt realloc functions.

 fdtput.c        |   30 +++++++++++++++++-------------
 libfdt/fdt_rw.c |   39 +++++++++++++++++++++++++++++++++++++++
 libfdt/libfdt.h |    4 ++++
 3 files changed, 60 insertions(+), 13 deletions(-)

-- 
1.7.6.5



More information about the devicetree-discuss mailing list