提交 7cbea8dc 编写于 作者: K Kirill A. Shutemov 提交者: Linus Torvalds

mm: mark most vm_operations_struct const

With two exceptions (drm/qxl and drm/radeon) all vm_operations_struct
structs should be constant.
Signed-off-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: NOleg Nesterov <oleg@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 2a78b857
...@@ -277,7 +277,7 @@ static const char *gate_vma_name(struct vm_area_struct *vma) ...@@ -277,7 +277,7 @@ static const char *gate_vma_name(struct vm_area_struct *vma)
{ {
return "[vsyscall]"; return "[vsyscall]";
} }
static struct vm_operations_struct gate_vma_ops = { static const struct vm_operations_struct gate_vma_ops = {
.name = gate_vma_name, .name = gate_vma_name,
}; };
static struct vm_area_struct gate_vma = { static struct vm_area_struct gate_vma = {
......
...@@ -2834,7 +2834,7 @@ static int binder_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -2834,7 +2834,7 @@ static int binder_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
return VM_FAULT_SIGBUS; return VM_FAULT_SIGBUS;
} }
static struct vm_operations_struct binder_vm_ops = { static const struct vm_operations_struct binder_vm_ops = {
.open = binder_vma_open, .open = binder_vma_open,
.close = binder_vma_close, .close = binder_vma_close,
.fault = binder_vm_fault, .fault = binder_vm_fault,
......
...@@ -125,7 +125,7 @@ static int vgem_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -125,7 +125,7 @@ static int vgem_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
} }
} }
static struct vm_operations_struct vgem_gem_vm_ops = { static const struct vm_operations_struct vgem_gem_vm_ops = {
.fault = vgem_gem_fault, .fault = vgem_gem_fault,
.open = drm_gem_vm_open, .open = drm_gem_vm_open,
.close = drm_gem_vm_close, .close = drm_gem_vm_close,
......
...@@ -1110,7 +1110,7 @@ static int cs_char_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -1110,7 +1110,7 @@ static int cs_char_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
return 0; return 0;
} }
static struct vm_operations_struct cs_char_vm_ops = { static const struct vm_operations_struct cs_char_vm_ops = {
.fault = cs_char_vma_fault, .fault = cs_char_vma_fault,
}; };
......
...@@ -908,7 +908,7 @@ static int qib_file_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -908,7 +908,7 @@ static int qib_file_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
return 0; return 0;
} }
static struct vm_operations_struct qib_file_vm_ops = { static const struct vm_operations_struct qib_file_vm_ops = {
.fault = qib_file_vma_fault, .fault = qib_file_vma_fault,
}; };
......
...@@ -75,7 +75,7 @@ static void qib_vma_close(struct vm_area_struct *vma) ...@@ -75,7 +75,7 @@ static void qib_vma_close(struct vm_area_struct *vma)
kref_put(&ip->ref, qib_release_mmap_info); kref_put(&ip->ref, qib_release_mmap_info);
} }
static struct vm_operations_struct qib_vm_ops = { static const struct vm_operations_struct qib_vm_ops = {
.open = qib_vma_open, .open = qib_vma_open,
.close = qib_vma_close, .close = qib_vma_close,
}; };
......
...@@ -872,7 +872,7 @@ static void omap_vout_vm_close(struct vm_area_struct *vma) ...@@ -872,7 +872,7 @@ static void omap_vout_vm_close(struct vm_area_struct *vma)
vout->mmap_count--; vout->mmap_count--;
} }
static struct vm_operations_struct omap_vout_vm_ops = { static const struct vm_operations_struct omap_vout_vm_ops = {
.open = omap_vout_vm_open, .open = omap_vout_vm_open,
.close = omap_vout_vm_close, .close = omap_vout_vm_close,
}; };
......
...@@ -418,7 +418,7 @@ static void genwqe_vma_close(struct vm_area_struct *vma) ...@@ -418,7 +418,7 @@ static void genwqe_vma_close(struct vm_area_struct *vma)
kfree(dma_map); kfree(dma_map);
} }
static struct vm_operations_struct genwqe_vma_ops = { static const struct vm_operations_struct genwqe_vma_ops = {
.open = genwqe_vma_open, .open = genwqe_vma_open,
.close = genwqe_vma_close, .close = genwqe_vma_close,
}; };
......
...@@ -997,7 +997,7 @@ static void ion_vm_close(struct vm_area_struct *vma) ...@@ -997,7 +997,7 @@ static void ion_vm_close(struct vm_area_struct *vma)
mutex_unlock(&buffer->lock); mutex_unlock(&buffer->lock);
} }
static struct vm_operations_struct ion_vma_ops = { static const struct vm_operations_struct ion_vma_ops = {
.open = ion_vm_open, .open = ion_vm_open,
.close = ion_vm_close, .close = ion_vm_close,
.fault = ion_vm_fault, .fault = ion_vm_fault,
......
...@@ -2156,7 +2156,7 @@ static void comedi_vm_close(struct vm_area_struct *area) ...@@ -2156,7 +2156,7 @@ static void comedi_vm_close(struct vm_area_struct *area)
comedi_buf_map_put(bm); comedi_buf_map_put(bm);
} }
static struct vm_operations_struct comedi_vm_ops = { static const struct vm_operations_struct comedi_vm_ops = {
.open = comedi_vm_open, .open = comedi_vm_open,
.close = comedi_vm_close, .close = comedi_vm_close,
}; };
......
...@@ -1091,7 +1091,7 @@ static void mmap_user_close(struct vm_area_struct *vma) ...@@ -1091,7 +1091,7 @@ static void mmap_user_close(struct vm_area_struct *vma)
omapfb_put_mem_region(rg); omapfb_put_mem_region(rg);
} }
static struct vm_operations_struct mmap_user_ops = { static const struct vm_operations_struct mmap_user_ops = {
.open = mmap_user_open, .open = mmap_user_open,
.close = mmap_user_close, .close = mmap_user_close,
}; };
......
...@@ -493,7 +493,7 @@ static void gntalloc_vma_close(struct vm_area_struct *vma) ...@@ -493,7 +493,7 @@ static void gntalloc_vma_close(struct vm_area_struct *vma)
mutex_unlock(&gref_mutex); mutex_unlock(&gref_mutex);
} }
static struct vm_operations_struct gntalloc_vmops = { static const struct vm_operations_struct gntalloc_vmops = {
.open = gntalloc_vma_open, .open = gntalloc_vma_open,
.close = gntalloc_vma_close, .close = gntalloc_vma_close,
}; };
......
...@@ -433,7 +433,7 @@ static struct page *gntdev_vma_find_special_page(struct vm_area_struct *vma, ...@@ -433,7 +433,7 @@ static struct page *gntdev_vma_find_special_page(struct vm_area_struct *vma,
return map->pages[(addr - map->pages_vm_start) >> PAGE_SHIFT]; return map->pages[(addr - map->pages_vm_start) >> PAGE_SHIFT];
} }
static struct vm_operations_struct gntdev_vmops = { static const struct vm_operations_struct gntdev_vmops = {
.open = gntdev_vma_open, .open = gntdev_vma_open,
.close = gntdev_vma_close, .close = gntdev_vma_close,
.find_special_page = gntdev_vma_find_special_page, .find_special_page = gntdev_vma_find_special_page,
......
...@@ -414,7 +414,7 @@ static int alloc_empty_pages(struct vm_area_struct *vma, int numpgs) ...@@ -414,7 +414,7 @@ static int alloc_empty_pages(struct vm_area_struct *vma, int numpgs)
return 0; return 0;
} }
static struct vm_operations_struct privcmd_vm_ops; static const struct vm_operations_struct privcmd_vm_ops;
static long privcmd_ioctl_mmap_batch(void __user *udata, int version) static long privcmd_ioctl_mmap_batch(void __user *udata, int version)
{ {
...@@ -605,7 +605,7 @@ static int privcmd_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -605,7 +605,7 @@ static int privcmd_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
return VM_FAULT_SIGBUS; return VM_FAULT_SIGBUS;
} }
static struct vm_operations_struct privcmd_vm_ops = { static const struct vm_operations_struct privcmd_vm_ops = {
.close = privcmd_close, .close = privcmd_close,
.fault = privcmd_fault .fault = privcmd_fault
}; };
......
...@@ -1593,7 +1593,7 @@ int ceph_uninline_data(struct file *filp, struct page *locked_page) ...@@ -1593,7 +1593,7 @@ int ceph_uninline_data(struct file *filp, struct page *locked_page)
return err; return err;
} }
static struct vm_operations_struct ceph_vmops = { static const struct vm_operations_struct ceph_vmops = {
.fault = ceph_filemap_fault, .fault = ceph_filemap_fault,
.page_mkwrite = ceph_page_mkwrite, .page_mkwrite = ceph_page_mkwrite,
}; };
......
...@@ -3216,7 +3216,7 @@ cifs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -3216,7 +3216,7 @@ cifs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
return VM_FAULT_LOCKED; return VM_FAULT_LOCKED;
} }
static struct vm_operations_struct cifs_file_vm_ops = { static const struct vm_operations_struct cifs_file_vm_ops = {
.fault = filemap_fault, .fault = filemap_fault,
.map_pages = filemap_map_pages, .map_pages = filemap_map_pages,
.page_mkwrite = cifs_page_mkwrite, .page_mkwrite = cifs_page_mkwrite,
......
...@@ -472,7 +472,7 @@ static int sel_mmap_policy_fault(struct vm_area_struct *vma, ...@@ -472,7 +472,7 @@ static int sel_mmap_policy_fault(struct vm_area_struct *vma,
return 0; return 0;
} }
static struct vm_operations_struct sel_mmap_policy_ops = { static const struct vm_operations_struct sel_mmap_policy_ops = {
.fault = sel_mmap_policy_fault, .fault = sel_mmap_policy_fault,
.page_mkwrite = sel_mmap_policy_fault, .page_mkwrite = sel_mmap_policy_fault,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册