Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Dec 2008 20:51:07 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r186616 - head/sys/vm
Message-ID:  <200812302051.mBUKp7XI004796@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Tue Dec 30 20:51:07 2008
New Revision: 186616
URL: http://svn.freebsd.org/changeset/base/186616

Log:
  Style change to vm_map_lookup(): Eliminate a macro of dubious value.

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==============================================================================
--- head/sys/vm/vm_map.c	Tue Dec 30 20:39:47 2008	(r186615)
+++ head/sys/vm/vm_map.c	Tue Dec 30 20:51:07 2008	(r186616)
@@ -3122,17 +3122,14 @@ vm_map_lookup(vm_map_t *var_map,		/* IN/
 RetryLookup:;
 
 	vm_map_lock_read(map);
-#define	RETURN(why) \
-		{ \
-		vm_map_unlock_read(map); \
-		return (why); \
-		}
 
 	/*
 	 * Lookup the faulting address.
 	 */
-	if (!vm_map_lookup_entry(map, vaddr, out_entry))
-		RETURN(KERN_INVALID_ADDRESS);
+	if (!vm_map_lookup_entry(map, vaddr, out_entry)) {
+		vm_map_unlock_read(map);
+		return (KERN_INVALID_ADDRESS);
+	}
 
 	entry = *out_entry;
 
@@ -3159,13 +3156,15 @@ RetryLookup:;
 		prot = entry->protection;
 	fault_type &= (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
 	if ((fault_type & prot) != fault_type) {
-			RETURN(KERN_PROTECTION_FAILURE);
+		vm_map_unlock_read(map);
+		return (KERN_PROTECTION_FAILURE);
 	}
 	if ((entry->eflags & MAP_ENTRY_USER_WIRED) &&
 	    (entry->eflags & MAP_ENTRY_COW) &&
 	    (fault_type & VM_PROT_WRITE) &&
 	    (fault_typea & VM_PROT_OVERRIDE_WRITE) == 0) {
-		RETURN(KERN_PROTECTION_FAILURE);
+		vm_map_unlock_read(map);
+		return (KERN_PROTECTION_FAILURE);
 	}
 
 	/*
@@ -3235,8 +3234,6 @@ RetryLookup:;
 
 	*out_prot = prot;
 	return (KERN_SUCCESS);
-
-#undef	RETURN
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812302051.mBUKp7XI004796>