Changeset a1c3b41a in rtems for cpukit/dtc


Ignore:
Timestamp:
Jul 27, 2017, 4:33:11 PM (2 years ago)
Author:
Pantelis Antoniou <pantelis.antoniou@…>
Branches:
master
Children:
f5e879f
Parents:
903d2ec
git-author:
Pantelis Antoniou <pantelis.antoniou@…> (07/27/17 16:33:11)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/19/18 05:01:11)
Message:

Introduce fdt_setprop_placeholder() method

In some cases you need to add a property but the contents of it
are not known at creation time, merely the extend of it.

This method allows you to create a property of a given size (filled
with garbage) while a pointer to the property data will be provided.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@…>
[dwg: Corrected commit message]
Signed-off-by: David Gibson <david@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/dtc/libfdt/fdt_rw.c

    r903d2ec ra1c3b41a  
    270270}
    271271
    272 int fdt_setprop(void *fdt, int nodeoffset, const char *name,
    273                 const void *val, int len)
     272int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name,
     273                            int len, void **prop_data)
    274274{
    275275        struct fdt_property *prop;
     
    284284                return err;
    285285
     286        *prop_data = prop->data;
     287        return 0;
     288}
     289
     290int fdt_setprop(void *fdt, int nodeoffset, const char *name,
     291                const void *val, int len)
     292{
     293        void *prop_data;
     294        int err;
     295
     296        err = fdt_setprop_placeholder(fdt, nodeoffset, name, len, &prop_data);
     297        if (err)
     298                return err;
     299
    286300        if (len)
    287                 memcpy(prop->data, val, len);
     301                memcpy(prop_data, val, len);
    288302        return 0;
    289303}
Note: See TracChangeset for help on using the changeset viewer.