tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c- Extension
.c- Size
- 7089 bytes
- Lines
- 353
- 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
errno.hfcntl.hstdlib.hstring.hsys/ioctl.hunistd.hasm/papr-vpd.hutils.h
Detected Declarations
struct vpd_testfunction dev_papr_vpd_open_closefunction dev_papr_vpd_get_handle_allfunction dev_papr_vpd_get_handle_byte_at_a_timefunction dev_papr_vpd_unterm_loc_codefunction dev_papr_vpd_null_handlefunction papr_vpd_close_handle_without_readingfunction papr_vpd_rereadfunction get_system_loc_codefunction papr_vpd_system_loc_codefunction main
Annotated Snippet
struct vpd_test {
int (*function)(void);
const char *description;
};
static const struct vpd_test vpd_tests[] = {
{
.function = dev_papr_vpd_open_close,
.description = "open/close " DEVPATH,
},
{
.function = dev_papr_vpd_unterm_loc_code,
.description = "ensure EINVAL on unterminated location code",
},
{
.function = dev_papr_vpd_null_handle,
.description = "ensure EFAULT on bad handle addr",
},
{
.function = dev_papr_vpd_get_handle_all,
.description = "get handle for all VPD"
},
{
.function = papr_vpd_close_handle_without_reading,
.description = "close handle without consuming VPD"
},
{
.function = dev_papr_vpd_get_handle_byte_at_a_time,
.description = "read all VPD one byte at a time"
},
{
.function = papr_vpd_reread,
.description = "ensure re-read yields same results"
},
{
.function = papr_vpd_system_loc_code,
.description = "get handle for system VPD"
},
};
int main(void)
{
size_t fails = 0;
for (size_t i = 0; i < ARRAY_SIZE(vpd_tests); ++i) {
const struct vpd_test *t = &vpd_tests[i];
if (test_harness(t->function, t->description))
++fails;
}
return fails == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
Annotation
- Immediate include surface: `errno.h`, `fcntl.h`, `stdlib.h`, `string.h`, `sys/ioctl.h`, `unistd.h`, `asm/papr-vpd.h`, `utils.h`.
- Detected declarations: `struct vpd_test`, `function dev_papr_vpd_open_close`, `function dev_papr_vpd_get_handle_all`, `function dev_papr_vpd_get_handle_byte_at_a_time`, `function dev_papr_vpd_unterm_loc_code`, `function dev_papr_vpd_null_handle`, `function papr_vpd_close_handle_without_reading`, `function papr_vpd_reread`, `function get_system_loc_code`, `function papr_vpd_system_loc_code`.
- 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.