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.
This commit is contained in:
thorpej 1999-07-07 05:31:40 +00:00
parent 687108b42f
commit 121fe0bc26
2 changed files with 15 additions and 13 deletions

View File

@ -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 @@ struct vm_amap;
*/
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 @@ void amap_splitref /* split reference to amap into two */
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

View File

@ -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 @@ amap_lookups(aref, offset, anons, npages)
* 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 @@ amap_add(aref, offset, anon, replace)
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");