kernel: make the kernel 3.18 patches apply and boot on arm.
[openwrt/staging/chunkeey.git] / target / linux / generic / patches-3.18 / 950-vm_exports.patch
1 --- a/mm/shmem.c
2 +++ b/mm/shmem.c
3 @@ -3377,6 +3377,15 @@ put_path:
4 return res;
5 }
6
7 +void shmem_set_file(struct vm_area_struct *vma, struct file *file)
8 +{
9 + if (vma->vm_file)
10 + fput(vma->vm_file);
11 + vma->vm_file = file;
12 + vma->vm_ops = &shmem_vm_ops;
13 +}
14 +EXPORT_SYMBOL_GPL(shmem_set_file);
15 +
16 /**
17 * shmem_kernel_file_setup - get an unlinked file living in tmpfs which must be
18 * kernel internal. There will be NO LSM permission checks against the
19 @@ -3416,11 +3425,8 @@ int shmem_zero_setup(struct vm_area_stru
20 file = shmem_file_setup("dev/zero", size, vma->vm_flags);
21 if (IS_ERR(file))
22 return PTR_ERR(file);
23 + shmem_set_file(vma, file);
24
25 - if (vma->vm_file)
26 - fput(vma->vm_file);
27 - vma->vm_file = file;
28 - vma->vm_ops = &shmem_vm_ops;
29 return 0;
30 }
31
32 --- a/fs/file.c
33 +++ b/fs/file.c
34 @@ -216,6 +216,7 @@ static inline void __set_open_fd(int fd,
35 {
36 __set_bit(fd, fdt->open_fds);
37 }
38 +EXPORT_SYMBOL_GPL(expand_files);
39
40 static inline void __clear_open_fd(int fd, struct fdtable *fdt)
41 {
42 --- a/kernel/exit.c
43 +++ b/kernel/exit.c
44 @@ -461,6 +461,8 @@ static void exit_mm(struct task_struct *
45 mmput(mm);
46 clear_thread_flag(TIF_MEMDIE);
47 }
48 +EXPORT_SYMBOL_GPL(get_files_struct);
49 +EXPORT_SYMBOL_GPL(put_files_struct);
50
51 /*
52 * When we die, we re-parent all our children, and try to:
53 --- a/kernel/sched/core.c
54 +++ b/kernel/sched/core.c
55 @@ -3147,6 +3147,7 @@ int can_nice(const struct task_struct *p
56 return (nice_rlim <= task_rlimit(p, RLIMIT_NICE) ||
57 capable(CAP_SYS_NICE));
58 }
59 +EXPORT_SYMBOL_GPL(can_nice);
60
61 #ifdef __ARCH_WANT_SYS_NICE
62
63 --- a/mm/memory.c
64 +++ b/mm/memory.c
65 @@ -1403,6 +1403,7 @@ void zap_page_range(struct vm_area_struc
66 mmu_notifier_invalidate_range_end(mm, start, end);
67 tlb_finish_mmu(&tlb, start, end);
68 }
69 +EXPORT_SYMBOL_GPL(zap_page_range);
70
71 /**
72 * zap_page_range_single - remove user pages in a given range
73 --- a/mm/vmalloc.c
74 +++ b/mm/vmalloc.c
75 @@ -1372,6 +1372,7 @@ struct vm_struct *get_vm_area(unsigned l
76 NUMA_NO_NODE, GFP_KERNEL,
77 __builtin_return_address(0));
78 }
79 +EXPORT_SYMBOL_GPL(get_vm_area);
80
81 struct vm_struct *get_vm_area_caller(unsigned long size, unsigned long flags,
82 const void *caller)
83 --- a/include/linux/shmem_fs.h
84 +++ b/include/linux/shmem_fs.h
85 @@ -49,6 +49,8 @@ extern int shmem_init(void);
86 extern int shmem_fill_super(struct super_block *sb, void *data, int silent);
87 extern struct file *shmem_file_setup(const char *name,
88 loff_t size, unsigned long flags);
89 +
90 +extern void shmem_set_file(struct vm_area_struct *vma, struct file *file);
91 extern struct file *shmem_kernel_file_setup(const char *name, loff_t size,
92 unsigned long flags);
93 extern int shmem_zero_setup(struct vm_area_struct *);