Add a contigfree() as a corollary to contigmalloc() as it's not clear

which free routine to use and people are tempted to use free() (which
doesn't work)
This commit is contained in:
Peter Wemm 1999-08-10 22:21:13 +00:00
parent f63c7e582a
commit ed6d0b65f0
2 changed files with 14 additions and 2 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)malloc.h 8.5 (Berkeley) 5/3/95
* $Id: malloc.h,v 1.40 1999/01/21 09:23:21 dillon Exp $
* $Id: malloc.h,v 1.41 1999/01/27 21:50:00 dillon Exp $
*/
#ifndef _SYS_MALLOC_H_
@ -215,10 +215,13 @@ extern struct kmembuckets bucket[];
*/
MALLOC_DECLARE(M_IOV);
/* XXX struct malloc_type is unused for contig*(). */
void *contigmalloc __P((unsigned long size, struct malloc_type *type,
int flags,
unsigned long low, unsigned long high,
unsigned long alignment, unsigned long boundary));
void contigfree __P((void *addr, unsigned long size,
struct malloc_type *type));
void free __P((void *addr, struct malloc_type *type));
void *malloc __P((unsigned long size, struct malloc_type *type, int flags));
#endif /* KERNEL */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)vm_page.c 7.4 (Berkeley) 5/7/91
* $Id: vm_page.c,v 1.135 1999/07/31 04:19:49 alc Exp $
* $Id: vm_page.c,v 1.136 1999/07/31 18:30:59 alc Exp $
*/
/*
@ -1822,6 +1822,15 @@ contigmalloc(size, type, flags, low, high, alignment, boundary)
kernel_map);
}
void
contigfree(addr, size, type)
void *addr;
unsigned long size;
struct malloc_type *type;
{
kmem_free(kernel_map, (vm_offset_t)addr, size);
}
vm_offset_t
vm_page_alloc_contig(size, low, high, alignment)
vm_offset_t size;