]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - include/libfdt.h
libfdt: Add fdt_set_name() function
[karo-tx-uboot.git] / include / libfdt.h
index 6c0523685817646a260c951eb772e647c3868c13..f634a9c8df66a83f8fff8ca3c47096ffe1675e45 100644 (file)
@@ -845,6 +845,32 @@ int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size);
  */
 int fdt_del_mem_rsv(void *fdt, int n);
 
+/**
+ * fdt_set_name - change the name of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: structure block offset of a node
+ * @name: name to give the node
+ *
+ * fdt_set_name() replaces the name (including unit address, if any)
+ * of the given node with the given string.  NOTE: this function can't
+ * efficiently check if the new name is unique amongst the given
+ * node's siblings; results are undefined if this function is invoked
+ * with a name equal to one of the given node's siblings.
+ *
+ * This function may insert or delete data from the blob, and will
+ * therefore change the offsets of some existing nodes.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob
+ *             to contain the new name
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE, standard meanings
+ */
+int fdt_set_name(void *fdt, int nodeoffset, const char *name);
+
 /**
  * fdt_setprop - create or change a property
  * @fdt: pointer to the device tree blob