Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jan 2023 08:53:55 GMT
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 6024bee614f2 - stable/13 - linuxkpi: Introduce `vma_set_file()`
Message-ID:  <202301240853.30O8rtbg035659@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=6024bee614f2e90442666ebb0829f3424f975830

commit 6024bee614f2e90442666ebb0829f3424f975830
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2022-11-11 17:36:00 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2023-01-24 09:08:00 +0000

    linuxkpi: Introduce `vma_set_file()`
    
    This code was moved from the i915 driver in Linux 5.11.
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D36957
    
    (cherry picked from commit c72dd0aabe25dd4ea82e5b83d36f706d8bd2e783)
---
 sys/compat/linuxkpi/common/include/linux/mm.h |  2 ++
 sys/compat/linuxkpi/common/src/linux_compat.c | 12 ++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/mm.h b/sys/compat/linuxkpi/common/include/linux/mm.h
index dd0fb6e2d8f8..4afc1a953f8e 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 33da7dd1c8e1..082219721de1 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 */
 };



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202301240853.30O8rtbg035659>