Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Don't use C++ try keyword as a variable name.



details:   https://anonhg.NetBSD.org/src/rev/f77c0334ed03
branches:  trunk
changeset: 332025:f77c0334ed03
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Sep 05 05:36:21 2014 +0000

description:
Don't use C++ try keyword as a variable name.

diffstat:

 sys/uvm/uvm_page.c   |  18 +++++-----
 sys/uvm/uvm_pglist.c |  80 ++++++++++++++++++++++++++--------------------------
 2 files changed, 49 insertions(+), 49 deletions(-)

diffs (295 lines):

diff -r a01fb6456029 -r f77c0334ed03 sys/uvm/uvm_page.c
--- a/sys/uvm/uvm_page.c        Fri Sep 05 05:34:57 2014 +0000
+++ b/sys/uvm/uvm_page.c        Fri Sep 05 05:36:21 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_page.c,v 1.185 2014/08/10 16:44:37 tls Exp $       */
+/*     $NetBSD: uvm_page.c,v 1.186 2014/09/05 05:36:21 matt Exp $      */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.185 2014/08/10 16:44:37 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.186 2014/09/05 05:36:21 matt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvmhist.h"
@@ -886,7 +886,7 @@
 vm_physseg_find_bsearch(struct vm_physseg *segs, int nsegs, paddr_t pframe, int *offp)
 {
        /* binary search for it */
-       u_int   start, len, try;
+       u_int   start, len, guess;
 
        /*
         * if try is too large (thus target is less than try) we reduce
@@ -902,17 +902,17 @@
         */
 
        for (start = 0, len = nsegs ; len != 0 ; len = len / 2) {
-               try = start + (len / 2);        /* try in the middle */
+               guess = start + (len / 2);      /* try in the middle */
 
                /* start past our try? */
-               if (pframe >= segs[try].start) {
+               if (pframe >= segs[guess].start) {
                        /* was try correct? */
-                       if (pframe < segs[try].end) {
+                       if (pframe < segs[guess].end) {
                                if (offp)
-                                       *offp = pframe - segs[try].start;
-                               return(try);            /* got it */
+                                       *offp = pframe - segs[guess].start;
+                               return guess;            /* got it */
                        }
-                       start = try + 1;        /* next time, start here */
+                       start = guess + 1;      /* next time, start here */
                        len--;                  /* "adjust" */
                } else {
                        /*
diff -r a01fb6456029 -r f77c0334ed03 sys/uvm/uvm_pglist.c
--- a/sys/uvm/uvm_pglist.c      Fri Sep 05 05:34:57 2014 +0000
+++ b/sys/uvm/uvm_pglist.c      Fri Sep 05 05:36:21 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_pglist.c,v 1.65 2014/05/19 05:48:14 riastradh Exp $        */
+/*     $NetBSD: uvm_pglist.c,v 1.66 2014/09/05 05:36:21 matt Exp $     */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.65 2014/05/19 05:48:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.66 2014/09/05 05:36:21 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -119,7 +119,7 @@
 uvm_pglistalloc_c_ps(struct vm_physseg *ps, int num, paddr_t low, paddr_t high,
     paddr_t alignment, paddr_t boundary, struct pglist *rlist)
 {
-       signed int try, limit, tryidx, end, idx, skip;
+       signed int candidate, limit, candidateidx, end, idx, skip;
        struct vm_page *pgs;
        int pagemask;
        bool second_pass;
@@ -147,7 +147,7 @@
         * We start our search at the just after where the last allocation
         * succeeded.
         */
-       try = roundup2(max(low, ps->avail_start + ps->start_hint), alignment);
+       candidate = roundup2(max(low, ps->avail_start + ps->start_hint), alignment);
        limit = min(high, ps->avail_end);
        pagemask = ~((boundary >> PAGE_SHIFT) - 1);
        skip = 0;
@@ -158,7 +158,7 @@
                bool ok = true;
                signed int cnt;
 
-               if (try + num > limit) {
+               if (candidate + num > limit) {
                        if (ps->start_hint == 0 || second_pass) {
                                /*
                                 * We've run past the allowable range.
@@ -171,19 +171,19 @@
                         * is were we started.
                         */
                        second_pass = true;
-                       try = roundup2(max(low, ps->avail_start), alignment);
+                       candidate = roundup2(max(low, ps->avail_start), alignment);
                        limit = min(limit, ps->avail_start + ps->start_hint);
                        skip = 0;
                        continue;
                }
                if (boundary != 0 &&
-                   ((try ^ (try + num - 1)) & pagemask) != 0) {
+                   ((candidate ^ (candidate + num - 1)) & pagemask) != 0) {
                        /*
                         * Region crosses boundary. Jump to the boundary
                         * just crossed and ensure alignment.
                         */
-                       try = (try + num - 1) & pagemask;
-                       try = roundup2(try, alignment);
+                       candidate = (candidate + num - 1) & pagemask;
+                       candidate = roundup2(candidate, alignment);
                        skip = 0;
                        continue;
                }
@@ -192,24 +192,24 @@
                 * Make sure this is a managed physical page.
                 */
 
-               if (vm_physseg_find(try, &cidx) != ps - vm_physmem)
+               if (vm_physseg_find(candidate, &cidx) != ps - vm_physmem)
                        panic("pgalloc contig: botch1");
-               if (cidx != try - ps->start)
+               if (cidx != candidate - ps->start)
                        panic("pgalloc contig: botch2");
-               if (vm_physseg_find(try + num - 1, &cidx) != ps - vm_physmem)
+               if (vm_physseg_find(candidate + num - 1, &cidx) != ps - vm_physmem)
                        panic("pgalloc contig: botch3");
-               if (cidx != try - ps->start + num - 1)
+               if (cidx != candidate - ps->start + num - 1)
                        panic("pgalloc contig: botch4");
 #endif
-               tryidx = try - ps->start;
-               end = tryidx + num;
+               candidateidx = candidate - ps->start;
+               end = candidateidx + num;
 
                /*
                 * Found a suitable starting page.  See if the range is free.
                 */
 #ifdef PGALLOC_VERBOSE
-               printf("%s: ps=%p try=%#x end=%#x skip=%#x, align=%#"PRIxPADDR,
-                   __func__, ps, tryidx, end, skip, alignment);
+               printf("%s: ps=%p candidate=%#x end=%#x skip=%#x, align=%#"PRIxPADDR,
+                   __func__, ps, candidateidx, end, skip, alignment);
 #endif
                /*
                 * We start at the end and work backwards since if we find a
@@ -219,14 +219,14 @@
                 * pages.  If this iteration fails, we may be able to skip
                 * testing most of those pages again in the next pass.
                 */
-               for (idx = end - 1; idx >= tryidx + skip; idx--) {
+               for (idx = end - 1; idx >= candidateidx + skip; idx--) {
                        if (VM_PAGE_IS_FREE(&pgs[idx]) == 0) {
                                ok = false;
                                break;
                        }
 
 #ifdef DEBUG
-                       if (idx > tryidx) {
+                       if (idx > candidateidx) {
                                idxpa = VM_PAGE_TO_PHYS(&pgs[idx]);
                                lastidxpa = VM_PAGE_TO_PHYS(&pgs[idx - 1]);
                                if ((lastidxpa + PAGE_SIZE) != idxpa) {
@@ -249,7 +249,7 @@
 
                if (ok) {
                        while (skip-- > 0) {
-                               KDASSERT(VM_PAGE_IS_FREE(&pgs[tryidx + skip]));
+                               KDASSERT(VM_PAGE_IS_FREE(&pgs[candidateidx + skip]));
                        }
 #ifdef PGALLOC_VERBOSE
                        printf(": ok\n");
@@ -258,13 +258,13 @@
                }
 
 #ifdef PGALLOC_VERBOSE
-               printf(": non-free at %#x\n", idx - tryidx);
+               printf(": non-free at %#x\n", idx - candidateidx);
 #endif
                /*
                 * count the number of pages we can advance
                 * since we know they aren't all free.
                 */
-               cnt = idx + 1 - tryidx;
+               cnt = idx + 1 - candidateidx;
                /*
                 * now round up that to the needed alignment.
                 */
@@ -274,23 +274,23 @@
                 * (might be 0 if cnt > num).
                 */
                skip = max(num - cnt, 0);
-               try += cnt;
+               candidate += cnt;
        }
 
        /*
         * we have a chunk of memory that conforms to the requested constraints.
         */
-       for (idx = tryidx, pgs += idx; idx < end; idx++, pgs++)
+       for (idx = candidateidx, pgs += idx; idx < end; idx++, pgs++)
                uvm_pglist_add(pgs, rlist);
 
        /*
         * the next time we need to search this segment, start after this
         * chunk of pages we just allocated.
         */
-       ps->start_hint = try + num - ps->avail_start;
+       ps->start_hint = candidate + num - ps->avail_start;
        KASSERTMSG(ps->start_hint <= ps->avail_end - ps->avail_start,
            "%x %u (%#x) <= %#"PRIxPADDR" - %#"PRIxPADDR" (%#"PRIxPADDR")",
-           try + num,
+           candidate + num,
            ps->start_hint, ps->start_hint, ps->avail_end, ps->avail_start,
            ps->avail_end - ps->avail_start);
 
@@ -361,7 +361,7 @@
 uvm_pglistalloc_s_ps(struct vm_physseg *ps, int num, paddr_t low, paddr_t high,
     struct pglist *rlist)
 {
-       int todo, limit, try;
+       int todo, limit, candidate;
        struct vm_page *pg;
        bool second_pass;
 #ifdef PGALLOC_VERBOSE
@@ -377,9 +377,9 @@
        low = atop(low);
        high = atop(high);
        todo = num;
-       try = max(low, ps->avail_start + ps->start_hint);
+       candidate = max(low, ps->avail_start + ps->start_hint);
        limit = min(high, ps->avail_end);
-       pg = &ps->pgs[try - ps->start];
+       pg = &ps->pgs[candidate - ps->start];
        second_pass = false;
 
        /*
@@ -389,28 +389,28 @@
                return 0;
 
 again:
-       for (;; try++, pg++) {
-               if (try >= limit) {
+       for (;; candidate++, pg++) {
+               if (candidate >= limit) {
                        if (ps->start_hint == 0 || second_pass) {
-                               try = limit - 1;
+                               candidate = limit - 1;
                                break;
                        }
                        second_pass = true;
-                       try = max(low, ps->avail_start);
+                       candidate = max(low, ps->avail_start);
                        limit = min(limit, ps->avail_start + ps->start_hint);
-                       pg = &ps->pgs[try - ps->start];
+                       pg = &ps->pgs[candidate - ps->start];
                        goto again;
                }
 #if defined(DEBUG)
                {
                        int cidx = 0;
-                       const int bank = vm_physseg_find(try, &cidx);
+                       const int bank = vm_physseg_find(candidate, &cidx);
                        KDASSERTMSG(bank == ps - vm_physmem,
                            "vm_physseg_find(%#x) (%d) != ps %zd",
-                            try, bank, ps - vm_physmem);
-                       KDASSERTMSG(cidx == try - ps->start,
+                            candidate, bank, ps - vm_physmem);
+                       KDASSERTMSG(cidx == candidate - ps->start,
                            "vm_physseg_find(%#x): %#x != off %"PRIxPADDR,
-                            try, cidx, try - ps->start);
+                            candidate, cidx, candidate - ps->start);
                }
 #endif
                if (VM_PAGE_IS_FREE(pg) == 0)
@@ -426,10 +426,10 @@
         * The next time we need to search this segment,
         * start just after the pages we just allocated.
         */
-       ps->start_hint = try + 1 - ps->avail_start;
+       ps->start_hint = candidate + 1 - ps->avail_start;
        KASSERTMSG(ps->start_hint <= ps->avail_end - ps->avail_start,
            "%#x %u (%#x) <= %#"PRIxPADDR" - %#"PRIxPADDR" (%#"PRIxPADDR")",
-           try + 1,
+           candidate + 1,
            ps->start_hint, ps->start_hint, ps->avail_end, ps->avail_start,
            ps->avail_end - ps->avail_start);
 



Home | Main Index | Thread Index | Old Index