On Wed, Jul 27, 2016 at 11:35:13AM -0400, Ted Unangst wrote:
> nothing much to change here, but the comments can be improved.
> everybody knows what /dev/null is, just call it that instead of rathole.
>
if not already committed, ok mlarkin
> Index: mem.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/amd64/mem.c,v
> retrieving revision 1.28
> diff -u -p -r1.28 mem.c
> --- mem.c 8 Sep 2015 04:28:34 -0000 1.28
> +++ mem.c 27 Jul 2016 15:33:07 -0000
> @@ -78,7 +78,6 @@ int mem_range_attr_set(struct mem_range_
> #endif
>
>
> -/*ARGSUSED*/
> int
> mmopen(dev_t dev, int flag, int mode, struct proc *p)
> {
> @@ -106,7 +105,6 @@ mmopen(dev_t dev, int flag, int mode, st
> return (0);
> }
>
> -/*ARGSUSED*/
> int
> mmclose(dev_t dev, int flag, int mode, struct proc *p)
> {
> @@ -117,7 +115,6 @@ mmclose(dev_t dev, int flag, int mode, s
> return (0);
> }
>
> -/*ARGSUSED*/
> int
> mmrw(dev_t dev, struct uio *uio, int flags)
> {
> @@ -138,13 +135,13 @@ mmrw(dev_t dev, struct uio *uio, int fla
> }
> switch (minor(dev)) {
>
> -/* minor device 0 is physical memory */
> + /* minor device 0 is physical memory */
> case 0:
> v = PMAP_DIRECT_MAP(uio->uio_offset);
> error = uiomove((caddr_t)v, uio->uio_resid, uio);
> continue;
>
> -/* minor device 1 is kernel memory */
> + /* minor device 1 is kernel memory */
> case 1:
> v = uio->uio_offset;
> c = ulmin(iov->iov_len, MAXPHYS);
> @@ -159,20 +156,20 @@ mmrw(dev_t dev, struct uio *uio, int fla
> error = uiomove((caddr_t)v, c, uio);
> continue;
>
> -/* minor device 2 is EOF/RATHOLE */
> + /* minor device 2 is /dev/null */
> case 2:
> if (uio->uio_rw == UIO_WRITE)
> uio->uio_resid = 0;
> return (0);
>
> -/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write
> */
> + /* minor device 12 is /dev/zero */
> case 12:
> if (uio->uio_rw == UIO_WRITE) {
> c = iov->iov_len;
> break;
> }
> if (zeropage == NULL)
> - zeropage = (caddr_t)
> + zeropage =
> malloc(PAGE_SIZE, M_TEMP, M_WAITOK|M_ZERO);
> c = ulmin(iov->iov_len, PAGE_SIZE);
> error = uiomove(zeropage, c, uio);
> @@ -196,14 +193,14 @@ mmmmap(dev_t dev, off_t off, int prot)
> struct proc *p = curproc; /* XXX */
>
> switch (minor(dev)) {
> -/* minor device 0 is physical memory */
> + /* minor device 0 is physical memory */
> case 0:
> if (suser(p, 0) != 0 && amd64_pa_used(off))
> return -1;
> return off;
>
> #ifdef APERTURE
> -/* minor device 4 is aperture driver */
> + /* minor device 4 is aperture driver */
> case 4:
> /* Check if a write combining mapping is requested. */
> if (off >= MEMRANGE_WC_RANGE)
> @@ -332,6 +329,4 @@ mem_range_attr_set(struct mem_range_desc
>
> return (mem_range_softc.mr_op->set(&mem_range_softc, mrd, arg));
> }
> -
> #endif /* MTRR */
> -
>