tools/testing/vma/include/dup.h

Source file repositories/reference/linux-study-clean/tools/testing/vma/include/dup.h

File Facts

System
Linux kernel
Corpus path
tools/testing/vma/include/dup.h
Extension
.h
Size
46342 bytes
Lines
1541
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: operation-table or driver-model contract
Status
pattern implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

struct file_operations {
	int (*mmap)(struct file *, struct vm_area_struct *);
	int (*mmap_prepare)(struct vm_area_desc *);
};
struct file {
	struct address_space	*f_mapping;
	const struct file_operations	*f_op;
};
struct anon_vma_chain {
	struct anon_vma *anon_vma;
	struct list_head same_vma;
};
struct task_struct {
	char comm[TASK_COMM_LEN];
	pid_t pid;
	struct mm_struct *mm;

	/* Used for emulating ABI behavior of previous Linux versions: */
	unsigned int			personality;
};

struct kref {
	refcount_t refcount;
};

struct anon_vma_name {
	struct kref kref;
	/* The name needs to be at the end because it is dynamically sized. */
	char name[];
};

/*
 * Contains declarations that are DUPLICATED from kernel source in order to
 * faciliate userland VMA testing.
 *
 * These must be kept in sync with kernel source.
 */

#define VMA_LOCK_OFFSET	0x40000000

typedef struct { unsigned long v; } freeptr_t;

#define VM_NONE		0x00000000

typedef int __bitwise vma_flag_t;

#define ACCESS_PRIVATE(p, member) ((p)->member)

#define DECLARE_VMA_BIT(name, bitnum) \
	VMA_ ## name ## _BIT = ((__force vma_flag_t)bitnum)
#define DECLARE_VMA_BIT_ALIAS(name, aliased) \
	VMA_ ## name ## _BIT = VMA_ ## aliased ## _BIT
enum {
	DECLARE_VMA_BIT(READ, 0),
	DECLARE_VMA_BIT(WRITE, 1),
	DECLARE_VMA_BIT(EXEC, 2),
	DECLARE_VMA_BIT(SHARED, 3),
	/* mprotect() hardcodes VM_MAYREAD >> 4 == VM_READ, and so for r/w/x bits. */
	DECLARE_VMA_BIT(MAYREAD, 4),	/* limits for mprotect() etc. */
	DECLARE_VMA_BIT(MAYWRITE, 5),
	DECLARE_VMA_BIT(MAYEXEC, 6),
	DECLARE_VMA_BIT(MAYSHARE, 7),
	DECLARE_VMA_BIT(GROWSDOWN, 8),	/* general info on the segment */
#ifdef CONFIG_MMU
	DECLARE_VMA_BIT(UFFD_MISSING, 9),/* missing pages tracking */
#else
	/* nommu: R/O MAP_PRIVATE mapping that might overlay a file mapping */
	DECLARE_VMA_BIT(MAYOVERLAY, 9),
#endif /* CONFIG_MMU */
	/* Page-ranges managed without "struct page", just pure PFN */
	DECLARE_VMA_BIT(PFNMAP, 10),
	DECLARE_VMA_BIT(MAYBE_GUARD, 11),
	DECLARE_VMA_BIT(UFFD_WP, 12),	/* wrprotect pages tracking */
	DECLARE_VMA_BIT(LOCKED, 13),
	DECLARE_VMA_BIT(IO, 14),	/* Memory mapped I/O or similar */
	DECLARE_VMA_BIT(SEQ_READ, 15),	/* App will access data sequentially */
	DECLARE_VMA_BIT(RAND_READ, 16),	/* App will not benefit from clustered reads */
	DECLARE_VMA_BIT(DONTCOPY, 17),	/* Do not copy this vma on fork */
	DECLARE_VMA_BIT(DONTEXPAND, 18),/* Cannot expand with mremap() */
	DECLARE_VMA_BIT(LOCKONFAULT, 19),/* Lock pages covered when faulted in */
	DECLARE_VMA_BIT(ACCOUNT, 20),	/* Is a VM accounted object */
	DECLARE_VMA_BIT(NORESERVE, 21),	/* should the VM suppress accounting */
	DECLARE_VMA_BIT(HUGETLB, 22),	/* Huge TLB Page VM */
	DECLARE_VMA_BIT(SYNC, 23),	/* Synchronous page faults */
	DECLARE_VMA_BIT(ARCH_1, 24),	/* Architecture-specific flag */
	DECLARE_VMA_BIT(WIPEONFORK, 25),/* Wipe VMA contents in child. */
	DECLARE_VMA_BIT(DONTDUMP, 26),	/* Do not include in the core dump */
	DECLARE_VMA_BIT(SOFTDIRTY, 27),	/* NOT soft dirty clean area */
	DECLARE_VMA_BIT(MIXEDMAP, 28),	/* Can contain struct page and pure PFN pages */
	DECLARE_VMA_BIT(HUGEPAGE, 29),	/* MADV_HUGEPAGE marked this vma */

Annotation

Implementation Notes