tools/bootconfig/main.c
Source file repositories/reference/linux-study-clean/tools/bootconfig/main.c
File Facts
- System
- Linux kernel
- Corpus path
tools/bootconfig/main.c- Extension
.c- Size
- 12205 bytes
- Lines
- 583
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- 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
stdio.hstdlib.hsys/types.hsys/stat.hfcntl.hunistd.hstring.herrno.hendian.hassert.hlinux/bootconfig.h
Detected Declarations
function xbc_show_valuefunction xbc_show_compact_treefunction keyfunction keyfunction xbc_show_listfunction xbc_for_each_key_valuefunction load_xbc_fdfunction load_xbc_filefunction pr_errnofunction load_xbc_from_initrdfunction show_xbc_errorfunction init_xbc_with_errorfunction show_xbc_kernel_cmdlinefunction show_xbcfunction delete_xbcfunction apply_xbcfunction usagefunction main
Annotated Snippet
while (cnode && xbc_node_is_key(cnode) && !cnode->next) {
vnode = xbc_node_get_child(cnode);
/*
* If @cnode has value and subkeys, this
* should show it as below.
*
* key(@node) {
* key(@cnode) = value;
* key(@cnode) {
* subkeys;
* }
* }
*/
if (vnode && xbc_node_is_value(vnode) && vnode->next)
break;
printf("%s.", xbc_node_get_data(node));
node = cnode;
cnode = vnode;
}
if (cnode && xbc_node_is_key(cnode)) {
printf("%s {\n", xbc_node_get_data(node));
depth++;
node = cnode;
cnode = NULL;
continue;
} else if (cnode && xbc_node_is_value(cnode)) {
printf("%s = ", xbc_node_get_data(node));
xbc_show_value(cnode, true);
/*
* If @node has value and subkeys, continue
* looping on subkeys with same node.
*/
if (cnode->next) {
cnode = xbc_node_get_next(cnode);
continue;
}
} else {
printf("%s;\n", xbc_node_get_data(node));
}
cnode = NULL;
if (node->next) {
node = xbc_node_get_next(node);
continue;
}
while (!node->next) {
node = xbc_node_get_parent(node);
if (!node)
return;
if (!xbc_node_get_child(node)->next)
continue;
if (depth) {
depth--;
for (i = 0; i < depth; i++)
printf("\t");
printf("}\n");
}
}
node = xbc_node_get_next(node);
}
}
static void xbc_show_list(void)
{
char key[XBC_KEYLEN_MAX];
struct xbc_node *leaf;
const char *val;
int ret;
xbc_for_each_key_value(leaf, val) {
ret = xbc_node_compose_key(leaf, key, XBC_KEYLEN_MAX);
if (ret < 0) {
fprintf(stderr, "Failed to compose key %d\n", ret);
break;
}
printf("%s = ", key);
if (!val || val[0] == '\0') {
printf("\"\"\n");
continue;
}
xbc_show_value(xbc_node_get_child(leaf), false);
}
}
#define PAGE_SIZE 4096
static int load_xbc_fd(int fd, char **buf, int size)
{
int ret;
Annotation
- Immediate include surface: `stdio.h`, `stdlib.h`, `sys/types.h`, `sys/stat.h`, `fcntl.h`, `unistd.h`, `string.h`, `errno.h`.
- Detected declarations: `function xbc_show_value`, `function xbc_show_compact_tree`, `function key`, `function key`, `function xbc_show_list`, `function xbc_for_each_key_value`, `function load_xbc_fd`, `function load_xbc_file`, `function pr_errno`, `function load_xbc_from_initrd`.
- Atlas domain: Support Tooling And Documentation / tools.
- 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.