scripts/dtc/livetree.c
Source file repositories/reference/linux-study-clean/scripts/dtc/livetree.c
File Facts
- System
- Linux kernel
- Corpus path
scripts/dtc/livetree.c- Extension
.c- Size
- 27011 bytes
- Lines
- 1316
- Domain
- Support Tooling And Documentation
- Bucket
- scripts
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
dtc.hsrcpos.h
Detected Declarations
function add_labelfunction delete_labelsfunction for_each_childfunction for_each_property_withdelfunction for_each_child_withdelfunction add_orphan_nodefunction add_propertyfunction delete_property_by_namefunction delete_propertyfunction add_childfunction delete_node_by_namefunction delete_nodefunction append_to_propertyfunction append_unique_str_to_propertyfunction append_unique_u32_to_propertyfunction propval_cellfunction propval_cell_nfunction for_each_propertyfunction for_each_childfunction for_each_propertyfunction for_each_childfunction for_each_childfunction for_each_childfunction for_each_childfunction add_phandle_propertyfunction get_node_phandlefunction guess_boot_cpuidfunction cmp_reserve_infofunction sort_reserve_entriesfunction cmp_propfunction sort_propertiesfunction cmp_subnodefunction sort_subnodesfunction sort_nodefunction sort_treefunction any_label_treefunction generate_label_tree_internalfunction for_each_labelfunction any_fixup_treefunction for_each_propertyfunction for_each_marker_of_typefunction for_each_childfunction add_fixup_entryfunction generate_fixups_tree_internalfunction for_each_propertyfunction for_each_marker_of_typefunction any_local_fixup_treefunction for_each_property
Annotated Snippet
if (streq(new->label, label)) {
new->deleted = 0;
return;
}
new = xmalloc(sizeof(*new));
memset(new, 0, sizeof(*new));
new->label = label;
new->next = *labels;
*labels = new;
}
void delete_labels(struct label **labels)
{
struct label *label;
for_each_label(*labels, label)
label->deleted = 1;
}
struct property *build_property(const char *name, struct data val,
struct srcpos *srcpos)
{
struct property *new = xmalloc(sizeof(*new));
memset(new, 0, sizeof(*new));
new->name = xstrdup(name);
new->val = val;
new->srcpos = srcpos_copy(srcpos);
return new;
}
struct property *build_property_delete(const char *name)
{
struct property *new = xmalloc(sizeof(*new));
memset(new, 0, sizeof(*new));
new->name = xstrdup(name);
new->deleted = 1;
return new;
}
struct property *chain_property(struct property *first, struct property *list)
{
assert(first->next == NULL);
first->next = list;
return first;
}
struct property *reverse_properties(struct property *first)
{
struct property *p = first;
struct property *head = NULL;
struct property *next;
while (p) {
next = p->next;
p->next = head;
head = p;
p = next;
}
return head;
}
struct node *build_node(struct property *proplist, struct node *children,
struct srcpos *srcpos)
{
struct node *new = xmalloc(sizeof(*new));
struct node *child;
memset(new, 0, sizeof(*new));
new->proplist = reverse_properties(proplist);
new->children = children;
new->srcpos = srcpos_copy(srcpos);
for_each_child(new, child) {
child->parent = new;
}
return new;
}
struct node *build_node_delete(struct srcpos *srcpos)
{
Annotation
- Immediate include surface: `dtc.h`, `srcpos.h`.
- Detected declarations: `function add_label`, `function delete_labels`, `function for_each_child`, `function for_each_property_withdel`, `function for_each_child_withdel`, `function add_orphan_node`, `function add_property`, `function delete_property_by_name`, `function delete_property`, `function add_child`.
- Atlas domain: Support Tooling And Documentation / scripts.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.