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 bother returning the "slot" number from amap_a...



details:   https://anonhg.NetBSD.org/src/rev/d24c1bc40d68
branches:  trunk
changeset: 474458:d24c1bc40d68
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Jul 07 05:31:40 1999 +0000

description:
Don't bother returning the "slot" number from amap_add():
* Nothing currently uses this return value.
* It's arguably an abstraction violation.

Fix amap_unadd()'s API to be consistent w/ amap_add()'s: rather than
take a vm_amap * and a slot number, take a vm_aref * and an offset.

It's now actually possible to use amap_unadd() to remove an anon from
an amap.

diffstat:

 sys/uvm/uvm_amap.h   |   6 +++---
 sys/uvm/uvm_amap_i.h |  22 ++++++++++++----------
 2 files changed, 15 insertions(+), 13 deletions(-)

diffs (81 lines):

diff -r b88e7e391517 -r d24c1bc40d68 sys/uvm/uvm_amap.h
--- a/sys/uvm/uvm_amap.h        Wed Jul 07 01:55:07 1999 +0000
+++ b/sys/uvm/uvm_amap.h        Wed Jul 07 05:31:40 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_amap.h,v 1.11 1999/06/21 17:25:11 thorpej Exp $    */
+/*     $NetBSD: uvm_amap.h,v 1.12 1999/07/07 05:31:40 thorpej Exp $    */
 
 /*
  *
@@ -81,7 +81,7 @@
  */
 
 AMAP_INLINE
-vaddr_t                amap_add        /* add an anon to an amap */
+void           amap_add        /* add an anon to an amap */
                        __P((struct vm_aref *, vaddr_t,
                             struct vm_anon *, int));
 struct vm_amap *amap_alloc     /* allocate a new amap */
@@ -120,7 +120,7 @@
                             vaddr_t));
 AMAP_INLINE
 void           amap_unadd      /* remove an anon from an amap */
-                       __P((struct vm_amap *, vaddr_t));
+                       __P((struct vm_aref *, vaddr_t));
 void           amap_unlock     /* unlock amap */
                        __P((struct vm_amap *));
 AMAP_INLINE
diff -r b88e7e391517 -r d24c1bc40d68 sys/uvm/uvm_amap_i.h
--- a/sys/uvm/uvm_amap_i.h      Wed Jul 07 01:55:07 1999 +0000
+++ b/sys/uvm/uvm_amap_i.h      Wed Jul 07 05:31:40 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_amap_i.h,v 1.12 1999/03/25 18:48:49 mrg Exp $      */
+/*     $NetBSD: uvm_amap_i.h,v 1.13 1999/07/07 05:31:40 thorpej Exp $  */
 
 /*
  *
@@ -115,7 +115,7 @@
  *     pmap_page_protect on the anon's page.
  * => returns an "offset" which is meaningful to amap_unadd().
  */
-AMAP_INLINE vaddr_t
+AMAP_INLINE void
 amap_add(aref, offset, anon, replace)
        struct vm_aref *aref;
        vaddr_t offset;
@@ -157,25 +157,27 @@
        UVMHIST_LOG(maphist,
            "<- done (amap=0x%x, offset=0x%x, anon=0x%x, rep=%d)",
            amap, offset, anon, replace);
-
-       return(slot);
 }
 
 /*
- * amap_unadd: remove a page from an amap, given we know the slot #.
+ * amap_unadd: remove a page from an amap
  *
  * => caller must lock amap
  */
 AMAP_INLINE void
-amap_unadd(amap, slot)
-       struct vm_amap *amap;
-       vaddr_t slot;
+amap_unadd(aref, offset)
+       struct vm_aref *aref;
+       vaddr_t offset;
 {
-       int ptr;
+       int ptr, slot;
+       struct vm_amap *amap = aref->ar_amap;
        UVMHIST_FUNC("amap_unadd"); UVMHIST_CALLED(maphist);
 
+       AMAP_B2SLOT(slot, offset);
+       slot += aref->ar_pageoff;
+
        if (slot >= amap->am_nslot)
-               panic("amap_add: offset out of range");
+               panic("amap_unadd: offset out of range");
 
        if (amap->am_anon[slot] == NULL)
                panic("amap_unadd: nothing there");



Home | Main Index | Thread Index | Old Index