mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-29 05:12:59 +01:00
relay: update relay to use mmap_prepare
It is relatively trivial to update this code to use the f_op->mmap_prepare hook in favour of the deprecated f_op->mmap hook, so do so. Link: https://lkml.kernel.org/r/7c9e82cdddf8b573ea3edb8cdb697363e3ccb5d7.1760959442.git.lorenzo.stoakes@oracle.com Signed-off-by: Lorenzo Stoakes <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Pedro Falcato <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Al Viro <[email protected]> Cc: Andreas Larsson <[email protected]> Cc: Andrey Konovalov <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Baolin Wang <[email protected]> Cc: Baoquan He <[email protected]> Cc: Chatre, Reinette <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Christian Brauner <[email protected]> Cc: Dan Williams <[email protected]> Cc: Dave Jiang <[email protected]> Cc: Dave Martin <[email protected]> Cc: Dave Young <[email protected]> Cc: David S. Miller <[email protected]> Cc: Dmitriy Vyukov <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Guo Ren <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: James Morse <[email protected]> Cc: Jan Kara <[email protected]> Cc: Jann Horn <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Kevin Tian <[email protected]> Cc: Konstantin Komarov <[email protected]> Cc: Liam Howlett <[email protected]> Cc: "Luck, Tony" <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Muchun Song <[email protected]> Cc: Nicolas Pitre <[email protected]> Cc: Oscar Salvador <[email protected]> Cc: Robin Murohy <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Cc: Sven Schnelle <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: "Uladzislau Rezki (Sony)" <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Vishal Verma <[email protected]> Cc: Vivek Goyal <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
This commit is contained in:
1 parent
54c58a2f5f
commit
651fdda840
1 file changed
+17
-16
+17
-16
@@ -72,17 +72,18 @@ static void relay_free_page_array(struct page **array)
|
||||
}
|
||||
|
||||
/**
|
||||
* relay_mmap_buf: - mmap channel buffer to process address space
|
||||
* @buf: relay channel buffer
|
||||
* @vma: vm_area_struct describing memory to be mapped
|
||||
* relay_mmap_prepare_buf: - mmap channel buffer to process address space
|
||||
* @buf: the relay channel buffer
|
||||
* @desc: describing what to map
|
||||
*
|
||||
* Returns 0 if ok, negative on error
|
||||
*
|
||||
* Caller should already have grabbed mmap_lock.
|
||||
*/
|
||||
static int relay_mmap_buf(struct rchan_buf *buf, struct vm_area_struct *vma)
|
||||
static int relay_mmap_prepare_buf(struct rchan_buf *buf,
|
||||
struct vm_area_desc *desc)
|
||||
{
|
||||
unsigned long length = vma->vm_end - vma->vm_start;
|
||||
unsigned long length = vma_desc_size(desc);
|
||||
|
||||
if (!buf)
|
||||
return -EBADF;
|
||||
@@ -90,9 +91,9 @@ static int relay_mmap_buf(struct rchan_buf *buf, struct vm_area_struct *vma)
|
||||
if (length != (unsigned long)buf->chan->alloc_size)
|
||||
return -EINVAL;
|
||||
|
||||
vma->vm_ops = &relay_file_mmap_ops;
|
||||
vm_flags_set(vma, VM_DONTEXPAND);
|
||||
vma->vm_private_data = buf;
|
||||
desc->vm_ops = &relay_file_mmap_ops;
|
||||
desc->vm_flags |= VM_DONTEXPAND;
|
||||
desc->private_data = buf;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -749,16 +750,16 @@ static int relay_file_open(struct inode *inode, struct file *filp)
|
||||
}
|
||||
|
||||
/**
|
||||
* relay_file_mmap - mmap file op for relay files
|
||||
* @filp: the file
|
||||
* @vma: the vma describing what to map
|
||||
* relay_file_mmap_prepare - mmap file op for relay files
|
||||
* @desc: describing what to map
|
||||
*
|
||||
* Calls upon relay_mmap_buf() to map the file into user space.
|
||||
* Calls upon relay_mmap_prepare_buf() to map the file into user space.
|
||||
*/
|
||||
static int relay_file_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
static int relay_file_mmap_prepare(struct vm_area_desc *desc)
|
||||
{
|
||||
struct rchan_buf *buf = filp->private_data;
|
||||
return relay_mmap_buf(buf, vma);
|
||||
struct rchan_buf *buf = desc->file->private_data;
|
||||
|
||||
return relay_mmap_prepare_buf(buf, desc);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1006,7 +1007,7 @@ static ssize_t relay_file_read(struct file *filp,
|
||||
const struct file_operations relay_file_operations = {
|
||||
.open = relay_file_open,
|
||||
.poll = relay_file_poll,
|
||||
.mmap = relay_file_mmap,
|
||||
.mmap_prepare = relay_file_mmap_prepare,
|
||||
.read = relay_file_read,
|
||||
.release = relay_file_release,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user