tools/power/acpi/tools/pfrut/pfrut.c
Source file repositories/reference/linux-study-clean/tools/power/acpi/tools/pfrut/pfrut.c
File Facts
- System
- Linux kernel
- Corpus path
tools/power/acpi/tools/pfrut/pfrut.c- Extension
.c- Size
- 9603 bytes
- Lines
- 442
- 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.hstring.hsys/types.hsys/stat.hfcntl.hunistd.hgetopt.hsys/ioctl.hsys/mman.huuid/uuid.h
Detected Declarations
function valid_log_levelfunction valid_log_typefunction valid_log_revidfunction helpfunction parse_optionsfunction print_capfunction main
Annotated Snippet
switch (opt) {
case 'l':
capsule_name = optarg;
break;
case 's':
action = 1;
break;
case 'a':
action = 2;
break;
case 'u':
action = 3;
break;
case 'q':
query_cap = 1;
break;
case 'G':
log_getinfo = 1;
break;
case 'T':
log_type = strtol(optarg, &endptr, 0);
if (*endptr || (log_type != 0 && log_type != 1)) {
printf("Number expected: type(0:execution, 1:history) - Quit.\n");
exit(1);
}
set_log_type = 1;
break;
case 'L':
log_level = strtol(optarg, &endptr, 0);
if (*endptr ||
(log_level != 0 && log_level != 1 &&
log_level != 2 && log_level != 4)) {
printf("Number expected: level(0, 1, 2, 4) - Quit.\n");
exit(1);
}
set_log_level = 1;
break;
case 'R':
log_read = 1;
break;
case 'd':
revid = atoi(optarg);
set_revid = 1;
break;
case 'D':
log_revid = atoi(optarg);
set_log_revid = 1;
break;
case 'h':
help();
exit(0);
default:
break;
}
}
}
void print_cap(struct pfru_update_cap_info *cap)
{
char *uuid;
uuid = malloc(37);
if (!uuid) {
perror("Can not allocate uuid buffer\n");
exit(1);
}
printf("update capability:%d\n", cap->update_cap);
uuid_unparse(cap->code_type, uuid);
printf("code injection image type:%s\n", uuid);
printf("fw_version:%d\n", cap->fw_version);
printf("code_rt_version:%d\n", cap->code_rt_version);
uuid_unparse(cap->drv_type, uuid);
printf("driver update image type:%s\n", uuid);
printf("drv_rt_version:%d\n", cap->drv_rt_version);
printf("drv_svn:%d\n", cap->drv_svn);
uuid_unparse(cap->platform_id, uuid);
printf("platform id:%s\n", uuid);
uuid_unparse(cap->oem_id, uuid);
printf("oem id:%s\n", uuid);
printf("oem information length:%d\n", cap->oem_info_len);
free(uuid);
}
Annotation
- Immediate include surface: `stdio.h`, `stdlib.h`, `string.h`, `sys/types.h`, `sys/stat.h`, `fcntl.h`, `unistd.h`, `getopt.h`.
- Detected declarations: `function valid_log_level`, `function valid_log_type`, `function valid_log_revid`, `function help`, `function parse_options`, `function print_cap`, `function main`.
- 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.