tools/testing/selftests/bpf/progs/btf_dump_test_case_packing.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/btf_dump_test_case_packing.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/btf_dump_test_case_packing.c- Extension
.c- Size
- 2732 bytes
- Lines
- 154
- 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
- No C-style include directives detected by the generator.
Detected Declarations
struct packed_trailing_spacestruct non_packed_trailing_spacestruct packed_fieldsstruct non_packed_fieldsstruct nested_packedstruct nested_packed_but_aligned_structstruct outer_implicitly_packed_structstruct usb_ss_ep_comp_descriptorstruct usb_host_endpointstruct nested_packed_structstruct outer_nonpacked_structstruct outer_packed_struct
Annotated Snippet
struct packed_trailing_space {
int a;
short b;
} __attribute__((packed));
struct non_packed_trailing_space {
int a;
short b;
};
struct packed_fields {
short a;
int b;
} __attribute__((packed));
struct non_packed_fields {
short a;
int b;
};
struct nested_packed {
char: 4;
int a: 4;
long b;
struct {
char c;
int d;
} __attribute__((packed)) e;
} __attribute__((packed));
union union_is_never_packed {
int a: 4;
char b;
char c: 1;
};
union union_does_not_need_packing {
struct {
long a;
int b;
} __attribute__((packed));
int c;
};
union jump_code_union {
char code[5];
struct {
char jump;
int offset;
} __attribute__((packed));
};
/* ----- START-EXPECTED-OUTPUT ----- */
/*
*struct nested_packed_but_aligned_struct {
* int x1;
* int x2;
*};
*
*struct outer_implicitly_packed_struct {
* char y1;
* struct nested_packed_but_aligned_struct y2;
*} __attribute__((packed));
*
*/
/* ------ END-EXPECTED-OUTPUT ------ */
struct nested_packed_but_aligned_struct {
int x1;
int x2;
} __attribute__((packed));
struct outer_implicitly_packed_struct {
char y1;
struct nested_packed_but_aligned_struct y2;
};
/* ----- START-EXPECTED-OUTPUT ----- */
/*
*struct usb_ss_ep_comp_descriptor {
* char: 8;
* char bDescriptorType;
* char bMaxBurst;
* short wBytesPerInterval;
*};
*
*struct usb_host_endpoint {
* long: 64;
* char: 8;
* struct usb_ss_ep_comp_descriptor ss_ep_comp;
* long: 0;
Annotation
- Detected declarations: `struct packed_trailing_space`, `struct non_packed_trailing_space`, `struct packed_fields`, `struct non_packed_fields`, `struct nested_packed`, `struct nested_packed_but_aligned_struct`, `struct outer_implicitly_packed_struct`, `struct usb_ss_ep_comp_descriptor`, `struct usb_host_endpoint`, `struct nested_packed_struct`.
- 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.