Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Clean up an internal flag usage. No functional chan...



details:   https://anonhg.NetBSD.org/src/rev/d70f94a3c65c
branches:  trunk
changeset: 751086:d70f94a3c65c
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Sun Jan 24 15:03:02 2010 +0000

description:
Clean up an internal flag usage.  No functional changes.

diffstat:

 sys/uvm/uvm_fault.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (74 lines):

diff -r 46052ec0cf62 -r d70f94a3c65c sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Sun Jan 24 14:25:57 2010 +0000
+++ b/sys/uvm/uvm_fault.c       Sun Jan 24 15:03:02 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.129 2009/12/17 01:25:10 rmind Exp $    */
+/*     $NetBSD: uvm_fault.c,v 1.130 2010/01/24 15:03:02 uebayasi Exp $ */
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.129 2009/12/17 01:25:10 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.130 2010/01/24 15:03:02 uebayasi Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -689,8 +689,8 @@
                         ~VM_PROT_WRITE : VM_PROT_ALL)
 
 /* fault_flag values passed from uvm_fault_wire to uvm_fault_internal */
-#define UVM_FAULT_WIRE 1
-#define UVM_FAULT_WIREMAX 2
+#define UVM_FAULT_WIRE         (1 << 0)
+#define UVM_FAULT_MAXPROT      (1 << 1)
 
 int
 uvm_fault_internal(struct vm_map *orig_map, vaddr_t vaddr,
@@ -724,7 +724,7 @@
        ufi.orig_map = orig_map;
        ufi.orig_rvaddr = trunc_page(vaddr);
        ufi.orig_size = PAGE_SIZE;      /* can't get any smaller than this */
-       wire_fault = (fault_flag > 0);
+       wire_fault = (fault_flag & UVM_FAULT_WIRE) != 0;
        if (wire_fault)
                narrow = true;          /* don't look for neighborhood
                                         * pages on wire */
@@ -761,7 +761,7 @@
         * check protection
         */
 
-       check_prot = fault_flag == UVM_FAULT_WIREMAX ?
+       check_prot = (fault_flag & UVM_FAULT_MAXPROT) ?
            ufi.entry->max_protection : ufi.entry->protection;
        if ((check_prot & access_type) != access_type) {
                UVMHIST_LOG(maphist,
@@ -797,7 +797,7 @@
 
        if (UVM_ET_ISNEEDSCOPY(ufi.entry)) {
                if (cow_now || (ufi.entry->object.uvm_obj == NULL)) {
-                       KASSERT(fault_flag != UVM_FAULT_WIREMAX);
+                       KASSERT((fault_flag & UVM_FAULT_MAXPROT) == 0);
                        /* need to clear */
                        UVMHIST_LOG(maphist,
                            "  need to clear needs_copy and refault",0,0,0,0);
@@ -1854,7 +1854,7 @@
 
 int
 uvm_fault_wire(struct vm_map *map, vaddr_t start, vaddr_t end,
-    vm_prot_t access_type, int wiremax)
+    vm_prot_t access_type, int maxprot)
 {
        vaddr_t va;
        int error;
@@ -1875,7 +1875,7 @@
 
        for (va = start ; va < end ; va += PAGE_SIZE) {
                error = uvm_fault_internal(map, va, access_type,
-                               wiremax ? UVM_FAULT_WIREMAX : UVM_FAULT_WIRE);
+                               (maxprot ? UVM_FAULT_MAXPROT : 0) | UVM_FAULT_WIRE);
                if (error) {
                        if (va != start) {
                                uvm_fault_unwire(map, start, va);



Home | Main Index | Thread Index | Old Index