Module Name:    src
Committed By:   yamt
Date:           Sun Aug  2 16:07:34 UTC 2009

Modified Files:
        src/sys/uvm: uvm_mremap.c

Log Message:
- don't reuse a variable for different purposes.
- KNF a bit.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/uvm/uvm_mremap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_mremap.c
diff -u src/sys/uvm/uvm_mremap.c:1.14 src/sys/uvm/uvm_mremap.c:1.15
--- src/sys/uvm/uvm_mremap.c:1.14	Sun Aug  2 16:03:47 2009
+++ src/sys/uvm/uvm_mremap.c	Sun Aug  2 16:07:34 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_mremap.c,v 1.14 2009/08/02 16:03:47 yamt Exp $	*/
+/*	$NetBSD: uvm_mremap.c,v 1.15 2009/08/02 16:07:34 yamt Exp $	*/
 
 /*-
  * Copyright (c)2006,2007,2009 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_mremap.c,v 1.14 2009/08/02 16:03:47 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_mremap.c,v 1.15 2009/08/02 16:07:34 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/mman.h>
@@ -116,6 +116,7 @@
 	vaddr_t dstva;
 	vsize_t movesize;
 	vaddr_t newva;
+	int alignshift;
 	vaddr_t align = 0;
 	int error = 0;
 	const bool fixed = (flags & MAP_FIXED) != 0;
@@ -137,25 +138,25 @@
 	}
 
 	/*
-	 * Try to see if any requested alignment can even be attemped.
+	 * Try to see if any requested alignment can even be attempted.
 	 * Make sure we can express the alignment (asking for a >= 4GB
 	 * alignment on an ILP32 architecure make no sense) and the
 	 * alignment is at least for a page sized quanitiy.  If the
 	 * request was for a fixed mapping, make sure supplied address
 	 * adheres to the request alignment.
 	 */
-	align = (flags & MAP_ALIGNMENT_MASK) >> MAP_ALIGNMENT_SHIFT;
-	if (align) {
-		if (align >= sizeof(vaddr_t) * NBBY)
-			return(EINVAL);
-		align = 1L << align;
+	alignshift = (flags & MAP_ALIGNMENT_MASK) >> MAP_ALIGNMENT_SHIFT;
+	if (alignshift != 0) {
+		if (alignshift >= sizeof(vaddr_t) * NBBY)
+			return EINVAL;
+		align = 1L << alignshift;
 		if (align < PAGE_SIZE)
-			return(EINVAL);
+			return EINVAL;
 		if (align >= vm_map_max(oldmap))
-			return(ENOMEM);
-		if (flags & MAP_FIXED) {
-			if ((*newvap & (align-1)) != 0)
-				return(EINVAL);
+			return ENOMEM;
+		if ((flags & MAP_FIXED) != 0) {
+			if ((*newvap & (align - 1)) != 0)
+				return EINVAL;
 			align = 0;
 		}
 	}

Reply via email to