@@ -18,7 +18,8 @@
static unsigned char __HOSTLINK__[4 * PAGE_SIZE] __aligned(PAGE_SIZE);
-static int arc_hl_mmap(struct file *fp, struct vm_area_struct *vma)
+static int arc_hl_mmap(struct file *fp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
@@ -111,7 +111,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
base = mmap_region(NULL, STACK_TOP, PAGE_SIZE,
VM_READ|VM_WRITE|VM_EXEC|
VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
- 0, NULL);
+ 0, NULL, 0);
if (IS_ERR_VALUE(base)) {
ret = base;
goto out;
@@ -41,7 +41,8 @@ static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes
PDE_DATA(file_inode(file)), PAGE_SIZE);
}
-static int page_map_mmap( struct file *file, struct vm_area_struct *vma )
+static int page_map_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
if ((vma->vm_end - vma->vm_start) > PAGE_SIZE)
return -EINVAL;
@@ -255,7 +255,8 @@ static const struct vm_operations_struct kvm_spapr_tce_vm_ops = {
.fault = kvm_spapr_tce_fault,
};
-static int kvm_spapr_tce_mmap(struct file *file, struct vm_area_struct *vma)
+static int kvm_spapr_tce_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
vma->vm_ops = &kvm_spapr_tce_vm_ops;
return 0;
@@ -291,7 +291,8 @@ static const struct vm_operations_struct spufs_mem_mmap_vmops = {
.access = spufs_mem_mmap_access,
};
-static int spufs_mem_mmap(struct file *file, struct vm_area_struct *vma)
+static int spufs_mem_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
if (!(vma->vm_flags & VM_SHARED))
return -EINVAL;
@@ -379,7 +380,8 @@ static const struct vm_operations_struct spufs_cntl_mmap_vmops = {
/*
* mmap support for problem state control area [0x4000 - 0x4fff].
*/
-static int spufs_cntl_mmap(struct file *file, struct vm_area_struct *vma)
+static int spufs_cntl_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
if (!(vma->vm_flags & VM_SHARED))
return -EINVAL;
@@ -1059,7 +1061,8 @@ static const struct vm_operations_struct spufs_signal1_mmap_vmops = {
.fault = spufs_signal1_mmap_fault,
};
-static int spufs_signal1_mmap(struct file *file, struct vm_area_struct *vma)
+static int spufs_signal1_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
if (!(vma->vm_flags & VM_SHARED))
return -EINVAL;
@@ -1197,7 +1200,8 @@ static const struct vm_operations_struct spufs_signal2_mmap_vmops = {
.fault = spufs_signal2_mmap_fault,
};
-static int spufs_signal2_mmap(struct file *file, struct vm_area_struct *vma)
+static int spufs_signal2_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
if (!(vma->vm_flags & VM_SHARED))
return -EINVAL;
@@ -1320,7 +1324,8 @@ static const struct vm_operations_struct spufs_mss_mmap_vmops = {
/*
* mmap support for problem state MFC DMA area [0x0000 - 0x0fff].
*/
-static int spufs_mss_mmap(struct file *file, struct vm_area_struct *vma)
+static int spufs_mss_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
if (!(vma->vm_flags & VM_SHARED))
return -EINVAL;
@@ -1382,7 +1387,8 @@ static const struct vm_operations_struct spufs_psmap_mmap_vmops = {
/*
* mmap support for full problem state area [0x00000 - 0x1ffff].
*/
-static int spufs_psmap_mmap(struct file *file, struct vm_area_struct *vma)
+static int spufs_psmap_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
if (!(vma->vm_flags & VM_SHARED))
return -EINVAL;
@@ -1442,7 +1448,8 @@ static const struct vm_operations_struct spufs_mfc_mmap_vmops = {
/*
* mmap support for problem state MFC DMA area [0x0000 - 0x0fff].
*/
-static int spufs_mfc_mmap(struct file *file, struct vm_area_struct *vma)
+static int spufs_mfc_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
if (!(vma->vm_flags & VM_SHARED))
return -EINVAL;
@@ -109,7 +109,8 @@ static int opal_prd_open(struct inode *inode, struct file *file)
* @vma: VMA to map the registers into
*/
-static int opal_prd_mmap(struct file *file, struct vm_area_struct *vma)
+static int opal_prd_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
size_t addr, size;
pgprot_t page_prot;
@@ -45,7 +45,8 @@ static long mmapper_ioctl(struct file *file, unsigned int cmd, unsigned long arg
return -ENOIOCTLCMD;
}
-static int mmapper_mmap(struct file *file, struct vm_area_struct *vma)
+static int mmapper_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
int ret = -EINVAL;
int size;
@@ -3354,7 +3354,8 @@ static const struct vm_operations_struct binder_vm_ops = {
.fault = binder_vm_fault,
};
-static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
+static int binder_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
int ret;
struct vm_struct *area;
@@ -562,7 +562,8 @@ int agp_remove_client(pid_t id)
/* File Operations */
-static int agp_mmap(struct file *file, struct vm_area_struct *vma)
+static int agp_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
unsigned int size, current_size;
unsigned long offset;
@@ -122,7 +122,8 @@ static struct attribute *bsr_dev_attrs[] = {
};
ATTRIBUTE_GROUPS(bsr_dev);
-static int bsr_mmap(struct file *filp, struct vm_area_struct *vma)
+static int bsr_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
unsigned long size = vma->vm_end - vma->vm_start;
struct bsr_dev *dev = filp->private_data;
@@ -379,7 +379,8 @@ static __init int hpet_mmap_enable(char *str)
}
__setup("hpet_mmap", hpet_mmap_enable);
-static int hpet_mmap(struct file *file, struct vm_area_struct *vma)
+static int hpet_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct hpet_dev *devp;
unsigned long addr;
@@ -397,7 +398,8 @@ static int hpet_mmap(struct file *file, struct vm_area_struct *vma)
return vm_iomap_memory(vma, addr, PAGE_SIZE);
}
#else
-static int hpet_mmap(struct file *file, struct vm_area_struct *vma)
+static int hpet_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
return -ENOSYS;
}
@@ -475,7 +475,8 @@ static void mbcs_gscr_pioaddr_set(struct mbcs_soft *soft)
soft->gscr_addr = mbcs_pioaddr(soft, MBCS_GSCR_START);
}
-static int mbcs_gscr_mmap(struct file *fp, struct vm_area_struct *vma)
+static int mbcs_gscr_mmap(struct file *fp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct cx_dev *cx_dev = fp->private_data;
struct mbcs_soft *soft = cx_dev->soft;
@@ -548,6 +548,7 @@ static ssize_t mbcs_sram_read(struct file *fp, char __user *buf, size_t len,
static ssize_t mbcs_sram_write(struct file *fp, const char __user *buf, size_t len,
loff_t * off);
static loff_t mbcs_sram_llseek(struct file *filp, loff_t off, int whence);
-static int mbcs_gscr_mmap(struct file *fp, struct vm_area_struct *vma);
+static int mbcs_gscr_mmap(struct file *fp, struct vm_area_struct *vma,
+ unsigned long map_flags);
#endif // __MBCS_H__
@@ -337,7 +337,8 @@ static const struct vm_operations_struct mmap_mem_ops = {
#endif
};
-static int mmap_mem(struct file *file, struct vm_area_struct *vma)
+static int mmap_mem(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
size_t size = vma->vm_end - vma->vm_start;
phys_addr_t offset = (phys_addr_t)vma->vm_pgoff << PAGE_SHIFT;
@@ -376,7 +377,8 @@ static int mmap_mem(struct file *file, struct vm_area_struct *vma)
return 0;
}
-static int mmap_kmem(struct file *file, struct vm_area_struct *vma)
+static int mmap_kmem(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
unsigned long pfn;
@@ -394,7 +396,7 @@ static int mmap_kmem(struct file *file, struct vm_area_struct *vma)
return -EIO;
vma->vm_pgoff = pfn;
- return mmap_mem(file, vma);
+ return mmap_mem(file, vma, 0);
}
/*
@@ -679,7 +681,8 @@ static ssize_t read_iter_zero(struct kiocb *iocb, struct iov_iter *iter)
return written;
}
-static int mmap_zero(struct file *file, struct vm_area_struct *vma)
+static int mmap_zero(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
#ifndef CONFIG_MMU
return -ENOSYS;
@@ -287,19 +287,22 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma,
}
static int
-fetchop_mmap(struct file *file, struct vm_area_struct *vma)
+fetchop_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
return mspec_mmap(file, vma, MSPEC_FETCHOP);
}
static int
-cached_mmap(struct file *file, struct vm_area_struct *vma)
+cached_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
return mspec_mmap(file, vma, MSPEC_CACHED);
}
static int
-uncached_mmap(struct file *file, struct vm_area_struct *vma)
+uncached_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
return mspec_mmap(file, vma, MSPEC_UNCACHED);
}
@@ -40,7 +40,8 @@ MODULE_LICENSE("GPL");
static long uv_mmtimer_ioctl(struct file *file, unsigned int cmd,
unsigned long arg);
-static int uv_mmtimer_mmap(struct file *file, struct vm_area_struct *vma);
+static int uv_mmtimer_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags);
/*
* Period in femtoseconds (10^-15 s)
@@ -144,7 +145,8 @@ static long uv_mmtimer_ioctl(struct file *file, unsigned int cmd,
* Calls remap_pfn_range() to map the clock's registers into
* the calling process' address space.
*/
-static int uv_mmtimer_mmap(struct file *file, struct vm_area_struct *vma)
+static int uv_mmtimer_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
unsigned long uv_mmtimer_addr;
@@ -432,7 +432,8 @@ static const struct vm_operations_struct dax_vm_ops = {
.huge_fault = dev_dax_huge_fault,
};
-static int dax_mmap(struct file *filp, struct vm_area_struct *vma)
+static int dax_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct dev_dax *dev_dax = filp->private_data;
int rc, id;
@@ -81,7 +81,9 @@ static int dma_buf_release(struct inode *inode, struct file *file)
return 0;
}
-static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma)
+static int dma_buf_mmap_internal(struct file *file,
+ struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct dma_buf *dmabuf;
@@ -1667,7 +1667,8 @@ static long fw_device_op_compat_ioctl(struct file *file,
}
#endif
-static int fw_device_op_mmap(struct file *file, struct vm_area_struct *vma)
+static int fw_device_op_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct client *client = file->private_data;
unsigned long size;
@@ -1240,7 +1240,8 @@ void amdgpu_ttm_set_active_vram_size(struct amdgpu_device *adev, u64 size)
man->size = size >> PAGE_SHIFT;
}
-int amdgpu_mmap(struct file *filp, struct vm_area_struct *vma)
+int amdgpu_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_file *file_priv;
struct amdgpu_device *adev;
@@ -72,7 +72,8 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,
struct reservation_object *resv,
struct dma_fence **fence);
-int amdgpu_mmap(struct file *filp, struct vm_area_struct *vma);
+int amdgpu_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
bool amdgpu_ttm_is_bound(struct ttm_tt *ttm);
int amdgpu_ttm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *bo_mem);
@@ -39,7 +39,7 @@
static long kfd_ioctl(struct file *, unsigned int, unsigned long);
static int kfd_open(struct inode *, struct file *);
-static int kfd_mmap(struct file *, struct vm_area_struct *);
+static int kfd_mmap(struct file *, struct vm_area_struct *, unsigned long);
static const char kfd_dev_name[] = "kfd";
@@ -991,7 +991,8 @@ static long kfd_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
return retcode;
}
-static int kfd_mmap(struct file *filp, struct vm_area_struct *vma)
+static int kfd_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct kfd_process *process;
@@ -48,11 +48,12 @@ static void arcpgu_setup_mode_config(struct drm_device *drm)
drm->mode_config.funcs = &arcpgu_drm_modecfg_funcs;
}
-static int arcpgu_gem_mmap(struct file *filp, struct vm_area_struct *vma)
+static int arcpgu_gem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
int ret;
- ret = drm_gem_mmap(filp, vma);
+ ret = drm_gem_mmap(filp, vma, 0);
if (ret)
return ret;
@@ -391,7 +391,8 @@ static inline void ast_bo_unreserve(struct ast_bo *bo)
void ast_ttm_placement(struct ast_bo *bo, int domain);
int ast_bo_push_sysram(struct ast_bo *bo);
-int ast_mmap(struct file *filp, struct vm_area_struct *vma);
+int ast_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
/* ast post */
void ast_enable_vga(struct drm_device *dev);
@@ -420,7 +420,8 @@ int ast_bo_push_sysram(struct ast_bo *bo)
return 0;
}
-int ast_mmap(struct file *filp, struct vm_area_struct *vma)
+int ast_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_file *file_priv;
struct ast_private *ast;
@@ -136,7 +136,8 @@ void bochs_hw_setbase(struct bochs_device *bochs,
/* bochs_mm.c */
int bochs_mm_init(struct bochs_device *bochs);
void bochs_mm_fini(struct bochs_device *bochs);
-int bochs_mmap(struct file *filp, struct vm_area_struct *vma);
+int bochs_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
int bochs_gem_create(struct drm_device *dev, u32 size, bool iskernel,
struct drm_gem_object **obj);
@@ -327,7 +327,8 @@ int bochs_bo_unpin(struct bochs_bo *bo)
return 0;
}
-int bochs_mmap(struct file *filp, struct vm_area_struct *vma)
+int bochs_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_file *file_priv;
struct bochs_device *bochs;
@@ -240,7 +240,8 @@ void cirrus_mm_fini(struct cirrus_device *cirrus);
void cirrus_ttm_placement(struct cirrus_bo *bo, int domain);
int cirrus_bo_create(struct drm_device *dev, int size, int align,
uint32_t flags, struct cirrus_bo **pcirrusbo);
-int cirrus_mmap(struct file *filp, struct vm_area_struct *vma);
+int cirrus_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
static inline int cirrus_bo_reserve(struct cirrus_bo *bo, bool no_wait)
{
@@ -405,7 +405,8 @@ int cirrus_bo_push_sysram(struct cirrus_bo *bo)
return 0;
}
-int cirrus_mmap(struct file *filp, struct vm_area_struct *vma)
+int cirrus_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_file *file_priv;
struct cirrus_device *cirrus;
@@ -956,7 +956,8 @@ EXPORT_SYMBOL(drm_gem_mmap_obj);
* If the caller is not granted access to the buffer object, the mmap will fail
* with EACCES. Please see the vma manager for more information.
*/
-int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
+int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->minor->dev;
@@ -330,6 +330,7 @@ static int drm_gem_cma_mmap_obj(struct drm_gem_cma_object *cma_obj,
* drm_gem_cma_mmap - memory-map a CMA GEM object
* @filp: file object
* @vma: VMA for the area to be mapped
+ * @map_flags: the MAP_* flags passed to mmap(2)
*
* This function implements an augmented version of the GEM DRM file mmap
* operation for CMA objects: In addition to the usual GEM VMA setup it
@@ -344,13 +345,14 @@ static int drm_gem_cma_mmap_obj(struct drm_gem_cma_object *cma_obj,
* Returns:
* 0 on success or a negative error code on failure.
*/
-int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma)
+int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_gem_cma_object *cma_obj;
struct drm_gem_object *gem_obj;
int ret;
- ret = drm_gem_mmap(filp, vma);
+ ret = drm_gem_mmap(filp, vma, 0);
if (ret)
return ret;
@@ -625,7 +625,8 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
return 0;
}
-int drm_legacy_mmap(struct file *filp, struct vm_area_struct *vma)
+int drm_legacy_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->minor->dev;
@@ -72,7 +72,8 @@ static inline void etnaviv_queue_work(struct drm_device *dev,
int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
struct drm_file *file);
-int etnaviv_gem_mmap(struct file *filp, struct vm_area_struct *vma);
+int etnaviv_gem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
int etnaviv_gem_fault(struct vm_fault *vmf);
int etnaviv_gem_mmap_offset(struct drm_gem_object *obj, u64 *offset);
struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj);
@@ -162,12 +162,13 @@ static int etnaviv_gem_mmap_obj(struct etnaviv_gem_object *etnaviv_obj,
return 0;
}
-int etnaviv_gem_mmap(struct file *filp, struct vm_area_struct *vma)
+int etnaviv_gem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct etnaviv_gem_object *obj;
int ret;
- ret = drm_gem_mmap(filp, vma);
+ ret = drm_gem_mmap(filp, vma, 0);
if (ret) {
DBG("mmap failed: %d", ret);
return ret;
@@ -511,13 +511,14 @@ static int exynos_drm_gem_mmap_obj(struct drm_gem_object *obj,
return ret;
}
-int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
+int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_gem_object *obj;
int ret;
/* set vm_area_struct. */
- ret = drm_gem_mmap(filp, vma);
+ ret = drm_gem_mmap(filp, vma, 0);
if (ret < 0) {
DRM_ERROR("failed to mmap.\n");
return ret;
@@ -119,7 +119,8 @@ int exynos_drm_gem_dumb_map_offset(struct drm_file *file_priv,
int exynos_drm_gem_fault(struct vm_fault *vmf);
/* set vm_flags and we can change the vm attribute to other one at here. */
-int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
+int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
/* low-level interface prime helpers */
struct sg_table *exynos_drm_gem_prime_get_sg_table(struct drm_gem_object *obj);
@@ -107,7 +107,8 @@ int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
struct drm_mode_create_dumb *args);
int hibmc_dumb_mmap_offset(struct drm_file *file, struct drm_device *dev,
u32 handle, u64 *offset);
-int hibmc_mmap(struct file *filp, struct vm_area_struct *vma);
+int hibmc_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
extern const struct drm_mode_config_funcs hibmc_mode_funcs;
@@ -389,7 +389,8 @@ int hibmc_bo_unpin(struct hibmc_bo *bo)
return 0;
}
-int hibmc_mmap(struct file *filp, struct vm_area_struct *vma)
+int hibmc_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_file *file_priv;
struct hibmc_drm_private *hibmc;
@@ -84,7 +84,8 @@ static int i810_freelist_put(struct drm_device *dev, struct drm_buf *buf)
return 0;
}
-static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
+static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev;
@@ -165,7 +165,7 @@ static int i915_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *
if (!obj->base.filp)
return -ENODEV;
- ret = call_mmap(obj->base.filp, vma);
+ ret = call_mmap(obj->base.filp, vma, 0);
if (ret)
return ret;
@@ -190,12 +190,13 @@ int mtk_drm_gem_mmap_buf(struct drm_gem_object *obj, struct vm_area_struct *vma)
return mtk_drm_gem_object_mmap(obj, vma);
}
-int mtk_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
+int mtk_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_gem_object *obj;
int ret;
- ret = drm_gem_mmap(filp, vma);
+ ret = drm_gem_mmap(filp, vma, 0);
if (ret)
return ret;
@@ -49,7 +49,8 @@ int mtk_drm_gem_dumb_create(struct drm_file *file_priv, struct drm_device *dev,
int mtk_drm_gem_dumb_map_offset(struct drm_file *file_priv,
struct drm_device *dev, uint32_t handle,
uint64_t *offset);
-int mtk_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
+int mtk_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
int mtk_drm_gem_mmap_buf(struct drm_gem_object *obj,
struct vm_area_struct *vma);
struct sg_table *mtk_gem_prime_get_sg_table(struct drm_gem_object *obj);
@@ -301,7 +301,8 @@ int mgag200_bo_create(struct drm_device *dev, int size, int align,
uint32_t flags, struct mgag200_bo **pastbo);
int mgag200_mm_init(struct mga_device *mdev);
void mgag200_mm_fini(struct mga_device *mdev);
-int mgag200_mmap(struct file *filp, struct vm_area_struct *vma);
+int mgag200_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
int mgag200_bo_pin(struct mgag200_bo *bo, u32 pl_flag, u64 *gpu_addr);
int mgag200_bo_unpin(struct mgag200_bo *bo);
int mgag200_bo_push_sysram(struct mgag200_bo *bo);
@@ -418,7 +418,8 @@ int mgag200_bo_push_sysram(struct mgag200_bo *bo)
return 0;
}
-int mgag200_mmap(struct file *filp, struct vm_area_struct *vma)
+int mgag200_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_file *file_priv;
struct mga_device *mdev;
@@ -196,7 +196,8 @@ void msm_gem_shrinker_cleanup(struct drm_device *dev);
int msm_gem_mmap_obj(struct drm_gem_object *obj,
struct vm_area_struct *vma);
-int msm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
+int msm_gem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
int msm_gem_fault(struct vm_fault *vmf);
uint64_t msm_gem_mmap_offset(struct drm_gem_object *obj);
int msm_gem_get_iova(struct drm_gem_object *obj,
@@ -198,11 +198,12 @@ int msm_gem_mmap_obj(struct drm_gem_object *obj,
return 0;
}
-int msm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
+int msm_gem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
int ret;
- ret = drm_gem_mmap(filp, vma);
+ ret = drm_gem_mmap(filp, vma, 0);
if (ret) {
DBG("mmap failed: %d", ret);
return ret;
@@ -265,13 +265,14 @@ const struct ttm_mem_type_manager_func nv04_gart_manager = {
};
int
-nouveau_ttm_mmap(struct file *filp, struct vm_area_struct *vma)
+nouveau_ttm_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_file *file_priv = filp->private_data;
struct nouveau_drm *drm = nouveau_drm(file_priv->minor->dev);
if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
- return drm_legacy_mmap(filp, vma);
+ return drm_legacy_mmap(filp, vma, map_flags);
return ttm_bo_mmap(filp, vma, &drm->ttm.bdev);
}
@@ -17,7 +17,7 @@ struct ttm_tt *nouveau_sgdma_create_ttm(struct ttm_bo_device *,
int nouveau_ttm_init(struct nouveau_drm *drm);
void nouveau_ttm_fini(struct nouveau_drm *drm);
-int nouveau_ttm_mmap(struct file *, struct vm_area_struct *);
+int nouveau_ttm_mmap(struct file *, struct vm_area_struct *, unsigned long);
int nouveau_ttm_global_init(struct nouveau_drm *);
void nouveau_ttm_global_release(struct nouveau_drm *);
@@ -168,7 +168,8 @@ int omap_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
uint32_t handle, uint64_t *offset);
int omap_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
struct drm_mode_create_dumb *args);
-int omap_gem_mmap(struct file *filp, struct vm_area_struct *vma);
+int omap_gem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
int omap_gem_mmap_obj(struct drm_gem_object *obj,
struct vm_area_struct *vma);
int omap_gem_fault(struct vm_fault *vmf);
@@ -561,11 +561,12 @@ int omap_gem_fault(struct vm_fault *vmf)
}
/** We override mainly to fix up some of the vm mapping flags.. */
-int omap_gem_mmap(struct file *filp, struct vm_area_struct *vma)
+int omap_gem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
int ret;
- ret = drm_gem_mmap(filp, vma);
+ ret = drm_gem_mmap(filp, vma, 0);
if (ret) {
DBG("mmap failed: %d", ret);
return ret;
@@ -421,7 +421,8 @@ int qxl_mode_dumb_mmap(struct drm_file *filp,
/* qxl ttm */
int qxl_ttm_init(struct qxl_device *qdev);
void qxl_ttm_fini(struct qxl_device *qdev);
-int qxl_mmap(struct file *filp, struct vm_area_struct *vma);
+int qxl_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
/* qxl image */
@@ -117,7 +117,8 @@ static int qxl_ttm_fault(struct vm_fault *vmf)
return r;
}
-int qxl_mmap(struct file *filp, struct vm_area_struct *vma)
+int qxl_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_file *file_priv;
struct qxl_device *qdev;
@@ -135,7 +135,8 @@ extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int crtc,
extern bool radeon_is_px(struct drm_device *dev);
extern const struct drm_ioctl_desc radeon_ioctls_kms[];
extern int radeon_max_kms_ioctl;
-int radeon_mmap(struct file *filp, struct vm_area_struct *vma);
+int radeon_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
int radeon_mode_dumb_mmap(struct drm_file *filp,
struct drm_device *dev,
uint32_t handle, uint64_t *offset_p);
@@ -997,7 +997,8 @@ static int radeon_ttm_fault(struct vm_fault *vmf)
return r;
}
-int radeon_mmap(struct file *filp, struct vm_area_struct *vma)
+int radeon_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_file *file_priv;
struct radeon_device *rdev;
@@ -288,12 +288,13 @@ int rockchip_gem_mmap_buf(struct drm_gem_object *obj,
}
/* drm driver mmap file operations */
-int rockchip_gem_mmap(struct file *filp, struct vm_area_struct *vma)
+int rockchip_gem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_gem_object *obj;
int ret;
- ret = drm_gem_mmap(filp, vma);
+ ret = drm_gem_mmap(filp, vma, 0);
if (ret)
return ret;
@@ -42,7 +42,8 @@ void *rockchip_gem_prime_vmap(struct drm_gem_object *obj);
void rockchip_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
/* drm driver mmap file operations */
-int rockchip_gem_mmap(struct file *filp, struct vm_area_struct *vma);
+int rockchip_gem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
/* mmap a gem object to userspace. */
int rockchip_gem_mmap_buf(struct drm_gem_object *obj,
@@ -481,13 +481,14 @@ const struct vm_operations_struct tegra_bo_vm_ops = {
.close = drm_gem_vm_close,
};
-int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma)
+int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_gem_object *gem;
struct tegra_bo *bo;
int ret;
- ret = drm_gem_mmap(file, vma);
+ ret = drm_gem_mmap(file, vma, 0);
if (ret)
return ret;
@@ -70,7 +70,8 @@ int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
int tegra_bo_dumb_map_offset(struct drm_file *file, struct drm_device *drm,
u32 handle, u64 *offset);
-int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma);
+int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags);
extern const struct vm_operations_struct tegra_bo_vm_ops;
@@ -133,7 +133,8 @@ int udl_gem_get_pages(struct udl_gem_object *obj);
void udl_gem_put_pages(struct udl_gem_object *obj);
int udl_gem_vmap(struct udl_gem_object *obj);
void udl_gem_vunmap(struct udl_gem_object *obj);
-int udl_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
+int udl_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
int udl_gem_fault(struct vm_fault *vmf);
int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,
@@ -84,11 +84,12 @@ int udl_dumb_create(struct drm_file *file,
args->size, &args->handle);
}
-int udl_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
+int udl_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
int ret;
- ret = drm_gem_mmap(filp, vma);
+ ret = drm_gem_mmap(filp, vma, 0);
if (ret)
return ret;
@@ -396,13 +396,14 @@ vc4_prime_export(struct drm_device *dev, struct drm_gem_object *obj, int flags)
return drm_gem_prime_export(dev, obj, flags);
}
-int vc4_mmap(struct file *filp, struct vm_area_struct *vma)
+int vc4_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_gem_object *gem_obj;
struct vc4_bo *bo;
int ret;
- ret = drm_gem_mmap(filp, vma);
+ ret = drm_gem_mmap(filp, vma, 0);
if (ret)
return ret;
@@ -478,7 +478,8 @@ int vc4_get_tiling_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
int vc4_get_hang_state_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
-int vc4_mmap(struct file *filp, struct vm_area_struct *vma);
+int vc4_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
struct reservation_object *vc4_prime_res_obj(struct drm_gem_object *obj);
int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);
struct drm_gem_object *vc4_prime_import_sg_table(struct drm_device *dev,
@@ -248,12 +248,13 @@ static struct drm_ioctl_desc vgem_ioctls[] = {
DRM_IOCTL_DEF_DRV(VGEM_FENCE_SIGNAL, vgem_fence_signal_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
};
-static int vgem_mmap(struct file *filp, struct vm_area_struct *vma)
+static int vgem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
unsigned long flags = vma->vm_flags;
int ret;
- ret = drm_gem_mmap(filp, vma);
+ ret = drm_gem_mmap(filp, vma, 0);
if (ret)
return ret;
@@ -370,7 +371,7 @@ static int vgem_prime_mmap(struct drm_gem_object *obj,
if (!obj->filp)
return -ENODEV;
- ret = call_mmap(obj->filp, vma);
+ ret = call_mmap(obj->filp, vma, 0);
if (ret)
return ret;
@@ -342,7 +342,8 @@ struct drm_plane *virtio_gpu_plane_init(struct virtio_gpu_device *vgdev,
/* virtio_gpu_ttm.c */
int virtio_gpu_ttm_init(struct virtio_gpu_device *vgdev);
void virtio_gpu_ttm_fini(struct virtio_gpu_device *vgdev);
-int virtio_gpu_mmap(struct file *filp, struct vm_area_struct *vma);
+int virtio_gpu_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
/* virtio_gpu_fence.c */
int virtio_gpu_fence_emit(struct virtio_gpu_device *vgdev,
@@ -129,7 +129,8 @@ static int virtio_gpu_ttm_fault(struct vm_fault *vmf)
}
#endif
-int virtio_gpu_mmap(struct file *filp, struct vm_area_struct *vma)
+int virtio_gpu_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_file *file_priv;
struct virtio_gpu_device *vgdev;
@@ -742,7 +742,8 @@ extern int vmw_fifo_flush(struct vmw_private *dev_priv,
extern int vmw_ttm_global_init(struct vmw_private *dev_priv);
extern void vmw_ttm_global_release(struct vmw_private *dev_priv);
-extern int vmw_mmap(struct file *filp, struct vm_area_struct *vma);
+extern int vmw_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
/**
* TTM buffer object driver - vmwgfx_buffer.c
@@ -28,7 +28,8 @@
#include <drm/drmP.h>
#include "vmwgfx_drv.h"
-int vmw_mmap(struct file *filp, struct vm_area_struct *vma)
+int vmw_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_file *file_priv;
struct vmw_private *dev_priv;
@@ -1270,7 +1270,8 @@ static long cs_char_ioctl(struct file *file, unsigned int cmd,
return r;
}
-static int cs_char_mmap(struct file *file, struct vm_area_struct *vma)
+static int cs_char_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
if (vma->vm_end < vma->vm_start)
return -EINVAL;
@@ -1212,7 +1212,8 @@ static const struct vm_operations_struct msc_mmap_ops = {
.fault = msc_mmap_fault,
};
-static int intel_th_msc_mmap(struct file *file, struct vm_area_struct *vma)
+static int intel_th_msc_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
unsigned long size = vma->vm_end - vma->vm_start;
struct msc_iter *iter = vma->vm_file->private_data;
@@ -519,7 +519,8 @@ static const struct vm_operations_struct stm_mmap_vmops = {
.close = stm_mmap_close,
};
-static int stm_char_mmap(struct file *file, struct vm_area_struct *vma)
+static int stm_char_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct stm_file *stmf = file->private_data;
struct stm_device *stm = stmf->stm;
@@ -809,7 +809,8 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
return ret;
}
-static int ib_uverbs_mmap(struct file *filp, struct vm_area_struct *vma)
+static int ib_uverbs_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct ib_uverbs_file *file = filp->private_data;
struct ib_device *ib_dev;
@@ -75,7 +75,8 @@ static int hfi1_file_open(struct inode *inode, struct file *fp);
static int hfi1_file_close(struct inode *inode, struct file *fp);
static ssize_t hfi1_write_iter(struct kiocb *kiocb, struct iov_iter *from);
static unsigned int hfi1_poll(struct file *fp, struct poll_table_struct *pt);
-static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma);
+static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma,
+ unsigned long map_flags);
static u64 kvirt_to_phys(void *addr);
static int assign_ctxt(struct hfi1_filedata *fd, struct hfi1_user_info *uinfo);
@@ -450,7 +451,8 @@ static ssize_t hfi1_write_iter(struct kiocb *kiocb, struct iov_iter *from)
return reqs;
}
-static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma)
+static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct hfi1_filedata *fd = fp->private_data;
struct hfi1_ctxtdata *uctxt = fd->uctxt;
@@ -59,7 +59,7 @@ static int qib_close(struct inode *, struct file *);
static ssize_t qib_write(struct file *, const char __user *, size_t, loff_t *);
static ssize_t qib_write_iter(struct kiocb *, struct iov_iter *);
static unsigned int qib_poll(struct file *, struct poll_table_struct *);
-static int qib_mmapf(struct file *, struct vm_area_struct *);
+static int qib_mmapf(struct file *, struct vm_area_struct *, unsigned long);
/*
* This is really, really weird shit - write() and writev() here
@@ -993,7 +993,8 @@ static int mmap_kvaddr(struct vm_area_struct *vma, u64 pgaddr,
* buffers in the chip. We have the open and close entries so we can bump
* the ref count and keep the driver from being unloaded while still mapped.
*/
-static int qib_mmapf(struct file *fp, struct vm_area_struct *vma)
+static int qib_mmapf(struct file *fp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct qib_ctxtdata *rcd;
struct qib_devdata *dd;
@@ -388,7 +388,8 @@ static unsigned long v4l2_get_unmapped_area(struct file *filp,
}
#endif
-static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm)
+static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm,
+ unsigned long map_flags)
{
struct video_device *vdev = video_devdata(filp);
int ret = -ENODEV;
@@ -38,7 +38,8 @@ static struct aspeed_lpc_ctrl *file_aspeed_lpc_ctrl(struct file *file)
miscdev);
}
-static int aspeed_lpc_ctrl_mmap(struct file *file, struct vm_area_struct *vma)
+static int aspeed_lpc_ctrl_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct aspeed_lpc_ctrl *lpc_ctrl = file_aspeed_lpc_ctrl(file);
unsigned long vsize = vma->vm_end - vma->vm_start;
@@ -408,9 +408,10 @@ long cxl_fd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return afu_ioctl(file, cmd, arg);
}
EXPORT_SYMBOL_GPL(cxl_fd_ioctl);
-int cxl_fd_mmap(struct file *file, struct vm_area_struct *vm)
+int cxl_fd_mmap(struct file *file, struct vm_area_struct *vm,
+ unsigned long map_flags)
{
- return afu_mmap(file, vm);
+ return afu_mmap(file, vm, map_flags);
}
EXPORT_SYMBOL_GPL(cxl_fd_mmap);
unsigned int cxl_fd_poll(struct file *file, struct poll_table_struct *poll)
@@ -1082,7 +1082,8 @@ int afu_allocate_irqs(struct cxl_context *ctx, u32 count);
int afu_open(struct inode *inode, struct file *file);
int afu_release(struct inode *inode, struct file *file);
long afu_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
-int afu_mmap(struct file *file, struct vm_area_struct *vm);
+int afu_mmap(struct file *file, struct vm_area_struct *vm,
+ unsigned long map_flags);
unsigned int afu_poll(struct file *file, struct poll_table_struct *poll);
ssize_t afu_read(struct file *file, char __user *buf, size_t count, loff_t *off);
extern const struct file_operations afu_fops;
@@ -303,7 +303,8 @@ static long afu_compat_ioctl(struct file *file, unsigned int cmd,
return afu_ioctl(file, cmd, arg);
}
-int afu_mmap(struct file *file, struct vm_area_struct *vm)
+int afu_mmap(struct file *file, struct vm_area_struct *vm,
+ unsigned long map_flags)
{
struct cxl_context *ctx = file->private_data;
@@ -435,7 +435,8 @@ static const struct vm_operations_struct genwqe_vma_ops = {
* plain buffer, we lookup our dma_mapping list to find the
* corresponding DMA address for the associated user-space address.
*/
-static int genwqe_mmap(struct file *filp, struct vm_area_struct *vma)
+static int genwqe_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
int rc;
unsigned long pfn, vsize = vma->vm_end - vma->vm_start;
@@ -34,7 +34,8 @@ static int scif_fdclose(struct inode *inode, struct file *f)
return scif_close(priv);
}
-static int scif_fdmmap(struct file *f, struct vm_area_struct *vma)
+static int scif_fdmmap(struct file *f, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct scif_endpt *priv = f->private_data;
@@ -1083,7 +1083,8 @@ vop_query_offset(struct vop_vdev *vdev, unsigned long offset,
/*
* Maps the device page and virtio rings to user space for readonly access.
*/
-static int vop_mmap(struct file *f, struct vm_area_struct *vma)
+static int vop_mmap(struct file *f, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct vop_vdev *vdev = f->private_data;
unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
@@ -104,7 +104,8 @@ static void gru_vma_close(struct vm_area_struct *vma)
* and private data structure necessary to allocate, track, and free the
* underlying pages.
*/
-static int gru_file_mmap(struct file *file, struct vm_area_struct *vma)
+static int gru_file_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
if ((vma->vm_flags & (VM_SHARED | VM_WRITE)) != (VM_SHARED | VM_WRITE))
return -EPERM;
@@ -1192,7 +1192,8 @@ static unsigned mtdchar_mmap_capabilities(struct file *file)
/*
* set up a mapping for shared memory segments
*/
-static int mtdchar_mmap(struct file *file, struct vm_area_struct *vma)
+static int mtdchar_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
#ifdef CONFIG_MMU
struct mtd_file_info *mfi = file->private_data;
@@ -230,7 +230,8 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
}
#ifdef HAVE_PCI_MMAP
-static int proc_bus_pci_mmap(struct file *file, struct vm_area_struct *vma)
+static int proc_bus_pci_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct pci_dev *dev = PDE_DATA(file_inode(file));
struct pci_filp_private *fpriv = file->private_data;
@@ -2261,7 +2261,8 @@ static const struct vm_operations_struct vm_ops = {
.close = mport_mm_close,
};
-static int mport_cdev_mmap(struct file *filp, struct vm_area_struct *vma)
+static int mport_cdev_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct mport_cdev_priv *priv = filp->private_data;
struct mport_dev *md;
@@ -33,7 +33,8 @@ static struct {
#define FLASH_MINOR 152
static int
-flash_mmap(struct file *file, struct vm_area_struct *vma)
+flash_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
unsigned long addr;
unsigned long size;
@@ -440,7 +440,8 @@ static long jsf_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
return error;
}
-static int jsf_mmap(struct file * file, struct vm_area_struct * vma)
+static int jsf_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
return -ENXIO;
}
@@ -1160,7 +1160,8 @@ static const struct vm_operations_struct cxlflash_mmap_vmops = {
*
* Return: 0 on success, -errno on failure
*/
-static int cxlflash_cxl_mmap(struct file *file, struct vm_area_struct *vma)
+static int cxlflash_cxl_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct cxl_context *ctx = cxl_fops_get_context(file);
struct cxlflash_cfg *cfg = container_of(file->f_op, struct cxlflash_cfg,
@@ -1188,7 +1189,7 @@ static int cxlflash_cxl_mmap(struct file *file, struct vm_area_struct *vma)
dev_dbg(dev, "%s: mmap for context %d\n", __func__, ctxid);
- rc = cxl_fd_mmap(file, vma);
+ rc = cxl_fd_mmap(file, vma, map_flags);
if (likely(!rc)) {
/* Insert ourself in the mmap fault handler path */
ctxi->cxl_mmap_vmops = vma->vm_ops;
@@ -1227,7 +1227,8 @@ static const struct vm_operations_struct sg_mmap_vm_ops = {
};
static int
-sg_mmap(struct file *filp, struct vm_area_struct *vma)
+sg_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
Sg_fd *sfp;
unsigned long req_sz, len, sa;
@@ -375,7 +375,8 @@ static inline vm_flags_t calc_vm_may_flags(unsigned long prot)
_calc_vm_trans(prot, PROT_EXEC, VM_MAYEXEC);
}
-static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
+static int ashmem_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct ashmem_area *asma = file->private_data;
int ret = 0;
@@ -2185,7 +2185,8 @@ static const struct vm_operations_struct comedi_vm_ops = {
.access = comedi_vm_access,
};
-static int comedi_mmap(struct file *file, struct vm_area_struct *vma)
+static int comedi_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct comedi_file *cfp = file->private_data;
struct comedi_device *dev = cfp->dev;
@@ -912,7 +912,8 @@ static inline struct vvp_io_args *ll_env_args(const struct lu_env *env)
/* llite/llite_mmap.c */
int ll_teardown_mmaps(struct address_space *mapping, __u64 first, __u64 last);
-int ll_file_mmap(struct file *file, struct vm_area_struct *vma);
+int ll_file_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags);
void policy_from_vma(union ldlm_policy_data *policy, struct vm_area_struct *vma,
unsigned long addr, size_t count);
struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr,
@@ -455,7 +455,8 @@ static const struct vm_operations_struct ll_file_vm_ops = {
.close = ll_vm_close,
};
-int ll_file_mmap(struct file *file, struct vm_area_struct *vma)
+int ll_file_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct inode *inode = file_inode(file);
int rc;
@@ -464,7 +465,7 @@ int ll_file_mmap(struct file *file, struct vm_area_struct *vma)
return -EOPNOTSUPP;
ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_MAP, 1);
- rc = generic_file_mmap(file, vma);
+ rc = generic_file_mmap(file, vma, 0);
if (rc == 0) {
vma->vm_ops = &ll_file_vm_ops;
vma->vm_ops->open(vma);
@@ -261,7 +261,8 @@ static inline void vbox_bo_unreserve(struct vbox_bo *bo)
void vbox_ttm_placement(struct vbox_bo *bo, int domain);
int vbox_bo_push_sysram(struct vbox_bo *bo);
-int vbox_mmap(struct file *filp, struct vm_area_struct *vma);
+int vbox_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
/* vbox_prime.c */
int vbox_gem_prime_pin(struct drm_gem_object *obj);
@@ -457,7 +457,8 @@ int vbox_bo_push_sysram(struct vbox_bo *bo)
return 0;
}
-int vbox_mmap(struct file *filp, struct vm_area_struct *vma)
+int vbox_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct drm_file *file_priv;
struct vbox_private *vbox;
@@ -484,7 +484,8 @@ static int vme_user_master_mmap(unsigned int minor, struct vm_area_struct *vma)
return 0;
}
-static int vme_user_mmap(struct file *file, struct vm_area_struct *vma)
+static int vme_user_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
unsigned int minor = MINOR(file_inode(file)->i_rdev);
@@ -674,7 +674,8 @@ static int uio_mmap_physical(struct vm_area_struct *vma)
vma->vm_page_prot);
}
-static int uio_mmap(struct file *filep, struct vm_area_struct *vma)
+static int uio_mmap(struct file *filep, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct uio_listener *listener = filep->private_data;
struct uio_device *idev = listener->dev;
@@ -215,7 +215,8 @@ static struct vm_operations_struct usbdev_vm_ops = {
.close = usbdev_vm_close
};
-static int usbdev_mmap(struct file *file, struct vm_area_struct *vma)
+static int usbdev_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct usb_memory *usbm = NULL;
struct usb_dev_state *ps = file->private_data;
@@ -1246,7 +1246,8 @@ static const struct vm_operations_struct mon_bin_vm_ops = {
.fault = mon_bin_vma_fault,
};
-static int mon_bin_mmap(struct file *filp, struct vm_area_struct *vma)
+static int mon_bin_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
/* don't do anything here: "fault" will set up page table entries */
vma->vm_ops = &mon_bin_vm_ops;
@@ -1256,7 +1256,8 @@ static ssize_t vfio_fops_write(struct file *filep, const char __user *buf,
return ret;
}
-static int vfio_fops_mmap(struct file *filep, struct vm_area_struct *vma)
+static int vfio_fops_mmap(struct file *filep, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct vfio_container *container = filep->private_data;
struct vfio_iommu_driver *driver;
@@ -1677,7 +1678,9 @@ static ssize_t vfio_device_fops_write(struct file *filep,
return device->ops->write(device->device_data, buf, count, ppos);
}
-static int vfio_device_fops_mmap(struct file *filep, struct vm_area_struct *vma)
+static int vfio_device_fops_mmap(struct file *filep,
+ struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct vfio_device *device = filep->private_data;
@@ -1380,7 +1380,8 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd,
#endif
static int
-fb_mmap(struct file *file, struct vm_area_struct * vma)
+fb_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct fb_info *info = file_fb_info(file);
struct fb_ops *fb;
@@ -479,7 +479,8 @@ pxa3xx_gcu_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
}
static int
-pxa3xx_gcu_mmap(struct file *file, struct vm_area_struct *vma)
+pxa3xx_gcu_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
unsigned int size = vma->vm_end - vma->vm_start;
struct pxa3xx_gcu_priv *priv = to_pxa3xx_gcu_priv(file);
@@ -502,7 +502,8 @@ static const struct vm_operations_struct gntalloc_vmops = {
.close = gntalloc_vma_close,
};
-static int gntalloc_mmap(struct file *filp, struct vm_area_struct *vma)
+static int gntalloc_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct gntalloc_file_private_data *priv = filp->private_data;
struct gntalloc_vma_private_data *vm_priv;
@@ -980,7 +980,8 @@ static long gntdev_ioctl(struct file *flip,
return 0;
}
-static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
+static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct gntdev_priv *priv = flip->private_data;
int index = vma->vm_pgoff;
@@ -818,7 +818,8 @@ static const struct vm_operations_struct privcmd_vm_ops = {
.fault = privcmd_fault
};
-static int privcmd_mmap(struct file *file, struct vm_area_struct *vma)
+static int privcmd_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
/* DONTCOPY is essential for Xen because copy_page_range doesn't know
* how to recreate these mappings */
@@ -88,7 +88,8 @@ static long xenbus_backend_ioctl(struct file *file, unsigned int cmd,
}
}
-static int xenbus_backend_mmap(struct file *file, struct vm_area_struct *vma)
+static int xenbus_backend_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
size_t size = vma->vm_end - vma->vm_start;
@@ -30,7 +30,8 @@ static int xsd_kva_open(struct inode *inode, struct file *file)
return 0;
}
-static int xsd_kva_mmap(struct file *file, struct vm_area_struct *vma)
+static int xsd_kva_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
size_t size = vma->vm_end - vma->vm_start;
@@ -484,12 +484,13 @@ int v9fs_file_fsync_dotl(struct file *filp, loff_t start, loff_t end,
}
static int
-v9fs_file_mmap(struct file *filp, struct vm_area_struct *vma)
+v9fs_file_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
int retval;
- retval = generic_file_mmap(filp, vma);
+ retval = generic_file_mmap(filp, vma, 0);
if (!retval)
vma->vm_ops = &v9fs_file_vm_ops;
@@ -497,7 +498,8 @@ v9fs_file_mmap(struct file *filp, struct vm_area_struct *vma)
}
static int
-v9fs_mmap_file_mmap(struct file *filp, struct vm_area_struct *vma)
+v9fs_mmap_file_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
int retval;
struct inode *inode;
@@ -526,7 +528,7 @@ v9fs_mmap_file_mmap(struct file *filp, struct vm_area_struct *vma)
}
mutex_unlock(&v9inode->v_mutex);
- retval = generic_file_mmap(filp, vma);
+ retval = generic_file_mmap(filp, vma, 0);
if (!retval)
vma->vm_ops = &v9fs_mmap_file_vm_ops;
@@ -353,7 +353,8 @@ static const struct vm_operations_struct aio_ring_vm_ops = {
#endif
};
-static int aio_ring_mmap(struct file *file, struct vm_area_struct *vma)
+static int aio_ring_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
vma->vm_flags |= VM_DONTEXPAND;
vma->vm_ops = &aio_ring_vm_ops;
@@ -2262,7 +2262,8 @@ static const struct vm_operations_struct btrfs_file_vm_ops = {
.page_mkwrite = btrfs_page_mkwrite,
};
-static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma)
+static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct address_space *mapping = filp->f_mapping;
@@ -1755,7 +1755,8 @@ static const struct vm_operations_struct ceph_vmops = {
.page_mkwrite = ceph_page_mkwrite,
};
-int ceph_mmap(struct file *file, struct vm_area_struct *vma)
+int ceph_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct address_space *mapping = file->f_mapping;
@@ -942,7 +942,8 @@ extern void ceph_put_fmode(struct ceph_inode_info *ci, int mode);
/* addr.c */
extern const struct address_space_operations ceph_aops;
-extern int ceph_mmap(struct file *file, struct vm_area_struct *vma);
+extern int ceph_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags);
extern int ceph_uninline_data(struct file *filp, struct page *locked_page);
extern int ceph_pool_perm_check(struct ceph_inode_info *ci, int need);
extern void ceph_pool_perm_destroy(struct ceph_mds_client* mdsc);
@@ -109,8 +109,10 @@ extern int cifs_lock(struct file *, int, struct file_lock *);
extern int cifs_fsync(struct file *, loff_t, loff_t, int);
extern int cifs_strict_fsync(struct file *, loff_t, loff_t, int);
extern int cifs_flush(struct file *, fl_owner_t id);
-extern int cifs_file_mmap(struct file * , struct vm_area_struct *);
-extern int cifs_file_strict_mmap(struct file * , struct vm_area_struct *);
+extern int cifs_file_mmap(struct file *, struct vm_area_struct *,
+ unsigned long);
+extern int cifs_file_strict_mmap(struct file *, struct vm_area_struct *,
+ unsigned long);
extern const struct file_operations cifs_dir_ops;
extern int cifs_dir_open(struct inode *inode, struct file *file);
extern int cifs_readdir(struct file *file, struct dir_context *ctx);
@@ -3475,7 +3475,8 @@ static const struct vm_operations_struct cifs_file_vm_ops = {
.page_mkwrite = cifs_page_mkwrite,
};
-int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma)
+int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
int rc, xid;
struct inode *inode = file_inode(file);
@@ -3488,14 +3489,15 @@ int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma)
return rc;
}
- rc = generic_file_mmap(file, vma);
+ rc = generic_file_mmap(file, vma, 0);
if (rc == 0)
vma->vm_ops = &cifs_file_vm_ops;
free_xid(xid);
return rc;
}
-int cifs_file_mmap(struct file *file, struct vm_area_struct *vma)
+int cifs_file_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
int rc, xid;
@@ -3507,7 +3509,7 @@ int cifs_file_mmap(struct file *file, struct vm_area_struct *vma)
free_xid(xid);
return rc;
}
- rc = generic_file_mmap(file, vma);
+ rc = generic_file_mmap(file, vma, 0);
if (rc == 0)
vma->vm_ops = &cifs_file_vm_ops;
free_xid(xid);
@@ -61,7 +61,8 @@ coda_file_write_iter(struct kiocb *iocb, struct iov_iter *to)
}
static int
-coda_file_mmap(struct file *coda_file, struct vm_area_struct *vma)
+coda_file_mmap(struct file *coda_file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct coda_file_info *cfi;
struct coda_inode_info *cii;
@@ -96,7 +97,7 @@ coda_file_mmap(struct file *coda_file, struct vm_area_struct *vma)
cfi->cfi_mapcount++;
spin_unlock(&cii->c_lock);
- return call_mmap(host_file, vma);
+ return call_mmap(host_file, vma, map_flags);
}
int coda_open(struct inode *coda_inode, struct file *coda_file)
@@ -169,7 +169,8 @@ static int read_or_initialize_metadata(struct dentry *dentry)
return rc;
}
-static int ecryptfs_mmap(struct file *file, struct vm_area_struct *vma)
+static int ecryptfs_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct file *lower_file = ecryptfs_file_to_lower(file);
/*
@@ -179,7 +180,7 @@ static int ecryptfs_mmap(struct file *file, struct vm_area_struct *vma)
*/
if (!lower_file->f_op->mmap)
return -ENODEV;
- return generic_file_mmap(file, vma);
+ return generic_file_mmap(file, vma, 0);
}
/**
@@ -141,10 +141,11 @@ static const struct vm_operations_struct ext2_dax_vm_ops = {
.pfn_mkwrite = ext2_dax_pfn_mkwrite,
};
-static int ext2_file_mmap(struct file *file, struct vm_area_struct *vma)
+static int ext2_file_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
if (!IS_DAX(file_inode(file)))
- return generic_file_mmap(file, vma);
+ return generic_file_mmap(file, vma, 0);
file_accessed(file);
vma->vm_ops = &ext2_dax_vm_ops;
@@ -357,7 +357,8 @@ static const struct vm_operations_struct ext4_file_vm_ops = {
.page_mkwrite = ext4_page_mkwrite,
};
-static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
+static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct inode *inode = file->f_mapping->host;
@@ -425,7 +425,8 @@ static loff_t f2fs_llseek(struct file *file, loff_t offset, int whence)
return -EINVAL;
}
-static int f2fs_file_mmap(struct file *file, struct vm_area_struct *vma)
+static int f2fs_file_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct inode *inode = file_inode(file);
int err;
@@ -2063,7 +2063,8 @@ static const struct vm_operations_struct fuse_file_vm_ops = {
.page_mkwrite = fuse_page_mkwrite,
};
-static int fuse_file_mmap(struct file *file, struct vm_area_struct *vma)
+static int fuse_file_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
if ((vma->vm_flags & VM_SHARED) && (vma->vm_flags & VM_MAYWRITE))
fuse_link_write_file(file);
@@ -2073,7 +2074,8 @@ static int fuse_file_mmap(struct file *file, struct vm_area_struct *vma)
return 0;
}
-static int fuse_direct_mmap(struct file *file, struct vm_area_struct *vma)
+static int fuse_direct_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
/* Can't provide the coherency needed for MAP_SHARED */
if (vma->vm_flags & VM_MAYSHARE)
@@ -2081,7 +2083,7 @@ static int fuse_direct_mmap(struct file *file, struct vm_area_struct *vma)
invalidate_inode_pages2(file->f_mapping);
- return generic_file_mmap(file, vma);
+ return generic_file_mmap(file, vma, 0);
}
static int convert_fuse_file_lock(struct fuse_conn *fc,
@@ -506,7 +506,8 @@ static const struct vm_operations_struct gfs2_vm_ops = {
* Returns: 0
*/
-static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)
+static int gfs2_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
@@ -118,7 +118,8 @@ static void huge_pagevec_release(struct pagevec *pvec)
pagevec_reinit(pvec);
}
-static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
+static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct inode *inode = file_inode(file);
loff_t len, vma_len;
@@ -467,7 +467,8 @@ static const struct vm_operations_struct kernfs_vm_ops = {
#endif
};
-static int kernfs_fop_mmap(struct file *file, struct vm_area_struct *vma)
+static int kernfs_fop_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct kernfs_open_file *of = kernfs_of(file);
const struct kernfs_ops *ops;
@@ -100,7 +100,8 @@ static const struct vm_operations_struct ncp_file_mmap =
/* This is used for a general mmap of a ncp file */
-int ncp_mmap(struct file *file, struct vm_area_struct *vma)
+int ncp_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct inode *inode = file_inode(file);
@@ -92,7 +92,7 @@ extern const struct file_operations ncp_file_operations;
int ncp_make_open(struct inode *, int);
/* linux/fs/ncpfs/mmap.c */
-int ncp_mmap(struct file *, struct vm_area_struct *);
+int ncp_mmap(struct file *, struct vm_area_struct *, unsigned long);
/* linux/fs/ncpfs/ncplib_kernel.c */
int ncp_make_closed(struct inode *);
@@ -176,7 +176,8 @@ nfs_file_read(struct kiocb *iocb, struct iov_iter *to)
EXPORT_SYMBOL_GPL(nfs_file_read);
int
-nfs_file_mmap(struct file * file, struct vm_area_struct * vma)
+nfs_file_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct inode *inode = file_inode(file);
int status;
@@ -186,7 +187,7 @@ nfs_file_mmap(struct file * file, struct vm_area_struct * vma)
/* Note: generic_file_mmap() returns ENOSYS on nommu systems
* so we call that before revalidating the mapping
*/
- status = generic_file_mmap(file, vma);
+ status = generic_file_mmap(file, vma, 0);
if (!status) {
vma->vm_ops = &nfs_file_vm_ops;
status = nfs_revalidate_mapping(inode, file->f_mapping);
@@ -370,7 +370,7 @@ int nfs_rename(struct inode *, struct dentry *,
int nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync);
loff_t nfs_file_llseek(struct file *, loff_t, int);
ssize_t nfs_file_read(struct kiocb *, struct iov_iter *);
-int nfs_file_mmap(struct file *, struct vm_area_struct *);
+int nfs_file_mmap(struct file *, struct vm_area_struct *, unsigned long);
ssize_t nfs_file_write(struct kiocb *, struct iov_iter *);
int nfs_file_release(struct inode *, struct file *);
int nfs_lock(struct file *, int, struct file_lock *);
@@ -126,7 +126,8 @@ static const struct vm_operations_struct nilfs_file_vm_ops = {
.page_mkwrite = nilfs_page_mkwrite,
};
-static int nilfs_file_mmap(struct file *file, struct vm_area_struct *vma)
+static int nilfs_file_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
file_accessed(file);
vma->vm_ops = &nilfs_file_vm_ops;
@@ -179,7 +179,8 @@ static const struct vm_operations_struct ocfs2_file_vm_ops = {
.page_mkwrite = ocfs2_page_mkwrite,
};
-int ocfs2_mmap(struct file *file, struct vm_area_struct *vma)
+int ocfs2_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
int ret = 0, lock_level = 0;
@@ -1,6 +1,7 @@
#ifndef OCFS2_MMAP_H
#define OCFS2_MMAP_H
-int ocfs2_mmap(struct file *file, struct vm_area_struct *vma);
+int ocfs2_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags);
#endif /* OCFS2_MMAP_H */
@@ -584,7 +584,8 @@ static long orangefs_ioctl(struct file *file, unsigned int cmd, unsigned long ar
/*
* Memory map a region of a file.
*/
-static int orangefs_file_mmap(struct file *file, struct vm_area_struct *vma)
+static int orangefs_file_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
gossip_debug(GOSSIP_FILE_DEBUG,
"orangefs_file_mmap: called on %s\n",
@@ -597,7 +598,7 @@ static int orangefs_file_mmap(struct file *file, struct vm_area_struct *vma)
vma->vm_flags &= ~VM_RAND_READ;
/* Use readonly mmap since we cannot support writable maps. */
- return generic_file_readonly_mmap(file, vma);
+ return generic_file_readonly_mmap(file, vma, 0);
}
#define mapping_nrpages(idata) ((idata)->nrpages)
@@ -277,15 +277,16 @@ static long proc_reg_compat_ioctl(struct file *file, unsigned int cmd, unsigned
}
#endif
-static int proc_reg_mmap(struct file *file, struct vm_area_struct *vma)
+static int proc_reg_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct proc_dir_entry *pde = PDE(file_inode(file));
int rv = -EIO;
- int (*mmap)(struct file *, struct vm_area_struct *);
+ int (*mmap)(struct file *, struct vm_area_struct *, unsigned long);
if (use_pde(pde)) {
mmap = pde->proc_fops->mmap;
if (mmap)
- rv = mmap(file, vma);
+ rv = mmap(file, vma, map_flags);
unuse_pde(pde);
}
return rv;
@@ -406,7 +406,8 @@ static int vmcore_remap_oldmem_pfn(struct vm_area_struct *vma,
return remap_oldmem_pfn_range(vma, from, pfn, size, prot);
}
-static int mmap_vmcore(struct file *file, struct vm_area_struct *vma)
+static int mmap_vmcore(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
size_t size = vma->vm_end - vma->vm_start;
u64 start, end, len, tsz;
@@ -485,7 +486,8 @@ static int mmap_vmcore(struct file *file, struct vm_area_struct *vma)
return -EAGAIN;
}
#else
-static int mmap_vmcore(struct file *file, struct vm_area_struct *vma)
+static int mmap_vmcore(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
return -ENOSYS;
}
@@ -32,7 +32,8 @@ static unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
unsigned long len,
unsigned long pgoff,
unsigned long flags);
-static int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma);
+static int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags);
static unsigned ramfs_mmap_capabilities(struct file *file)
{
@@ -257,7 +258,8 @@ static unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
/*
* set up a mapping for shared memory segments
*/
-static int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma)
+static int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
if (!(vma->vm_flags & (VM_SHARED | VM_MAYSHARE)))
return -ENOSYS;
@@ -65,7 +65,8 @@ static unsigned long romfs_get_unmapped_area(struct file *file,
* permit a R/O mapping to be made directly through onto an MTD device if
* possible
*/
-static int romfs_mmap(struct file *file, struct vm_area_struct *vma)
+static int romfs_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
return vma->vm_flags & (VM_SHARED | VM_MAYSHARE) ? 0 : -ENOSYS;
}
@@ -1612,11 +1612,12 @@ static const struct vm_operations_struct ubifs_file_vm_ops = {
.page_mkwrite = ubifs_vm_page_mkwrite,
};
-static int ubifs_file_mmap(struct file *file, struct vm_area_struct *vma)
+static int ubifs_file_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
int err;
- err = generic_file_mmap(file, vma);
+ err = generic_file_mmap(file, vma, 0);
if (err)
return err;
vma->vm_ops = &ubifs_file_vm_ops;
@@ -1146,9 +1146,8 @@ static const struct vm_operations_struct xfs_file_vm_ops = {
};
STATIC int
-xfs_file_mmap(
- struct file *filp,
- struct vm_area_struct *vma)
+xfs_file_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
file_accessed(filp);
vma->vm_ops = &xfs_file_vm_ops;
@@ -214,7 +214,8 @@ void drm_gem_vm_open(struct vm_area_struct *vma);
void drm_gem_vm_close(struct vm_area_struct *vma);
int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
struct vm_area_struct *vma);
-int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
+int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
/**
* drm_gem_object_get - acquire a GEM buffer object reference
@@ -79,7 +79,8 @@ int drm_gem_cma_dumb_map_offset(struct drm_file *file_priv,
u64 *offset);
/* set vm_flags and we can change the VM attribute to other one at here */
-int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma);
+int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
/* allocate physical memory */
struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
@@ -161,7 +161,8 @@ int drm_legacy_rmmap_locked(struct drm_device *d, struct drm_local_map *map);
void drm_legacy_master_rmmaps(struct drm_device *dev,
struct drm_master *master);
struct drm_local_map *drm_legacy_getsarea(struct drm_device *dev);
-int drm_legacy_mmap(struct file *filp, struct vm_area_struct *vma);
+int drm_legacy_mmap(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags);
int drm_legacy_addbufs_agp(struct drm_device *d, struct drm_buf_desc *req);
int drm_legacy_addbufs_pci(struct drm_device *d, struct drm_buf_desc *req);
@@ -1673,7 +1673,7 @@ struct file_operations {
unsigned int (*poll) (struct file *, struct poll_table_struct *);
long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
- int (*mmap) (struct file *, struct vm_area_struct *);
+ int (*mmap) (struct file *, struct vm_area_struct *, unsigned long);
int (*open) (struct inode *, struct file *);
int (*flush) (struct file *, fl_owner_t id);
int (*release) (struct inode *, struct file *);
@@ -1743,9 +1743,10 @@ static inline ssize_t call_write_iter(struct file *file, struct kiocb *kio,
return file->f_op->write_iter(kio, iter);
}
-static inline int call_mmap(struct file *file, struct vm_area_struct *vma)
+static inline int call_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long flags)
{
- return file->f_op->mmap(file, vma);
+ return file->f_op->mmap(file, vma, flags);
}
ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
@@ -2864,8 +2865,10 @@ extern int set_blocksize(struct block_device *, int);
extern int sb_set_blocksize(struct super_block *, int);
extern int sb_min_blocksize(struct super_block *, int);
-extern int generic_file_mmap(struct file *, struct vm_area_struct *);
-extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
+extern int generic_file_mmap(struct file *, struct vm_area_struct *,
+ unsigned long);
+extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *,
+ unsigned long);
extern ssize_t generic_write_checks(struct kiocb *, struct iov_iter *);
extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *);
extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *);
@@ -266,7 +266,8 @@ int cxl_start_work(struct cxl_context *ctx,
int cxl_fd_open(struct inode *inode, struct file *file);
int cxl_fd_release(struct inode *inode, struct file *file);
long cxl_fd_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
-int cxl_fd_mmap(struct file *file, struct vm_area_struct *vm);
+int cxl_fd_mmap(struct file *file, struct vm_area_struct *vm,
+ unsigned long map_flags);
unsigned int cxl_fd_poll(struct file *file, struct poll_table_struct *poll);
ssize_t cxl_fd_read(struct file *file, char __user *buf, size_t count,
loff_t *off);
@@ -411,7 +411,8 @@ static struct mempolicy *shm_get_policy(struct vm_area_struct *vma,
}
#endif
-static int shm_mmap(struct file *file, struct vm_area_struct *vma)
+static int shm_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct shm_file_data *sfd = shm_file_data(file);
int ret;
@@ -424,7 +425,7 @@ static int shm_mmap(struct file *file, struct vm_area_struct *vma)
if (ret)
return ret;
- ret = call_mmap(sfd->file, vma);
+ ret = call_mmap(sfd->file, vma, map_flags);
if (ret) {
shm_close(vma);
return ret;
@@ -5219,7 +5219,8 @@ static const struct vm_operations_struct perf_mmap_vmops = {
.page_mkwrite = perf_mmap_fault,
};
-static int perf_mmap(struct file *file, struct vm_area_struct *vma)
+static int perf_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct perf_event *event = file->private_data;
unsigned long user_locked, user_lock_limit;
@@ -132,7 +132,8 @@ void kcov_task_exit(struct task_struct *t)
kcov_put(kcov);
}
-static int kcov_mmap(struct file *filep, struct vm_area_struct *vma)
+static int kcov_mmap(struct file *filep, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
int res = 0;
void *area;
@@ -906,7 +906,8 @@ static int relay_file_open(struct inode *inode, struct file *filp)
*
* Calls upon relay_mmap_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(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct rchan_buf *buf = filp->private_data;
return relay_mmap_buf(buf, vma);
@@ -2569,7 +2569,8 @@ const struct vm_operations_struct generic_file_vm_ops = {
/* This is used for a general mmap of a disk file */
-int generic_file_mmap(struct file * file, struct vm_area_struct * vma)
+int generic_file_mmap(struct file * file, struct vm_area_struct * vma,
+ unsigned long map_flags)
{
struct address_space *mapping = file->f_mapping;
@@ -2583,18 +2584,21 @@ int generic_file_mmap(struct file * file, struct vm_area_struct * vma)
/*
* This is for filesystems which do not implement ->writepage.
*/
-int generic_file_readonly_mmap(struct file *file, struct vm_area_struct *vma)
+int generic_file_readonly_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
if ((vma->vm_flags & VM_SHARED) && (vma->vm_flags & VM_MAYWRITE))
return -EINVAL;
- return generic_file_mmap(file, vma);
+ return generic_file_mmap(file, vma, 0);
}
#else
-int generic_file_mmap(struct file * file, struct vm_area_struct * vma)
+int generic_file_mmap(struct file * file, struct vm_area_struct * vma,
+ unsigned long map_flags)
{
return -ENOSYS;
}
-int generic_file_readonly_mmap(struct file * file, struct vm_area_struct * vma)
+int generic_file_readonly_mmap(struct file * file, struct vm_area_struct * vma,
+ unsigned long map_flags)
{
return -ENOSYS;
}
@@ -1686,7 +1686,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
* new file must not have been exposed to user-space, yet.
*/
vma->vm_file = get_file(file);
- error = call_mmap(file, vma);
+ error = call_mmap(file, vma, 0);
if (error)
goto unmap_and_free_vma;
@@ -1089,7 +1089,7 @@ static int do_mmap_shared_file(struct vm_area_struct *vma)
{
int ret;
- ret = call_mmap(vma->vm_file, vma);
+ ret = call_mmap(vma->vm_file, vma, 0);
if (ret == 0) {
vma->vm_region->vm_top = vma->vm_region->vm_end;
return 0;
@@ -1120,7 +1120,7 @@ static int do_mmap_private(struct vm_area_struct *vma,
* - VM_MAYSHARE will be set if it may attempt to share
*/
if (capabilities & NOMMU_MAP_DIRECT) {
- ret = call_mmap(vma->vm_file, vma);
+ ret = call_mmap(vma->vm_file, vma, 0);
if (ret == 0) {
/* shouldn't return success if we're not sharing */
BUG_ON(!(vma->vm_flags & VM_MAYSHARE));
@@ -2130,7 +2130,8 @@ int shmem_lock(struct file *file, int lock, struct user_struct *user)
return retval;
}
-static int shmem_mmap(struct file *file, struct vm_area_struct *vma)
+static int shmem_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
file_accessed(file);
vma->vm_ops = &shmem_vm_ops;
@@ -115,7 +115,8 @@ unsigned int sysctl_net_busy_poll __read_mostly;
static ssize_t sock_read_iter(struct kiocb *iocb, struct iov_iter *to);
static ssize_t sock_write_iter(struct kiocb *iocb, struct iov_iter *from);
-static int sock_mmap(struct file *file, struct vm_area_struct *vma);
+static int sock_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags);
static int sock_close(struct inode *inode, struct file *file);
static unsigned int sock_poll(struct file *file,
@@ -1100,7 +1101,8 @@ static unsigned int sock_poll(struct file *file, poll_table *wait)
return busy_flag | sock->ops->poll(file, sock, wait);
}
-static int sock_mmap(struct file *file, struct vm_area_struct *vma)
+static int sock_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct socket *sock = file->private_data;
@@ -215,7 +215,8 @@ static ssize_t sel_read_handle_status(struct file *filp, char __user *buf,
}
static int sel_mmap_handle_status(struct file *filp,
- struct vm_area_struct *vma)
+ struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct page *status = filp->private_data;
unsigned long size = vma->vm_end - vma->vm_start;
@@ -444,7 +445,8 @@ static const struct vm_operations_struct sel_mmap_policy_ops = {
.page_mkwrite = sel_mmap_policy_fault,
};
-static int sel_mmap_policy(struct file *filp, struct vm_area_struct *vma)
+static int sel_mmap_policy(struct file *filp, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
if (vma->vm_flags & VM_SHARED) {
/* do not allow mprotect to make mapping writable */
@@ -391,7 +391,8 @@ static ssize_t snd_compr_read(struct file *f, char __user *buf,
return retval;
}
-static int snd_compr_mmap(struct file *f, struct vm_area_struct *vma)
+static int snd_compr_mmap(struct file *f, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
return -ENXIO;
}
@@ -260,7 +260,8 @@ static long snd_hwdep_ioctl(struct file * file, unsigned int cmd,
return -ENOTTY;
}
-static int snd_hwdep_mmap(struct file * file, struct vm_area_struct * vma)
+static int snd_hwdep_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct snd_hwdep *hw = file->private_data;
if (hw->ops.mmap)
@@ -232,7 +232,8 @@ static long snd_info_entry_ioctl(struct file *file, unsigned int cmd,
file, cmd, arg);
}
-static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma)
+static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
struct inode *inode = file_inode(file);
struct snd_info_private_data *data;
@@ -356,7 +356,8 @@ static long snd_disconnect_ioctl(struct file *file,
return -ENODEV;
}
-static int snd_disconnect_mmap(struct file *file, struct vm_area_struct *vma)
+static int snd_disconnect_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
return -ENODEV;
}
@@ -2716,7 +2716,8 @@ static unsigned int snd_pcm_oss_poll(struct file *file, poll_table * wait)
return mask;
}
-static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area)
+static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area,
+ unsigned long map_flags)
{
struct snd_pcm_oss_file *pcm_oss_file;
struct snd_pcm_substream *substream = NULL;
@@ -3585,7 +3585,8 @@ int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file,
}
EXPORT_SYMBOL(snd_pcm_mmap_data);
-static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area)
+static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area,
+ unsigned long map_flags)
{
struct snd_pcm_file * pcm_file;
struct snd_pcm_substream *substream;
@@ -420,7 +420,8 @@ static unsigned int sound_poll(struct file *file, poll_table * wait)
return 0;
}
-static int sound_mmap(struct file *file, struct vm_area_struct *vma)
+static int sound_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
int dev_class;
unsigned long size;
@@ -1962,7 +1962,8 @@ static unsigned int cs4297a_poll(struct file *file,
}
-static int cs4297a_mmap(struct file *file, struct vm_area_struct *vma)
+static int cs4297a_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
/* XXXKW currently no mmap support */
return -EINVAL;
@@ -2395,7 +2395,8 @@ static const struct vm_operations_struct kvm_vcpu_vm_ops = {
.fault = kvm_vcpu_fault,
};
-static int kvm_vcpu_mmap(struct file *file, struct vm_area_struct *vma)
+static int kvm_vcpu_mmap(struct file *file, struct vm_area_struct *vma,
+ unsigned long map_flags)
{
vma->vm_ops = &kvm_vcpu_vm_ops;
return 0;