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
This commit is contained in:
Jean-Sébastien Pédron 2022-11-11 18:36:00 +01:00
parent 415ca4d27d
commit c72dd0aabe
No known key found for this signature in database
GPG Key ID: 39E99761A5FD94CC
2 changed files with 14 additions and 0 deletions

View File

@ -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_ */

View File

@ -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 */
};