MCPcopy Create free account
hub / github.com/F-Stack/f-stack / fdt_get_name

Function fdt_get_name

freebsd/contrib/libfdt/fdt_ro.c:234–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232}
233
234const char *fdt_get_name(const void *fdt, int nodeoffset, int *len)
235{
236 const struct fdt_node_header *nh = fdt_offset_ptr_(fdt, nodeoffset);
237 const char *nameptr;
238 int err;
239
240 if (((err = fdt_check_header(fdt)) != 0)
241 || ((err = fdt_check_node_offset_(fdt, nodeoffset)) < 0))
242 goto fail;
243
244 nameptr = nh->name;
245
246 if (fdt_version(fdt) < 0x10) {
247 /*
248 * For old FDT versions, match the naming conventions of V16:
249 * give only the leaf name (after all /). The actual tree
250 * contents are loosely checked.
251 */
252 const char *leaf;
253 leaf = strrchr(nameptr, '/');
254 if (leaf == NULL) {
255 err = -FDT_ERR_BADSTRUCTURE;
256 goto fail;
257 }
258 nameptr = leaf+1;
259 }
260
261 if (len)
262 *len = strlen(nameptr);
263
264 return nameptr;
265
266 fail:
267 if (len)
268 *len = err;
269 return NULL;
270}
271
272int fdt_first_property_offset(const void *fdt, int nodeoffset)
273{

Callers 7

fdt_nodename_eq_Function · 0.85
fdt_get_pathFunction · 0.85
overlay_apply_nodeFunction · 0.85
get_path_lenFunction · 0.85
fdt_set_nameFunction · 0.85
max10_sensor_initFunction · 0.85

Calls 4

fdt_offset_ptr_Function · 0.85
fdt_check_headerFunction · 0.85
fdt_check_node_offset_Function · 0.85
strrchrFunction · 0.85

Tested by

no test coverage detected