diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2015-02-10 22:44:36 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2015-02-10 22:44:36 +0000 |
commit | 3bf91c62c3df54ef58426bd4c994316237fffba7 (patch) | |
tree | bb08e4f164322012ebeb120c3016c537be8d2fe9 | |
parent | cedcb61c4089e42a856b6469ce521e060becebc7 (diff) |
Convert to uiomove().
ok guenther@
-rw-r--r-- | sys/arch/alpha/alpha/mem.c | 20 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/mem.c | 14 | ||||
-rw-r--r-- | sys/arch/arm/arm/mem.c | 20 | ||||
-rw-r--r-- | sys/arch/hppa/dev/mem.c | 18 | ||||
-rw-r--r-- | sys/arch/hppa64/dev/mem.c | 18 | ||||
-rw-r--r-- | sys/arch/i386/i386/mem.c | 16 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/mem.c | 14 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/mem.c | 12 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/mem.c | 8 | ||||
-rw-r--r-- | sys/arch/sh/sh/mem.c | 20 | ||||
-rw-r--r-- | sys/arch/socppc/socppc/mem.c | 12 | ||||
-rw-r--r-- | sys/arch/solbourne/solbourne/mem.c | 21 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/mem.c | 23 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/mem.c | 16 | ||||
-rw-r--r-- | sys/arch/vax/vax/mem.c | 16 |
15 files changed, 124 insertions, 124 deletions
diff --git a/sys/arch/alpha/alpha/mem.c b/sys/arch/alpha/alpha/mem.c index fee7d80a976..37c5323bd9b 100644 --- a/sys/arch/alpha/alpha/mem.c +++ b/sys/arch/alpha/alpha/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.26 2015/02/10 21:56:08 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.27 2015/02/10 22:44:35 miod Exp $ */ /* $NetBSD: mem.c,v 1.26 2000/03/29 03:48:20 simonb Exp $ */ /* @@ -124,9 +124,9 @@ mmrw(dev, uio, flags) struct uio *uio; int flags; { - register vaddr_t o, v; - register int c; - register struct iovec *iov; + vaddr_t o, v; + size_t c; + struct iovec *iov; int error = 0, rw; extern int msgbufmapped; @@ -161,9 +161,9 @@ kmemphys: } o = uio->uio_offset & PGOFSET; - c = min(uio->uio_resid, (int)(PAGE_SIZE - o)); + c = ulmin(uio->uio_resid, PAGE_SIZE - o); error = - uiomovei((caddr_t)ALPHA_PHYS_TO_K0SEG(v), c, uio); + uiomove((caddr_t)ALPHA_PHYS_TO_K0SEG(v), c, uio); break; /* minor device 1 is kernel memory */ @@ -175,11 +175,11 @@ kmemphys: goto kmemphys; } - c = min(iov->iov_len, MAXPHYS); + c = ulmin(iov->iov_len, MAXPHYS); if (!uvm_kernacc((caddr_t)v, c, uio->uio_rw == UIO_READ ? B_READ : B_WRITE)) return (EFAULT); - error = uiomovei((caddr_t)v, c, uio); + error = uiomove((caddr_t)v, c, uio); break; /* minor device 2 is EOF/rathole */ @@ -201,8 +201,8 @@ kmemphys: if (zeropage == NULL) zeropage = malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); - c = min(iov->iov_len, PAGE_SIZE); - error = uiomovei(zeropage, c, uio); + c = ulmin(iov->iov_len, PAGE_SIZE); + error = uiomove(zeropage, c, uio); break; default: diff --git a/sys/arch/amd64/amd64/mem.c b/sys/arch/amd64/amd64/mem.c index 12169e65a87..9836cfc3554 100644 --- a/sys/arch/amd64/amd64/mem.c +++ b/sys/arch/amd64/amd64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.21 2015/02/10 21:56:08 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.22 2015/02/10 22:44:35 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 @@ -123,7 +123,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) { extern vaddr_t kern_end; vaddr_t v; - int c; + size_t c; struct iovec *iov; int error = 0; @@ -141,13 +141,13 @@ mmrw(dev_t dev, struct uio *uio, int flags) /* minor device 0 is physical memory */ case 0: v = PMAP_DIRECT_MAP(uio->uio_offset); - error = uiomovei((caddr_t)v, uio->uio_resid, uio); + error = uiomove((caddr_t)v, uio->uio_resid, uio); continue; /* minor device 1 is kernel memory */ case 1: v = uio->uio_offset; - c = min(iov->iov_len, MAXPHYS); + c = ulmin(iov->iov_len, MAXPHYS); if (v >= (vaddr_t)&start && v < kern_end) { if (v < (vaddr_t)&etext && uio->uio_rw == UIO_WRITE) @@ -156,7 +156,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) uio->uio_rw == UIO_READ ? B_READ : B_WRITE)) && (v < PMAP_DIRECT_BASE && v > PMAP_DIRECT_END)) return (EFAULT); - error = uiomovei((caddr_t)v, c, uio); + error = uiomove((caddr_t)v, c, uio); continue; /* minor device 2 is EOF/RATHOLE */ @@ -174,8 +174,8 @@ mmrw(dev_t dev, struct uio *uio, int flags) if (zeropage == NULL) zeropage = (caddr_t) malloc(PAGE_SIZE, M_TEMP, M_WAITOK|M_ZERO); - c = min(iov->iov_len, PAGE_SIZE); - error = uiomovei(zeropage, c, uio); + c = ulmin(iov->iov_len, PAGE_SIZE); + error = uiomove(zeropage, c, uio); continue; default: diff --git a/sys/arch/arm/arm/mem.c b/sys/arch/arm/arm/mem.c index 4b2d73aba7a..8096f44a9e7 100644 --- a/sys/arch/arm/arm/mem.c +++ b/sys/arch/arm/arm/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.12 2015/02/10 21:56:08 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.13 2015/02/10 22:44:35 miod Exp $ */ /* $NetBSD: mem.c,v 1.11 2003/10/16 12:02:58 jdolecek Exp $ */ /* @@ -153,9 +153,9 @@ mmrw(dev, uio, flags) struct uio *uio; int flags; { - register vaddr_t o, v; - register int c; - register struct iovec *iov; + vaddr_t o, v; + size_t c; + struct iovec *iov; int error = 0; vm_prot_t prot; @@ -189,8 +189,8 @@ mmrw(dev, uio, flags) trunc_page(v), prot, prot|PMAP_WIRED); pmap_update(pmap_kernel()); o = uio->uio_offset & PGOFSET; - c = min(uio->uio_resid, (int)(PAGE_SIZE - o)); - error = uiomovei((caddr_t)memhook + o, c, uio); + c = ulmin(uio->uio_resid, PAGE_SIZE - o); + error = uiomove((caddr_t)memhook + o, c, uio); pmap_remove(pmap_kernel(), (vaddr_t)memhook, (vaddr_t)memhook + PAGE_SIZE); pmap_update(pmap_kernel()); @@ -198,11 +198,11 @@ mmrw(dev, uio, flags) case DEV_KMEM: v = uio->uio_offset; - c = min(iov->iov_len, MAXPHYS); + c = ulmin(iov->iov_len, MAXPHYS); if (!uvm_kernacc((caddr_t)v, c, uio->uio_rw == UIO_READ ? B_READ : B_WRITE)) return (EFAULT); - error = uiomovei((caddr_t)v, c, uio); + error = uiomove((caddr_t)v, c, uio); break; case DEV_NULL: @@ -218,8 +218,8 @@ mmrw(dev, uio, flags) if (zeropage == NULL) zeropage = malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); - c = min(iov->iov_len, PAGE_SIZE); - error = uiomovei(zeropage, c, uio); + c = ulmin(iov->iov_len, PAGE_SIZE); + error = uiomove(zeropage, c, uio); break; default: diff --git a/sys/arch/hppa/dev/mem.c b/sys/arch/hppa/dev/mem.c index fb15c42ea2f..b8c11d1a998 100644 --- a/sys/arch/hppa/dev/mem.c +++ b/sys/arch/hppa/dev/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.35 2015/02/10 21:56:09 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.36 2015/02/10 22:44:35 miod Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -332,10 +332,10 @@ mmrw(dev, uio, flags) struct uio *uio; int flags; { - struct iovec *iov; + struct iovec *iov; vaddr_t v, o; int error = 0; - u_int c; + size_t c; while (uio->uio_resid > 0 && error == 0) { iov = uio->uio_iov; @@ -358,21 +358,21 @@ mmrw(dev, uio, flags) continue; } c = ptoa(physmem) - v; - c = min(c, uio->uio_resid); - error = uiomovei((caddr_t)v, c, uio); + c = ulmin(c, uio->uio_resid); + error = uiomove((caddr_t)v, c, uio); break; case 1: /* /dev/kmem */ v = uio->uio_offset; o = v & PGOFSET; - c = min(uio->uio_resid, (int)(PAGE_SIZE - o)); + c = ulmin(uio->uio_resid, PAGE_SIZE - o); if (atop(v) > physmem && !uvm_kernacc((caddr_t)v, c, (uio->uio_rw == UIO_READ) ? B_READ : B_WRITE)) { error = EFAULT; /* this will break us out of the loop */ continue; } - error = uiomovei((caddr_t)v, c, uio); + error = uiomove((caddr_t)v, c, uio); break; case 2: /* /dev/null */ @@ -393,8 +393,8 @@ mmrw(dev, uio, flags) if (zeropage == NULL) zeropage = malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); - c = min(iov->iov_len, PAGE_SIZE); - error = uiomovei(zeropage, c, uio); + c = ulmin(iov->iov_len, PAGE_SIZE); + error = uiomove(zeropage, c, uio); break; default: diff --git a/sys/arch/hppa64/dev/mem.c b/sys/arch/hppa64/dev/mem.c index 03a9d300537..e35030a6e12 100644 --- a/sys/arch/hppa64/dev/mem.c +++ b/sys/arch/hppa64/dev/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.8 2015/02/10 21:56:09 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.9 2015/02/10 22:44:35 miod Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -166,10 +166,10 @@ mmrw(dev, uio, flags) struct uio *uio; int flags; { - struct iovec *iov; + struct iovec *iov; vaddr_t v, o; int error = 0; - u_int c; + size_t c; while (uio->uio_resid > 0 && error == 0) { iov = uio->uio_iov; @@ -192,21 +192,21 @@ mmrw(dev, uio, flags) continue; } c = ptoa(physmem) - v; - c = min(c, uio->uio_resid); - error = uiomovei((caddr_t)v, c, uio); + c = ulmin(c, uio->uio_resid); + error = uiomove((caddr_t)v, c, uio); break; case 1: /* /dev/kmem */ v = uio->uio_offset; o = v & PAGE_MASK; - c = min(uio->uio_resid, (int)(PAGE_SIZE - o)); + c = ulmin(uio->uio_resid, (int)(PAGE_SIZE - o)); if (atop(v) > physmem && !uvm_kernacc((caddr_t)v, c, (uio->uio_rw == UIO_READ) ? B_READ : B_WRITE)) { error = EFAULT; /* this will break us out of the loop */ continue; } - error = uiomovei((caddr_t)v, c, uio); + error = uiomove((caddr_t)v, c, uio); break; case 2: /* /dev/null */ @@ -227,8 +227,8 @@ mmrw(dev, uio, flags) if (zeropage == NULL) zeropage = malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); - c = min(iov->iov_len, PAGE_SIZE); - error = uiomovei(zeropage, c, uio); + c = ulmin(iov->iov_len, PAGE_SIZE); + error = uiomove(zeropage, c, uio); break; default: diff --git a/sys/arch/i386/i386/mem.c b/sys/arch/i386/i386/mem.c index d56003743c0..1e0203ca058 100644 --- a/sys/arch/i386/i386/mem.c +++ b/sys/arch/i386/i386/mem.c @@ -1,5 +1,5 @@ /* $NetBSD: mem.c,v 1.31 1996/05/03 19:42:19 christos Exp $ */ -/* $OpenBSD: mem.c,v 1.42 2015/02/10 21:56:09 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.43 2015/02/10 22:44:35 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 @@ -115,7 +115,7 @@ int mmrw(dev_t dev, struct uio *uio, int flags) { vaddr_t o, v; - int c; + size_t c; struct iovec *iov; int error = 0; static int physlock; @@ -150,8 +150,8 @@ mmrw(dev_t dev, struct uio *uio, int flags) PROT_READ : PROT_WRITE, PMAP_WIRED); pmap_update(pmap_kernel()); o = uio->uio_offset & PGOFSET; - c = min(uio->uio_resid, (int)(NBPG - o)); - error = uiomovei((caddr_t)vmmap + o, c, uio); + c = ulmin(uio->uio_resid, NBPG - o); + error = uiomove((caddr_t)vmmap + o, c, uio); pmap_remove(pmap_kernel(), (vaddr_t)vmmap, (vaddr_t)vmmap + NBPG); pmap_update(pmap_kernel()); @@ -160,11 +160,11 @@ mmrw(dev_t dev, struct uio *uio, int flags) /* minor device 1 is kernel memory */ case 1: v = uio->uio_offset; - c = min(iov->iov_len, MAXPHYS); + c = ulmin(iov->iov_len, MAXPHYS); if (!uvm_kernacc((caddr_t)v, c, uio->uio_rw == UIO_READ ? B_READ : B_WRITE)) return (EFAULT); - error = uiomovei((caddr_t)v, c, uio); + error = uiomove((caddr_t)v, c, uio); continue; /* minor device 2 is EOF/RATHOLE */ @@ -183,8 +183,8 @@ mmrw(dev_t dev, struct uio *uio, int flags) zeropage = malloc(PAGE_SIZE, M_TEMP, M_WAITOK|M_ZERO); } - c = min(iov->iov_len, PAGE_SIZE); - error = uiomovei(zeropage, c, uio); + c = ulmin(iov->iov_len, PAGE_SIZE); + error = uiomove(zeropage, c, uio); continue; default: diff --git a/sys/arch/m88k/m88k/mem.c b/sys/arch/m88k/m88k/mem.c index 10f608b0c8d..1fd9d35d9fe 100644 --- a/sys/arch/m88k/m88k/mem.c +++ b/sys/arch/m88k/m88k/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.2 2015/02/10 21:56:09 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.3 2015/02/10 22:44:35 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -93,7 +93,7 @@ mmrw(dev, uio, flags) int flags; { vaddr_t v; - int c; + size_t c; struct iovec *iov; int error = 0; @@ -111,13 +111,13 @@ mmrw(dev, uio, flags) /* minor device 0 is physical memory */ case 0: v = uio->uio_offset; - error = uiomovei((caddr_t)v, uio->uio_resid, uio); + error = uiomove((caddr_t)v, uio->uio_resid, uio); continue; /* minor device 1 is kernel memory */ case 1: v = uio->uio_offset; - c = min(iov->iov_len, MAXPHYS); + c = ulmin(iov->iov_len, MAXPHYS); if (v >= (vaddr_t)&kernelstart && v < (vaddr_t)first_addr) { if (v < (vaddr_t)etext && @@ -126,7 +126,7 @@ mmrw(dev, uio, flags) } else if (!uvm_kernacc((caddr_t)v, c, uio->uio_rw == UIO_READ ? B_READ : B_WRITE)) return (EFAULT); - error = uiomovei((caddr_t)v, c, uio); + error = uiomove((caddr_t)v, c, uio); continue; /* minor device 2 is EOF/RATHOLE */ @@ -144,8 +144,8 @@ mmrw(dev, uio, flags) if (zpage == NULL) zpage = malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); - c = min(iov->iov_len, PAGE_SIZE); - error = uiomovei(zpage, c, uio); + c = ulmin(iov->iov_len, PAGE_SIZE); + error = uiomove(zpage, c, uio); continue; default: diff --git a/sys/arch/macppc/macppc/mem.c b/sys/arch/macppc/macppc/mem.c index 9edbb3982a9..66af75e8f8c 100644 --- a/sys/arch/macppc/macppc/mem.c +++ b/sys/arch/macppc/macppc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.19 2015/02/10 21:56:09 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.20 2015/02/10 22:44:35 miod Exp $ */ /* $NetBSD: mem.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -254,14 +254,14 @@ mmrw(dev_t dev, struct uio *uio, int flags) c = uio->uio_resid; /* This doesn't allow device mapping! XXX */ pmap_real_memory(&v, &c); - error = uiomovei((caddr_t)v, c, uio); + error = uiomove((caddr_t)v, c, uio); continue; /* minor device 1 is kernel memory */ case 1: v = uio->uio_offset; - c = min(iov->iov_len, MAXPHYS); - error = uiomovei((caddr_t)v, c, uio); + c = ulmin(iov->iov_len, MAXPHYS); + error = uiomove((caddr_t)v, c, uio); continue; /* minor device 2 is EOF/RATHOLE */ @@ -281,8 +281,8 @@ mmrw(dev_t dev, struct uio *uio, int flags) if (zeropage == NULL) zeropage = malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); - c = min(iov->iov_len, PAGE_SIZE); - error = uiomovei(zeropage, c, uio); + c = ulmin(iov->iov_len, PAGE_SIZE); + error = uiomove(zeropage, c, uio); continue; default: diff --git a/sys/arch/mips64/mips64/mem.c b/sys/arch/mips64/mips64/mem.c index d342d43ad6b..4b3eb69d383 100644 --- a/sys/arch/mips64/mips64/mem.c +++ b/sys/arch/mips64/mips64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.19 2015/02/10 21:56:09 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.20 2015/02/10 22:44:35 miod Exp $ */ /* $NetBSD: mem.c,v 1.6 1995/04/10 11:55:03 mycroft Exp $ */ /* @@ -119,7 +119,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) if (v + c < v || v + c > ptoa((psize_t)physmem)) return (EFAULT); v = (vaddr_t)PHYS_TO_XKPHYS(v, CCA_NONCOHERENT); - error = uiomovei((caddr_t)v, c, uio); + error = uiomove((caddr_t)v, c, uio); continue; /* minor device 1 is kernel memory */ @@ -147,7 +147,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) uio->uio_rw == UIO_READ ? B_READ : B_WRITE); if (allowed) { - error = uiomovei((caddr_t)v, c, uio); + error = uiomove((caddr_t)v, c, uio); continue; } else { return (EFAULT); @@ -169,7 +169,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) zeropage = malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); c = ulmin(iov->iov_len, PAGE_SIZE); - error = uiomovei(zeropage, c, uio); + error = uiomove(zeropage, c, uio); continue; default: diff --git a/sys/arch/sh/sh/mem.c b/sys/arch/sh/sh/mem.c index 7aa2fea8bc7..f0241e83d9a 100644 --- a/sys/arch/sh/sh/mem.c +++ b/sys/arch/sh/sh/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.5 2015/02/10 21:56:09 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.6 2015/02/10 22:44:35 miod Exp $ */ /* $NetBSD: mem.c,v 1.21 2006/07/23 22:06:07 ad Exp $ */ /* @@ -132,7 +132,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) { struct iovec *iov; vaddr_t v, o; - int c; + size_t c; int error = 0; while (uio->uio_resid > 0 && !error) { @@ -152,8 +152,8 @@ mmrw(dev_t dev, struct uio *uio, int flags) /* Physical address */ if (__mm_mem_addr(v)) { o = v & PGOFSET; - c = min(uio->uio_resid, (int)(PAGE_SIZE - o)); - error = uiomovei((caddr_t)SH3_PHYS_TO_P1SEG(v), + c = ulmin(uio->uio_resid, PAGE_SIZE - o); + error = uiomove((caddr_t)SH3_PHYS_TO_P1SEG(v), c, uio); } else { return (EFAULT); @@ -170,16 +170,16 @@ mmrw(dev_t dev, struct uio *uio, int flags) == FALSE) return (EFAULT); */ - c = min(iov->iov_len, MAXPHYS); - error = uiomovei((caddr_t)v, c, uio); + c = ulmin(iov->iov_len, MAXPHYS); + error = uiomove((caddr_t)v, c, uio); } else if (v < SH3_P3SEG_BASE) /* P2 */ return (EFAULT); else { /* P3 */ - c = min(iov->iov_len, MAXPHYS); + c = ulmin(iov->iov_len, MAXPHYS); if (!uvm_kernacc((void *)v, c, uio->uio_rw == UIO_READ ? B_READ : B_WRITE)) return (EFAULT); - error = uiomovei((caddr_t)v, c, uio); + error = uiomove((caddr_t)v, c, uio); } break; @@ -196,8 +196,8 @@ mmrw(dev_t dev, struct uio *uio, int flags) if (zeropage == NULL) zeropage = malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); - c = min(iov->iov_len, PAGE_SIZE); - error = uiomovei(zeropage, c, uio); + c = ulmin(iov->iov_len, PAGE_SIZE); + error = uiomove(zeropage, c, uio); break; default: diff --git a/sys/arch/socppc/socppc/mem.c b/sys/arch/socppc/socppc/mem.c index f82a8f55cae..f2d56687873 100644 --- a/sys/arch/socppc/socppc/mem.c +++ b/sys/arch/socppc/socppc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.3 2015/02/10 21:56:09 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.4 2015/02/10 22:44:35 miod Exp $ */ /* $NetBSD: mem.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -121,14 +121,14 @@ mmrw(dev_t dev, struct uio *uio, int flags) c = uio->uio_resid; /* This doesn't allow device mapping! XXX */ pmap_real_memory(&v, &c); - error = uiomovei((caddr_t)v, c, uio); + error = uiomove((caddr_t)v, c, uio); continue; /* minor device 1 is kernel memory */ case 1: v = uio->uio_offset; - c = min(iov->iov_len, MAXPHYS); - error = uiomovei((caddr_t)v, c, uio); + c = ulmin(iov->iov_len, MAXPHYS); + error = uiomove((caddr_t)v, c, uio); continue; /* minor device 2 is EOF/RATHOLE */ @@ -148,8 +148,8 @@ mmrw(dev_t dev, struct uio *uio, int flags) if (zeropage == NULL) zeropage = malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); - c = min(iov->iov_len, PAGE_SIZE); - error = uiomovei(zeropage, c, uio); + c = ulmin(iov->iov_len, PAGE_SIZE); + error = uiomove(zeropage, c, uio); continue; default: diff --git a/sys/arch/solbourne/solbourne/mem.c b/sys/arch/solbourne/solbourne/mem.c index ebf518a5463..22e06376d92 100644 --- a/sys/arch/solbourne/solbourne/mem.c +++ b/sys/arch/solbourne/solbourne/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.4 2015/02/10 21:56:09 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.5 2015/02/10 22:44:35 miod Exp $ */ /* OpenBSD: mem.c,v 1.21 2003/06/02 23:27:55 millert Exp */ /* @@ -97,10 +97,9 @@ mmrw(dev, uio, flags) struct uio *uio; int flags; { - int o; paddr_t pa; vaddr_t va; - int c; + size_t c, o; struct iovec *iov; int error = 0; static int physlock; @@ -143,8 +142,8 @@ mmrw(dev, uio, flags) PROT_READ : PROT_WRITE, PMAP_WIRED); pmap_update(pmap_kernel()); o = uio->uio_offset & PGOFSET; - c = min(uio->uio_resid, (int)(NBPG - o)); - error = uiomovei((caddr_t)mem_page + o, c, uio); + c = ulmin(uio->uio_resid, NBPG - o); + error = uiomove((caddr_t)mem_page + o, c, uio); pmap_remove(pmap_kernel(), mem_page, mem_page + NBPG); pmap_update(pmap_kernel()); continue; @@ -153,20 +152,20 @@ mmrw(dev, uio, flags) case 1: va = (vaddr_t)uio->uio_offset; if (va >= MSGBUF_VA && va < MSGBUF_VA+MSGBUFSIZE) { - c = min(iov->iov_len, MSGBUFSIZE); + c = ulmin(iov->iov_len, MSGBUFSIZE); #if 0 } else if (va >= prom_vstart && va < prom_vend && uio->uio_rw == UIO_READ) { /* Allow read-only access to the PROM */ - c = min(iov->iov_len, prom_vend - prom_vstart); + c = ulmin(iov->iov_len, prom_vend - prom_vstart); #endif } else { - c = min(iov->iov_len, MAXPHYS); + c = ulmin(iov->iov_len, MAXPHYS); if (!uvm_kernacc((caddr_t)va, c, uio->uio_rw == UIO_READ ? B_READ : B_WRITE)) return (EFAULT); } - error = uiomovei((caddr_t)va, c, uio); + error = uiomove((caddr_t)va, c, uio); continue; /* minor device 2 is EOF/RATHOLE */ @@ -186,8 +185,8 @@ mmrw(dev, uio, flags) if (zeropage == NULL) zeropage = malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); - c = min(iov->iov_len, PAGE_SIZE); - error = uiomovei(zeropage, c, uio); + c = ulmin(iov->iov_len, PAGE_SIZE); + error = uiomove(zeropage, c, uio); continue; default: diff --git a/sys/arch/sparc/sparc/mem.c b/sys/arch/sparc/sparc/mem.c index 2a11bfa3ac9..ef85ed0eae0 100644 --- a/sys/arch/sparc/sparc/mem.c +++ b/sys/arch/sparc/sparc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.24 2015/02/10 21:56:09 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.25 2015/02/10 22:44:35 miod Exp $ */ /* $NetBSD: mem.c,v 1.13 1996/03/30 21:12:16 christos Exp $ */ /* @@ -98,10 +98,10 @@ mmrw(dev, uio, flags) struct uio *uio; int flags; { - int o; + off_t o; paddr_t pa; vaddr_t va; - int c; + size_t c; struct iovec *iov; int error = 0; static int physlock; @@ -144,8 +144,8 @@ mmrw(dev, uio, flags) PROT_READ : PROT_WRITE, PMAP_WIRED); pmap_update(pmap_kernel()); o = uio->uio_offset & PGOFSET; - c = min(uio->uio_resid, (int)(NBPG - o)); - error = uiomovei((caddr_t)mem_page + o, c, uio); + c = ulmin(uio->uio_resid, NBPG - o); + error = uiomove((caddr_t)mem_page + o, c, uio); pmap_remove(pmap_kernel(), mem_page, mem_page + NBPG); pmap_update(pmap_kernel()); continue; @@ -154,18 +154,19 @@ mmrw(dev, uio, flags) case 1: va = (vaddr_t)uio->uio_offset; if (va >= MSGBUF_VA && va < MSGBUF_VA+NBPG) { - c = min(iov->iov_len, 4096); + c = ulmin(iov->iov_len, 4096); } else if (va >= prom_vstart && va < prom_vend && uio->uio_rw == UIO_READ) { /* Allow read-only access to the PROM */ - c = min(iov->iov_len, prom_vend - prom_vstart); + c = ulmin(iov->iov_len, + prom_vend - prom_vstart); } else { - c = min(iov->iov_len, MAXPHYS); + c = ulmin(iov->iov_len, MAXPHYS); if (!uvm_kernacc((caddr_t)va, c, uio->uio_rw == UIO_READ ? B_READ : B_WRITE)) return (EFAULT); } - error = uiomovei((caddr_t)va, c, uio); + error = uiomove((caddr_t)va, c, uio); continue; /* minor device 2 is EOF/RATHOLE */ @@ -196,8 +197,8 @@ mmrw(dev, uio, flags) if (zeropage == NULL) zeropage = malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); - c = min(iov->iov_len, PAGE_SIZE); - error = uiomovei(zeropage, c, uio); + c = ulmin(iov->iov_len, PAGE_SIZE); + error = uiomove(zeropage, c, uio); continue; default: diff --git a/sys/arch/sparc64/sparc64/mem.c b/sys/arch/sparc64/sparc64/mem.c index 2871361a7b7..c3c66b598dd 100644 --- a/sys/arch/sparc64/sparc64/mem.c +++ b/sys/arch/sparc64/sparc64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.13 2015/02/10 21:56:09 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.14 2015/02/10 22:44:35 miod Exp $ */ /* $NetBSD: mem.c,v 1.18 2001/04/24 04:31:12 thorpej Exp $ */ /* @@ -88,7 +88,7 @@ mmrw(dev, uio, flags) int flags; { vaddr_t o, v; - int c; + size_t c; struct iovec *iov; int error = 0; static int physlock; @@ -135,8 +135,8 @@ mmrw(dev, uio, flags) trunc_page(v), prot, prot|PMAP_WIRED); pmap_update(pmap_kernel()); o = uio->uio_offset & PGOFSET; - c = min(uio->uio_resid, (int)(NBPG - o)); - error = uiomovei((caddr_t)vmmap + o, c, uio); + c = ulmin(uio->uio_resid, NBPG - o); + error = uiomove((caddr_t)vmmap + o, c, uio); pmap_remove(pmap_kernel(), (vaddr_t)vmmap, (vaddr_t)vmmap + NBPG); pmap_update(pmap_kernel()); @@ -145,11 +145,11 @@ mmrw(dev, uio, flags) /* minor device 1 is kernel memory */ case 1: v = uio->uio_offset; - c = min(iov->iov_len, MAXPHYS); + c = ulmin(iov->iov_len, MAXPHYS); if (!uvm_kernacc((caddr_t)v, c, uio->uio_rw == UIO_READ ? B_READ : B_WRITE)) return (EFAULT); - error = uiomovei((caddr_t)v, c, uio); + error = uiomove((caddr_t)v, c, uio); break; /* minor device 2 is EOF/RATHOLE */ @@ -172,8 +172,8 @@ mmrw(dev, uio, flags) if (zeropage == NULL) zeropage = malloc(NBPG, M_TEMP, M_WAITOK | M_ZERO); - c = min(iov->iov_len, NBPG); - error = uiomovei(zeropage, c, uio); + c = ulmin(iov->iov_len, NBPG); + error = uiomove(zeropage, c, uio); break; default: diff --git a/sys/arch/vax/vax/mem.c b/sys/arch/vax/vax/mem.c index b371904e181..431ce2649bd 100644 --- a/sys/arch/vax/vax/mem.c +++ b/sys/arch/vax/vax/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.17 2015/02/10 21:56:09 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.18 2015/02/10 22:44:35 miod Exp $ */ /* $NetBSD: mem.c,v 1.15 1999/03/24 05:51:17 mrg Exp $ */ /* @@ -98,7 +98,7 @@ mmrw(dev, uio, flags) int flags; { vaddr_t v; - int c; + size_t c; struct iovec *iov; int error = 0; @@ -120,17 +120,17 @@ mmrw(dev, uio, flags) return (EFAULT); } - c = min(iov->iov_len, MAXPHYS); - error = uiomovei((caddr_t)v + KERNBASE, c, uio); + c = ulmin(iov->iov_len, MAXPHYS); + error = uiomove((caddr_t)v + KERNBASE, c, uio); continue; /* minor device 1 is kernel memory */ case 1: v = uio->uio_offset; - c = min(iov->iov_len, MAXPHYS); + c = ulmin(iov->iov_len, MAXPHYS); if (!uvm_kernacc((caddr_t)v, c, uio->uio_rw == UIO_READ ? B_READ : B_WRITE)) return (EFAULT); - error = uiomovei((caddr_t)v, c, uio); + error = uiomove((caddr_t)v, c, uio); continue; /* minor device 2 is EOF/RATHOLE */ @@ -148,8 +148,8 @@ mmrw(dev, uio, flags) if (zeropage == NULL) zeropage = malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); - c = min(iov->iov_len, PAGE_SIZE); - error = uiomovei(zeropage, c, uio); + c = ulmin(iov->iov_len, PAGE_SIZE); + error = uiomove(zeropage, c, uio); continue; default: |