19f785d5aba62901283c53c027a5f1515977bb8b
[openwrt.git] / target / linux / generic / patches-2.6.38 / 980-vm_exports.patch
1 Index: linux-2.6.38.2/mm/shmem.c
2 ===================================================================
3 --- linux-2.6.38.2.orig/mm/shmem.c      2011-03-27 20:37:20.000000000 +0200
4 +++ linux-2.6.38.2/mm/shmem.c   2011-03-30 18:23:12.296417197 +0200
5 @@ -30,6 +30,7 @@
6  #include <linux/module.h>
7  #include <linux/percpu_counter.h>
8  #include <linux/swap.h>
9 +#include <linux/ima.h>
10  
11  static struct vfsmount *shm_mnt;
12  
13 @@ -2710,6 +2711,17 @@ out:
14  
15  /* common code */
16  
17 +void shmem_set_file(struct vm_area_struct *vma, struct file *file)
18 +{
19 +       ima_counts_get(file);
20 +       if (vma->vm_file)
21 +               fput(vma->vm_file);
22 +       vma->vm_file = file;
23 +       vma->vm_ops = &shmem_vm_ops;
24 +       vma->vm_flags |= VM_CAN_NONLINEAR;
25 +}
26 +EXPORT_SYMBOL_GPL(shmem_set_file);
27 +
28  /**
29   * shmem_file_setup - get an unlinked file living in tmpfs
30   * @name: name for dentry (to be seen in /proc/<pid>/maps
31 @@ -2787,10 +2799,7 @@ int shmem_zero_setup(struct vm_area_stru
32         if (IS_ERR(file))
33                 return PTR_ERR(file);
34  
35 -       if (vma->vm_file)
36 -               fput(vma->vm_file);
37 -       vma->vm_file = file;
38 -       vma->vm_ops = &shmem_vm_ops;
39 -       vma->vm_flags |= VM_CAN_NONLINEAR;
40 +       shmem_set_file(vma, file);
41 +
42         return 0;
43  }
44 Index: linux-2.6.38.2/fs/file.c
45 ===================================================================
46 --- linux-2.6.38.2.orig/fs/file.c       2011-03-27 20:37:20.000000000 +0200
47 +++ linux-2.6.38.2/fs/file.c    2011-03-28 22:44:57.267151662 +0200
48 @@ -264,6 +264,7 @@ int expand_files(struct files_struct *fi
49         /* All good, so we try */
50         return expand_fdtable(files, nr);
51  }
52 +EXPORT_SYMBOL_GPL(expand_files);
53  
54  static int count_open_files(struct fdtable *fdt)
55  {
56 Index: linux-2.6.38.2/kernel/exit.c
57 ===================================================================
58 --- linux-2.6.38.2.orig/kernel/exit.c   2011-03-27 20:37:20.000000000 +0200
59 +++ linux-2.6.38.2/kernel/exit.c        2011-03-28 22:44:57.269151650 +0200
60 @@ -513,6 +513,7 @@ struct files_struct *get_files_struct(st
61  
62         return files;
63  }
64 +EXPORT_SYMBOL_GPL(get_files_struct);
65  
66  void put_files_struct(struct files_struct *files)
67  {
68 @@ -534,6 +535,7 @@ void put_files_struct(struct files_struc
69                 rcu_read_unlock();
70         }
71  }
72 +EXPORT_SYMBOL_GPL(put_files_struct);
73  
74  void reset_files_struct(struct files_struct *files)
75  {
76 Index: linux-2.6.38.2/kernel/fork.c
77 ===================================================================
78 --- linux-2.6.38.2.orig/kernel/fork.c   2011-03-27 20:37:20.000000000 +0200
79 +++ linux-2.6.38.2/kernel/fork.c        2011-03-28 22:44:57.270151644 +0200
80 @@ -193,6 +193,7 @@ void __put_task_struct(struct task_struc
81         if (!profile_handoff_task(tsk))
82                 free_task(tsk);
83  }
84 +EXPORT_SYMBOL_GPL(__put_task_struct);
85  
86  /*
87   * macro override instead of weak attribute alias, to workaround
88 Index: linux-2.6.38.2/kernel/sched.c
89 ===================================================================
90 --- linux-2.6.38.2.orig/kernel/sched.c  2011-03-27 20:37:20.000000000 +0200
91 +++ linux-2.6.38.2/kernel/sched.c       2011-03-28 22:44:57.274151620 +0200
92 @@ -4641,6 +4641,7 @@ int can_nice(const struct task_struct *p
93         return (nice_rlim <= task_rlimit(p, RLIMIT_NICE) ||
94                 capable(CAP_SYS_NICE));
95  }
96 +EXPORT_SYMBOL_GPL(can_nice);
97  
98  #ifdef __ARCH_WANT_SYS_NICE
99  
100 Index: linux-2.6.38.2/mm/memory.c
101 ===================================================================
102 --- linux-2.6.38.2.orig/mm/memory.c     2011-03-27 20:37:20.000000000 +0200
103 +++ linux-2.6.38.2/mm/memory.c  2011-03-28 22:44:57.277151603 +0200
104 @@ -1229,6 +1229,7 @@ unsigned long zap_page_range(struct vm_a
105                 tlb_finish_mmu(tlb, address, end);
106         return end;
107  }
108 +EXPORT_SYMBOL_GPL(zap_page_range);
109  
110  /**
111   * zap_vma_ptes - remove ptes mapping the vma
112 @@ -2692,6 +2693,7 @@ int vmtruncate_range(struct inode *inode
113  
114         return 0;
115  }
116 +EXPORT_SYMBOL_GPL(vmtruncate_range);
117  
118  /*
119   * We enter with non-exclusive mmap_sem (to exclude vma changes,
120 Index: linux-2.6.38.2/mm/vmalloc.c
121 ===================================================================
122 --- linux-2.6.38.2.orig/mm/vmalloc.c    2011-03-27 20:37:20.000000000 +0200
123 +++ linux-2.6.38.2/mm/vmalloc.c 2011-03-28 22:44:57.278151598 +0200
124 @@ -1193,6 +1193,7 @@ void unmap_kernel_range(unsigned long ad
125         vunmap_page_range(addr, end);
126         flush_tlb_kernel_range(addr, end);
127  }
128 +EXPORT_SYMBOL_GPL(unmap_kernel_range);
129  
130  int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages)
131  {
132 @@ -1308,6 +1309,7 @@ struct vm_struct *get_vm_area(unsigned l
133         return __get_vm_area_node(size, 1, flags, VMALLOC_START, VMALLOC_END,
134                                 -1, GFP_KERNEL, __builtin_return_address(0));
135  }
136 +EXPORT_SYMBOL_GPL(get_vm_area);
137  
138  struct vm_struct *get_vm_area_caller(unsigned long size, unsigned long flags,
139                                 void *caller)
140 Index: linux-2.6.38.2/include/linux/mm.h
141 ===================================================================
142 --- linux-2.6.38.2.orig/include/linux/mm.h      2011-03-27 20:37:20.000000000 +0200
143 +++ linux-2.6.38.2/include/linux/mm.h   2011-03-28 22:44:57.279151592 +0200
144 @@ -863,6 +863,7 @@ extern void show_free_areas(void);
145  
146  int shmem_lock(struct file *file, int lock, struct user_struct *user);
147  struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags);
148 +void shmem_set_file(struct vm_area_struct *vma, struct file *file);
149  int shmem_zero_setup(struct vm_area_struct *);
150  
151  #ifndef CONFIG_MMU