Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc/booke copyoutstr(9): sync style with copyin...



details:   https://anonhg.NetBSD.org/src/rev/b409aa957d75
branches:  trunk
changeset: 745538:b409aa957d75
user:      rin <rin%NetBSD.org@localhost>
date:      Thu Mar 05 00:33:56 2020 +0000

description:
copyoutstr(9): sync style with copyinstr(9).

- use variable name "done" instead of "lenp"
- return return value from setfault() on fault, instead of hardcoded EFAULT

No functional changes intended.

diffstat:

 sys/arch/powerpc/booke/copyout.c |  24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diffs (61 lines):

diff -r 212ae22d48e3 -r b409aa957d75 sys/arch/powerpc/booke/copyout.c
--- a/sys/arch/powerpc/booke/copyout.c  Wed Mar 04 22:56:08 2020 +0000
+++ b/sys/arch/powerpc/booke/copyout.c  Thu Mar 05 00:33:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: copyout.c,v 1.6 2020/03/04 13:01:52 rin Exp $  */
+/*     $NetBSD: copyout.c,v 1.7 2020/03/05 00:33:56 rin Exp $  */
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: copyout.c,v 1.6 2020/03/04 13:01:52 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyout.c,v 1.7 2020/03/05 00:33:56 rin Exp $");
 
 #define        __UFETCHSTORE_PRIVATE
 
@@ -402,22 +402,24 @@
 
 #if 1
 int
-copyoutstr(const void *ksaddr, void *udaddr, size_t len, size_t *lenp)
+copyoutstr(const void *ksaddr, void *udaddr, size_t len, size_t *done)
 {
        struct pcb * const pcb = lwp_getpcb(curlwp);
        struct faultbuf env;
+       int rv;
 
        if (__predict_false(len == 0)) {
-               if (lenp)
-                       *lenp = 0;
+               if (done)
+                       *done = 0;
                return 0;
        }
 
-       if (setfault(&env)) {
+       rv = setfault(&env);
+       if (rv != 0) {
                pcb->pcb_onfault = NULL;
-               if (lenp)
-                       *lenp = 0;
-               return EFAULT;
+               if (done)
+                       *done = 0;
+               return rv;
        }
 
        const register_t ds_msr = mfmsr() | PSL_DS;
@@ -434,8 +436,8 @@
        }
 
        pcb->pcb_onfault = NULL;
-       if (lenp)
-               *lenp = copylen;
+       if (done)
+               *done = copylen;
        return 0;
 }
 #else



Home | Main Index | Thread Index | Old Index