diff options
| author | Chen-Yu Tsai <wens@csie.org> | 2025-07-15 18:34:10 +0300 |
|---|---|---|
| committer | Chen-Yu Tsai <wens@csie.org> | 2025-07-15 18:34:10 +0300 |
| commit | ca5ad734d30f30a577f705926d6e16a87513a2a7 (patch) | |
| tree | b5fb169a86ac59892bd3b60c2df13e8a7cef360d /mm/vma.h | |
| parent | 082c6a2d06c0831d236760a29953355845eee988 (diff) | |
| parent | f99d4fccd2185176baf4ecac9a49d280fc62b953 (diff) | |
| download | linux-ca5ad734d30f30a577f705926d6e16a87513a2a7.tar.xz | |
Merge branch 'dt' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm into sunxi/dt-for-6.17
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Diffstat (limited to 'mm/vma.h')
| -rw-r--r-- | mm/vma.h | 47 |
1 files changed, 47 insertions, 0 deletions
@@ -222,6 +222,53 @@ static inline int vma_iter_store_gfp(struct vma_iterator *vmi, return 0; } + +/* + * Temporary helper functions for file systems which wrap an invocation of + * f_op->mmap() but which might have an underlying file system which implements + * f_op->mmap_prepare(). + */ + +static inline struct vm_area_desc *vma_to_desc(struct vm_area_struct *vma, + struct vm_area_desc *desc) +{ + desc->mm = vma->vm_mm; + desc->start = vma->vm_start; + desc->end = vma->vm_end; + + desc->pgoff = vma->vm_pgoff; + desc->file = vma->vm_file; + desc->vm_flags = vma->vm_flags; + desc->page_prot = vma->vm_page_prot; + + desc->vm_ops = NULL; + desc->private_data = NULL; + + return desc; +} + +static inline void set_vma_from_desc(struct vm_area_struct *vma, + struct vm_area_desc *desc) +{ + /* + * Since we're invoking .mmap_prepare() despite having a partially + * established VMA, we must take care to handle setting fields + * correctly. + */ + + /* Mutable fields. Populated with initial state. */ + vma->vm_pgoff = desc->pgoff; + if (vma->vm_file != desc->file) + vma_set_file(vma, desc->file); + if (vma->vm_flags != desc->vm_flags) + vm_flags_set(vma, desc->vm_flags); + vma->vm_page_prot = desc->page_prot; + + /* User-defined fields. */ + vma->vm_ops = desc->vm_ops; + vma->vm_private_data = desc->private_data; +} + int do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma, struct mm_struct *mm, unsigned long start, |
