tools/testing/vma/shared.h
Source file repositories/reference/linux-study-clean/tools/testing/vma/shared.h
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/vma/shared.h- Extension
.h- Size
- 4026 bytes
- Lines
- 133
- 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
stdbool.hstdio.hstdlib.hgenerated/bit-length.hmaple-shared.hvma_internal.h../../../mm/vma.h
Detected Declarations
function dummy_close
Annotated Snippet
if (!test_##name()) { \
(*num_fail)++; \
fprintf(stderr, "Test " #name " FAILED\n"); \
} \
} while (0)
#define ASSERT_TRUE(_expr) \
do { \
if (!(_expr)) { \
fprintf(stderr, \
"Assert FAILED at %s:%d:%s(): %s is FALSE.\n", \
__FILE__, __LINE__, __FUNCTION__, #_expr); \
return false; \
} \
} while (0)
#define ASSERT_FALSE(_expr) ASSERT_TRUE(!(_expr))
#define ASSERT_EQ(_val1, _val2) ASSERT_TRUE((_val1) == (_val2))
#define ASSERT_NE(_val1, _val2) ASSERT_TRUE((_val1) != (_val2))
#define ASSERT_FLAGS_SAME_MASK(_flags, _flags_other) \
ASSERT_TRUE(vma_flags_same_mask((_flags), (_flags_other)))
#define ASSERT_FLAGS_NOT_SAME_MASK(_flags, _flags_other) \
ASSERT_FALSE(vma_flags_same_mask((_flags), (_flags_other)))
#define ASSERT_FLAGS_SAME(_flags, ...) \
ASSERT_TRUE(vma_flags_same(_flags, __VA_ARGS__))
#define ASSERT_FLAGS_NOT_SAME(_flags, ...) \
ASSERT_FALSE(vma_flags_same(_flags, __VA_ARGS__))
#define ASSERT_FLAGS_EMPTY(_flags) \
ASSERT_TRUE(vma_flags_empty(_flags))
#define ASSERT_FLAGS_NONEMPTY(_flags) \
ASSERT_FALSE(vma_flags_empty(_flags))
#define IS_SET(_val, _flags) ((_val & _flags) == _flags)
extern bool fail_prealloc;
/* Override vma_iter_prealloc() so we can choose to fail it. */
#define vma_iter_prealloc(vmi, vma) \
(fail_prealloc ? -ENOMEM : mas_preallocate(&(vmi)->mas, (vma), GFP_KERNEL))
#define CONFIG_DEFAULT_MMAP_MIN_ADDR 65536
extern unsigned long mmap_min_addr;
extern unsigned long dac_mmap_min_addr;
extern unsigned long stack_guard_gap;
extern const struct vm_operations_struct vma_dummy_vm_ops;
extern struct anon_vma dummy_anon_vma;
extern struct task_struct __current;
/*
* Helper function which provides a wrapper around a merge existing VMA
* operation.
*
* Declared in main.c as uses static VMA function.
*/
struct vm_area_struct *merge_existing(struct vma_merge_struct *vmg);
/*
* Helper function to allocate a VMA and link it to the tree.
*
* Declared in main.c as uses static VMA function.
*/
int attach_vma(struct mm_struct *mm, struct vm_area_struct *vma);
/* Helper function providing a dummy vm_ops->close() method.*/
static inline void dummy_close(struct vm_area_struct *)
{
}
/* Helper function to simply allocate a VMA. */
struct vm_area_struct *alloc_vma(struct mm_struct *mm,
unsigned long start, unsigned long end,
pgoff_t pgoff, vma_flags_t vma_flags);
/* Helper function to detach and free a VMA. */
void detach_free_vma(struct vm_area_struct *vma);
/* Helper function to allocate a VMA and link it to the tree. */
struct vm_area_struct *alloc_and_link_vma(struct mm_struct *mm,
unsigned long start, unsigned long end,
pgoff_t pgoff, vma_flags_t vma_flags);
/*
Annotation
- Immediate include surface: `stdbool.h`, `stdio.h`, `stdlib.h`, `generated/bit-length.h`, `maple-shared.h`, `vma_internal.h`, `../../../mm/vma.h`.
- Detected declarations: `function dummy_close`.
- 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.