Got rid of ERR_VM_NO_REGION_SLOT - we now return BeBook friendly error codes.
Added short description to find_reserved_area() as that name is not that good. vm_reserve_address_range() now doesn't do anything if the requested size of the reservation is zero. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10867 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0f4c53b1d0
commit
19b83dc2b3
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de.
|
* Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||||
@ -175,6 +175,11 @@ _vm_create_area_struct(vm_address_space *aspace, const char *name, uint32 wiring
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Finds a reserved area that covers the region spanned by \a start and
|
||||||
|
* \a size, inserts the \a area into that region and makes sure that
|
||||||
|
* there are reserved regions for the remaining parts.
|
||||||
|
*/
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
find_reserved_area(vm_virtual_map *map, addr_t start, addr_t size, vm_area *area)
|
find_reserved_area(vm_virtual_map *map, addr_t start, addr_t size, vm_area *area)
|
||||||
{
|
{
|
||||||
@ -186,7 +191,7 @@ find_reserved_area(vm_virtual_map *map, addr_t start, addr_t size, vm_area *area
|
|||||||
// this area covers the requested range
|
// this area covers the requested range
|
||||||
if (next->id != RESERVED_REGION_ID) {
|
if (next->id != RESERVED_REGION_ID) {
|
||||||
// but it's not reserved space, it's a real area
|
// but it's not reserved space, it's a real area
|
||||||
return ERR_VM_NO_REGION_SLOT;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -272,7 +277,7 @@ find_and_insert_area_slot(vm_virtual_map *map, addr_t start, addr_t size, addr_t
|
|||||||
if (addressSpec == B_EXACT_ADDRESS) {
|
if (addressSpec == B_EXACT_ADDRESS) {
|
||||||
// search for a reserved area
|
// search for a reserved area
|
||||||
status_t status = find_reserved_area(map, start, size, area);
|
status_t status = find_reserved_area(map, start, size, area);
|
||||||
if (status == B_OK || status == ERR_VM_NO_REGION_SLOT)
|
if (status == B_OK || status == B_BAD_VALUE)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
// there was no reserved area, and the slot doesn't seem to be used already
|
// there was no reserved area, and the slot doesn't seem to be used already
|
||||||
@ -390,7 +395,7 @@ second_chance:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!foundspot)
|
if (!foundspot)
|
||||||
return ERR_VM_NO_REGION_SLOT;
|
return addressSpec == B_EXACT_ADDRESS ? B_BAD_VALUE : B_NO_MEMORY;
|
||||||
|
|
||||||
area->size = size;
|
area->size = size;
|
||||||
if (last) {
|
if (last) {
|
||||||
@ -619,6 +624,9 @@ vm_reserve_address_range(aspace_id aid, void **_address, uint32 addressSpec, add
|
|||||||
vm_area *area;
|
vm_area *area;
|
||||||
status_t status = B_OK;
|
status_t status = B_OK;
|
||||||
|
|
||||||
|
if (size == 0)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
addressSpace = vm_get_aspace_by_id(aid);
|
addressSpace = vm_get_aspace_by_id(aid);
|
||||||
if (addressSpace == NULL)
|
if (addressSpace == NULL)
|
||||||
return ERR_VM_INVALID_ASPACE;
|
return ERR_VM_INVALID_ASPACE;
|
||||||
|
Loading…
Reference in New Issue
Block a user