aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <dumbbell@FreeBSD.org>2022-11-11 17:36:00 +0000
committerJean-Sébastien Pédron <dumbbell@FreeBSD.org>2022-11-11 17:36:00 +0000
commitc72dd0aabe25dd4ea82e5b83d36f706d8bd2e783 (patch)
treee29dcfd45e08fb4a1832c2c84638fdee977807c0
parent415ca4d27d76e0787d65108fd96c980ea68c6eff (diff)
-rw-r--r--sys/compat/linuxkpi/common/include/linux/mm.h2
-rw-r--r--sys/compat/linuxkpi/common/src/linux_compat.c12
2 files changed, 14 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/mm.h b/sys/compat/linuxkpi/common/include/linux/mm.h
index a0a96bcdb5a2..930d588902af 100644
--- a/sys/compat/linuxkpi/common/include/linux/mm.h
+++ b/sys/compat/linuxkpi/common/include/linux/mm.h
@@ -311,4 +311,6 @@ void lkpi_unmap_mapping_range(void *obj, loff_t const holebegin __unused,
#define PAGE_ALIGNED(p) __is_aligned(p, PAGE_SIZE)
+void vma_set_file(struct vm_area_struct *vma, struct linux_file *file);
+
#endif /* _LINUXKPI_LINUX_MM_H_ */
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 1367556a6f43..26af40836c64 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -834,6 +834,18 @@ zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
return (0);
}
+void
+vma_set_file(struct vm_area_struct *vma, struct linux_file *file)
+{
+ struct linux_file *tmp;
+
+ /* Changing an anonymous vma with this is illegal */
+ get_file(file);
+ tmp = vma->vm_file;
+ vma->vm_file = file;
+ fput(tmp);
+}
+
static struct file_operations dummy_ldev_ops = {
/* XXXKIB */
};