diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2024-11-26 10:10:29 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2024-11-26 10:10:29 +0000 |
commit | 33e06fc8f870a119b79b076d3d69e30e98a3f5ea (patch) | |
tree | 7ee2a7e63074ac06a78006638cf44802f719393e /sys | |
parent | ed95b234aba0e5db054c238a654b9dc631eb714e (diff) |
Make uvmfault_anonget() return errno values instead of converting them.
ok miod@, tb@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/uvm/uvm_anon.c | 17 | ||||
-rw-r--r-- | sys/uvm/uvm_fault.c | 34 |
2 files changed, 21 insertions, 30 deletions
diff --git a/sys/uvm/uvm_anon.c b/sys/uvm/uvm_anon.c index 0fc2a0c899c..d18991d1c98 100644 --- a/sys/uvm/uvm_anon.c +++ b/sys/uvm/uvm_anon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_anon.c,v 1.58 2024/04/06 10:59:52 mpi Exp $ */ +/* $OpenBSD: uvm_anon.c,v 1.59 2024/11/26 10:10:28 mpi Exp $ */ /* $NetBSD: uvm_anon.c,v 1.10 2000/11/25 06:27:59 chs Exp $ */ /* @@ -170,20 +170,17 @@ uvm_anon_pagein(struct vm_amap *amap, struct vm_anon *anon) rv = uvmfault_anonget(NULL, amap, anon); switch (rv) { - case VM_PAGER_OK: + case 0: + /* Success - we have the page. */ KASSERT(rw_write_held(anon->an_lock)); break; - - case VM_PAGER_ERROR: - case VM_PAGER_REFAULT: - + case EACCES: + case ERESTART: /* - * Nothing more to do on errors. - * VM_PAGER_REFAULT means that the anon was freed. + * Nothing more to do on errors. ERESTART means that the + * anon was freed. */ - return FALSE; - default: #ifdef DIAGNOSTIC panic("anon_pagein: uvmfault_anonget -> %d", rv); diff --git a/sys/uvm/uvm_fault.c b/sys/uvm/uvm_fault.c index a36c235dff1..4b8bc6ebb66 100644 --- a/sys/uvm/uvm_fault.c +++ b/sys/uvm/uvm_fault.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_fault.c,v 1.144 2024/11/25 13:46:55 mpi Exp $ */ +/* $OpenBSD: uvm_fault.c,v 1.145 2024/11/26 10:10:28 mpi Exp $ */ /* $NetBSD: uvm_fault.c,v 1.51 2000/08/06 00:22:53 thorpej Exp $ */ /* @@ -315,7 +315,7 @@ uvmfault_anonget(struct uvm_faultinfo *ufi, struct vm_amap *amap, * try again. */ if ((pg->pg_flags & (PG_BUSY|PG_RELEASED)) == 0) - return (VM_PAGER_OK); + return 0; atomic_setbits_int(&pg->pg_flags, PG_WANTED); counters_inc(uvmexp_counters, flt_pgwait); @@ -404,7 +404,7 @@ uvmfault_anonget(struct uvm_faultinfo *ufi, struct vm_amap *amap, uvmfault_unlockall(ufi, NULL, NULL); uvm_anon_release(anon); /* frees page for us */ counters_inc(uvmexp_counters, flt_pgrele); - return (VM_PAGER_REFAULT); /* refault! */ + return ERESTART; /* refault! */ } if (error != VM_PAGER_OK) { @@ -435,7 +435,12 @@ uvmfault_anonget(struct uvm_faultinfo *ufi, struct vm_amap *amap, uvmfault_unlockall(ufi, NULL, NULL); } rw_exit(anon->an_lock); - return (VM_PAGER_ERROR); + /* + * An error occurred while trying to bring + * in the page -- this is the only error we + * return right now. + */ + return EACCES; /* XXX */ } /* @@ -457,7 +462,7 @@ uvmfault_anonget(struct uvm_faultinfo *ufi, struct vm_amap *amap, if (we_own) { rw_exit(anon->an_lock); } - return (VM_PAGER_REFAULT); + return ERESTART; } /* @@ -468,7 +473,7 @@ uvmfault_anonget(struct uvm_faultinfo *ufi, struct vm_amap *amap, ufi->orig_rvaddr - ufi->entry->start) != anon) { uvmfault_unlockall(ufi, amap, NULL); - return (VM_PAGER_REFAULT); + return ERESTART; } /* @@ -942,25 +947,14 @@ uvm_fault_upper(struct uvm_faultinfo *ufi, struct uvm_faultctx *flt, */ error = uvmfault_anonget(ufi, amap, anon); switch (error) { - case VM_PAGER_OK: + case 0: break; - case VM_PAGER_REFAULT: + case ERESTART: return ERESTART; - case VM_PAGER_ERROR: - /* - * An error occurred while trying to bring in the - * page -- this is the only error we return right - * now. - */ - return EACCES; /* XXX */ default: -#ifdef DIAGNOSTIC - panic("uvm_fault: uvmfault_anonget -> %d", error); -#else - return EACCES; -#endif + return error; } KASSERT(rw_write_held(amap->am_lock)); |