Commit 6e346228c76506e07e297744a28464022c6806ad

Authored by Linus Torvalds
1 parent 968002166c

It wasn't just x86-64 that had hardcoded VM_FAULT_xxx numbers

Fix up arm26, cris, frv, m68k, parisc and sh64 too..

Showing 6 changed files with 25 additions and 28 deletions Side-by-side Diff

arch/arm26/mm/fault.c
... ... @@ -176,12 +176,12 @@
176 176 * Handle the "normal" cases first - successful and sigbus
177 177 */
178 178 switch (fault) {
179   - case 2:
  179 + case VM_FAULT_MAJOR:
180 180 tsk->maj_flt++;
181 181 return fault;
182   - case 1:
  182 + case VM_FAULT_MINOR:
183 183 tsk->min_flt++;
184   - case 0:
  184 + case VM_FAULT_SIGBUS:
185 185 return fault;
186 186 }
187 187  
188 188  
... ... @@ -226,14 +226,11 @@
226 226 /*
227 227 * Handle the "normal" case first
228 228 */
229   - if (fault > 0)
  229 + switch (fault) {
  230 + case VM_FAULT_MINOR:
  231 + case VM_FAULT_MAJOR:
230 232 return 0;
231   -
232   - /*
233   - * We had some memory, but were unable to
234   - * successfully fix up this page fault.
235   - */
236   - if (fault == 0){
  233 + case VM_FAULT_SIGBUS:
237 234 goto do_sigbus;
238 235 }
239 236  
arch/cris/mm/fault.c
... ... @@ -284,13 +284,13 @@
284 284 */
285 285  
286 286 switch (handle_mm_fault(mm, vma, address, writeaccess & 1)) {
287   - case 1:
  287 + case VM_FAULT_MINOR:
288 288 tsk->min_flt++;
289 289 break;
290   - case 2:
  290 + case VM_FAULT_MAJOR:
291 291 tsk->maj_flt++;
292 292 break;
293   - case 0:
  293 + case VM_FAULT_SIGBUS:
294 294 goto do_sigbus;
295 295 default:
296 296 goto out_of_memory;
... ... @@ -163,13 +163,13 @@
163 163 * the fault.
164 164 */
165 165 switch (handle_mm_fault(mm, vma, ear0, write)) {
166   - case 1:
  166 + case VM_FAULT_MINOR:
167 167 current->min_flt++;
168 168 break;
169   - case 2:
  169 + case VM_FAULT_MAJOR:
170 170 current->maj_flt++;
171 171 break;
172   - case 0:
  172 + case VM_FAULT_SIGBUS:
173 173 goto do_sigbus;
174 174 default:
175 175 goto out_of_memory;
arch/m68k/mm/fault.c
... ... @@ -160,13 +160,13 @@
160 160 printk("handle_mm_fault returns %d\n",fault);
161 161 #endif
162 162 switch (fault) {
163   - case 1:
  163 + case VM_FAULT_MINOR:
164 164 current->min_flt++;
165 165 break;
166   - case 2:
  166 + case VM_FAULT_MAJOR:
167 167 current->maj_flt++;
168 168 break;
169   - case 0:
  169 + case VM_FAULT_SIGBUS:
170 170 goto bus_err;
171 171 default:
172 172 goto out_of_memory;
arch/parisc/mm/fault.c
... ... @@ -178,17 +178,17 @@
178 178 */
179 179  
180 180 switch (handle_mm_fault(mm, vma, address, (acc_type & VM_WRITE) != 0)) {
181   - case 1:
  181 + case VM_FAULT_MINOR:
182 182 ++current->min_flt;
183 183 break;
184   - case 2:
  184 + case VM_FAULT_MAJOR:
185 185 ++current->maj_flt;
186 186 break;
187   - case 0:
  187 + case VM_FAULT_SIGBUS:
188 188 /*
189   - * We ran out of memory, or some other thing happened
190   - * to us that made us unable to handle the page fault
191   - * gracefully.
  189 + * We hit a hared mapping outside of the file, or some
  190 + * other thing happened to us that made us unable to
  191 + * handle the page fault gracefully.
192 192 */
193 193 goto bad_area;
194 194 default:
arch/sh64/mm/fault.c
... ... @@ -223,13 +223,13 @@
223 223 */
224 224 survive:
225 225 switch (handle_mm_fault(mm, vma, address, writeaccess)) {
226   - case 1:
  226 + case VM_FAULT_MINOR:
227 227 tsk->min_flt++;
228 228 break;
229   - case 2:
  229 + case VM_FAULT_MAJOR:
230 230 tsk->maj_flt++;
231 231 break;
232   - case 0:
  232 + case VM_FAULT_SIGBUS:
233 233 goto do_sigbus;
234 234 default:
235 235 goto out_of_memory;