summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2007-12-05 10:43:50 +1100
committerJon Loeliger <jdl@freescale.com>2007-12-05 08:28:44 -0600
commitefbbef8e4f86f8043760f1e48b25ab2795ba3524 (patch)
tree78ab6f7d4509d31ce0f95da33d357e00e60a6d5e /data.c
parent80c72a81cffdfde0965853d1ea834352b3e91f89 (diff)
downloaddtc-efbbef8e4f86f8043760f1e48b25ab2795ba3524.tar.gz
dtc: Implement path references
This patch extends dtc syntax to allow references (&label, or &{/full/path}) directly within property definitions, rather than inside a cell list. Such references are expanded to the full path of the referenced node, as a string, instead of to a phandle as references within cell lists are evaluated. A testcase is also included. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'data.c')
-rw-r--r--data.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/data.c b/data.c
index 3c4ab87..a94718c 100644
--- a/data.c
+++ b/data.c
@@ -202,6 +202,21 @@ struct data data_append_data(struct data d, const void *p, int len)
return d;
}
+struct data data_insert_at_marker(struct data d, struct marker *m,
+ const void *p, int len)
+{
+ d = data_grow_for(d, len);
+ memmove(d.val + m->offset + len, d.val + m->offset, d.len - m->offset);
+ memcpy(d.val + m->offset, p, len);
+ d.len += len;
+
+ /* Adjust all markers after the one we're inserting at */
+ m = m->next;
+ for_each_marker(m)
+ m->offset += len;
+ return d;
+}
+
struct data data_append_markers(struct data d, struct marker *m)
{
struct marker **mp = &d.markers;