Added function that allocates more than one page at a time, but without
the need for having them in a run. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10406 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
c02ff3b775
commit
4692c99460
@ -645,6 +645,32 @@ vm_page_allocate_page(int page_state)
|
||||
}
|
||||
|
||||
|
||||
/** Allocates a number of pages and puts their pointers into the provided
|
||||
* array. All pages are marked busy.
|
||||
* Returns B_OK on success, and B_NO_MEMORY when there aren't any free
|
||||
* pages left to allocate.
|
||||
*/
|
||||
|
||||
status_t
|
||||
vm_page_allocate_pages(int pageState, vm_page **pages, uint32 numPages)
|
||||
{
|
||||
uint32 i;
|
||||
|
||||
for (i = 0; i < numPages; i++) {
|
||||
pages[i] = vm_page_allocate_page(pageState);
|
||||
if (pages[i] == NULL) {
|
||||
// allocation failed, we need to free what we already have
|
||||
while (i-- > 0)
|
||||
vm_page_set_state(pages[i], pageState);
|
||||
|
||||
return B_NO_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
vm_page *
|
||||
vm_page_allocate_page_run(int page_state, addr_t len)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user