tools/testing/memblock/tests/common.h
Source file repositories/reference/linux-study-clean/tools/testing/memblock/tests/common.h
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/memblock/tests/common.h- Extension
.h- Size
- 4222 bytes
- Lines
- 178
- 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
stdlib.hassert.hlinux/types.hlinux/seq_file.hlinux/memblock.hlinux/sizes.hlinux/printk.h../selftests/kselftest.h
Detected Declarations
struct test_memorystruct regionenum test_flagsfunction region_endfunction test_pass_popfunction run_top_downfunction run_bottom_upfunction assert_mem_content
Annotated Snippet
struct test_memory {
void *base;
};
struct region {
phys_addr_t base;
phys_addr_t size;
};
static inline phys_addr_t __maybe_unused region_end(struct memblock_region *rgn)
{
return rgn->base + rgn->size;
}
void reset_memblock_regions(void);
void reset_memblock_attributes(void);
void setup_memblock(void);
void setup_numa_memblock(const unsigned int node_fracs[]);
void dummy_physical_memory_init(void);
void dummy_physical_memory_cleanup(void);
phys_addr_t dummy_physical_memory_base(void);
void parse_args(int argc, char **argv);
void test_fail(void);
void test_pass(void);
void test_print(const char *fmt, ...);
void prefix_reset(void);
void prefix_push(const char *prefix);
void prefix_pop(void);
static inline void test_pass_pop(void)
{
test_pass();
prefix_pop();
}
static inline void run_top_down(int (*func)())
{
memblock_set_bottom_up(false);
prefix_push("top-down");
func();
prefix_pop();
}
static inline void run_bottom_up(int (*func)())
{
memblock_set_bottom_up(true);
prefix_push("bottom-up");
func();
prefix_pop();
}
static inline void assert_mem_content(void *mem, int size, int flags)
{
if (flags & TEST_F_RAW)
ASSERT_MEM_NE(mem, 0, size);
else
ASSERT_MEM_EQ(mem, 0, size);
}
#endif
Annotation
- Immediate include surface: `stdlib.h`, `assert.h`, `linux/types.h`, `linux/seq_file.h`, `linux/memblock.h`, `linux/sizes.h`, `linux/printk.h`, `../selftests/kselftest.h`.
- Detected declarations: `struct test_memory`, `struct region`, `enum test_flags`, `function region_end`, `function test_pass_pop`, `function run_top_down`, `function run_bottom_up`, `function assert_mem_content`.
- 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.