Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm ubc_release: use voff_t for offsets, rather than int...



details:   https://anonhg.NetBSD.org/src/rev/5d2f2b15e183
branches:  trunk
changeset: 765096:5d2f2b15e183
user:      rmind <rmind%NetBSD.org@localhost>
date:      Thu May 19 03:44:19 2011 +0000

description:
ubc_release: use voff_t for offsets, rather than int.  Constify.
Reviewed by matt@.

diffstat:

 sys/uvm/uvm_bio.c |  25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diffs (69 lines):

diff -r 8c68918a084f -r 5d2f2b15e183 sys/uvm/uvm_bio.c
--- a/sys/uvm/uvm_bio.c Thu May 19 03:26:06 2011 +0000
+++ b/sys/uvm/uvm_bio.c Thu May 19 03:44:19 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_bio.c,v 1.71 2010/11/30 10:55:25 hannken Exp $     */
+/*     $NetBSD: uvm_bio.c,v 1.72 2011/05/19 03:44:19 rmind Exp $       */
 
 /*
  * Copyright (c) 1998 Chuck Silvers.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.71 2010/11/30 10:55:25 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.72 2011/05/19 03:44:19 rmind Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_ubc.h"
@@ -630,15 +630,12 @@
        KASSERT(uobj != NULL);
 
        if (umap->flags & UMAP_PAGES_LOCKED) {
-               int slot_offset = umap->writeoff;
-               int endoff = umap->writeoff + umap->writelen;
-               int zerolen = round_page(endoff) - endoff;
-               int npages = (int)(round_page(umap->writeoff + umap->writelen)
-                                  - trunc_page(umap->writeoff)) >> PAGE_SHIFT;
+               const voff_t slot_offset = umap->writeoff;
+               const voff_t endoff = umap->writeoff + umap->writelen;
+               const voff_t zerolen = round_page(endoff) - endoff;
+               const u_int npages = (round_page(endoff) -
+                   trunc_page(slot_offset)) >> PAGE_SHIFT;
                struct vm_page *pgs[npages];
-               paddr_t pa;
-               int i;
-               bool rv;
 
                KASSERT((umap->flags & UMAP_MAPPING_CACHED) == 0);
                if (zerolen) {
@@ -647,7 +644,10 @@
                umap->flags &= ~UMAP_PAGES_LOCKED;
                mutex_enter(&uobj->vmobjlock);
                mutex_enter(&uvm_pageqlock);
-               for (i = 0; i < npages; i++) {
+               for (u_int i = 0; i < npages; i++) {
+                       paddr_t pa;
+                       bool rv;
+
                        rv = pmap_extract(pmap_kernel(),
                            umapva + slot_offset + (i << PAGE_SHIFT), &pa);
                        KASSERT(rv);
@@ -707,8 +707,8 @@
 ubc_uiomove(struct uvm_object *uobj, struct uio *uio, vsize_t todo, int advice,
     int flags)
 {
+       const bool overwrite = (flags & UBC_FAULTBUSY) != 0;
        voff_t off;
-       const bool overwrite = (flags & UBC_FAULTBUSY) != 0;
        int error;
 
        KASSERT(todo <= uio->uio_resid);
@@ -745,7 +745,6 @@
        return error;
 }
 
-
 /*
  * uvm_vnp_zerorange:  set a range of bytes in a file to zero.
  */



Home | Main Index | Thread Index | Old Index