vma.c (955db39676b6de84283b370d03683171b67dceb3) | vma.c (2f1c6611b0a89afcb8641471af5f223c9caa01e0) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2 3#include <stdbool.h> 4#include <stdio.h> 5#include <stdlib.h> 6 7#include "maple-shared.h" 8#include "vma_internal.h" --- 8 unchanged lines hidden (view full) --- 17 (fail_prealloc ? -ENOMEM : mas_preallocate(&(vmi)->mas, (vma), GFP_KERNEL)) 18 19/* 20 * Directly import the VMA implementation here. Our vma_internal.h wrapper 21 * provides userland-equivalent functionality for everything vma.c uses. 22 */ 23#include "../../../mm/vma.c" 24 | 1// SPDX-License-Identifier: GPL-2.0-or-later 2 3#include <stdbool.h> 4#include <stdio.h> 5#include <stdlib.h> 6 7#include "maple-shared.h" 8#include "vma_internal.h" --- 8 unchanged lines hidden (view full) --- 17 (fail_prealloc ? -ENOMEM : mas_preallocate(&(vmi)->mas, (vma), GFP_KERNEL)) 18 19/* 20 * Directly import the VMA implementation here. Our vma_internal.h wrapper 21 * provides userland-equivalent functionality for everything vma.c uses. 22 */ 23#include "../../../mm/vma.c" 24 |
25/* 26 * Temporarily forward-ported from a future in which vmg's are used for merging. 27 */ 28struct vma_merge_struct { 29 struct mm_struct *mm; 30 struct vma_iterator *vmi; 31 pgoff_t pgoff; 32 struct vm_area_struct *prev; 33 struct vm_area_struct *next; /* Modified by vma_merge(). */ 34 struct vm_area_struct *vma; /* Either a new VMA or the one being modified. */ 35 unsigned long start; 36 unsigned long end; 37 unsigned long flags; 38 struct file *file; 39 struct anon_vma *anon_vma; 40 struct mempolicy *policy; 41 struct vm_userfaultfd_ctx uffd_ctx; 42 struct anon_vma_name *anon_name; 43}; 44 | |
45const struct vm_operations_struct vma_dummy_vm_ops; 46static struct anon_vma dummy_anon_vma; 47 48#define ASSERT_TRUE(_expr) \ 49 do { \ 50 if (!(_expr)) { \ 51 fprintf(stderr, \ 52 "Assert FAILED at %s:%d:%s(): %s is FALSE.\n", \ --- 57 unchanged lines hidden (view full) --- 110 vma->vm_lock_seq = -1; 111 112 return vma; 113} 114 115/* Helper function which provides a wrapper around a merge new VMA operation. */ 116static struct vm_area_struct *merge_new(struct vma_merge_struct *vmg) 117{ | 25const struct vm_operations_struct vma_dummy_vm_ops; 26static struct anon_vma dummy_anon_vma; 27 28#define ASSERT_TRUE(_expr) \ 29 do { \ 30 if (!(_expr)) { \ 31 fprintf(stderr, \ 32 "Assert FAILED at %s:%d:%s(): %s is FALSE.\n", \ --- 57 unchanged lines hidden (view full) --- 90 vma->vm_lock_seq = -1; 91 92 return vma; 93} 94 95/* Helper function which provides a wrapper around a merge new VMA operation. */ 96static struct vm_area_struct *merge_new(struct vma_merge_struct *vmg) 97{ |
118 /* vma_merge() needs a VMA to determine mm, anon_vma, and file. */ 119 struct vm_area_struct dummy = { 120 .vm_mm = vmg->mm, 121 .vm_flags = vmg->flags, 122 .anon_vma = vmg->anon_vma, 123 .vm_file = vmg->file, 124 }; 125 | |
126 /* 127 * For convenience, get prev and next VMAs. Which the new VMA operation 128 * requires. 129 */ 130 vmg->next = vma_next(vmg->vmi); 131 vmg->prev = vma_prev(vmg->vmi); 132 133 vma_iter_set(vmg->vmi, vmg->start); | 98 /* 99 * For convenience, get prev and next VMAs. Which the new VMA operation 100 * requires. 101 */ 102 vmg->next = vma_next(vmg->vmi); 103 vmg->prev = vma_prev(vmg->vmi); 104 105 vma_iter_set(vmg->vmi, vmg->start); |
134 return vma_merge_new_vma(vmg->vmi, vmg->prev, &dummy, vmg->start, 135 vmg->end, vmg->pgoff); | 106 return vma_merge(vmg); |
136} 137 138/* 139 * Helper function which provides a wrapper around a merge existing VMA 140 * operation. 141 */ 142static struct vm_area_struct *merge_existing(struct vma_merge_struct *vmg) 143{ | 107} 108 109/* 110 * Helper function which provides a wrapper around a merge existing VMA 111 * operation. 112 */ 113static struct vm_area_struct *merge_existing(struct vma_merge_struct *vmg) 114{ |
144 /* vma_merge() needs a VMA to determine mm, anon_vma, and file. */ 145 struct vm_area_struct dummy = { 146 .vm_mm = vmg->mm, 147 .vm_flags = vmg->flags, 148 .anon_vma = vmg->anon_vma, 149 .vm_file = vmg->file, 150 }; 151 152 return vma_merge(vmg->vmi, vmg->prev, &dummy, vmg->start, vmg->end, 153 vmg->flags, vmg->pgoff, vmg->policy, vmg->uffd_ctx, 154 vmg->anon_name); | 115 return vma_merge(vmg); |
155} 156 157/* 158 * Helper function which provides a wrapper around the expansion of an existing 159 * VMA. 160 */ 161static int expand_existing(struct vma_merge_struct *vmg) 162{ --- 1317 unchanged lines hidden --- | 116} 117 118/* 119 * Helper function which provides a wrapper around the expansion of an existing 120 * VMA. 121 */ 122static int expand_existing(struct vma_merge_struct *vmg) 123{ --- 1317 unchanged lines hidden --- |