AllocationBlock::Allocate() still had the 0xffff thing implemented, now
also the numBlocks parameter is ASSERTed - when compiled with DEBUG turned off, BFS will enter the kernel debugger in this case (through the use of the DIE() macro). Same for AllocationBlock::Free() (but the 0xffff mode was already removed there). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2053 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -120,15 +120,11 @@ void
|
|||||||
AllocationBlock::Allocate(uint16 start, uint16 numBlocks)
|
AllocationBlock::Allocate(uint16 start, uint16 numBlocks)
|
||||||
{
|
{
|
||||||
ASSERT(start < fNumBits);
|
ASSERT(start < fNumBits);
|
||||||
|
ASSERT(start + numBlocks <= fNumBits);
|
||||||
|
|
||||||
if (numBlocks == 0xffff) {
|
if (start + numBlocks > fNumBits) {
|
||||||
// allocate all blocks after "start"
|
|
||||||
numBlocks = fNumBits - start;
|
|
||||||
} else if (start + numBlocks > fNumBits) {
|
|
||||||
FATAL(("Allocation::Allocate(): tried to allocate too many blocks: %u (numBlocks = %u)!\n", numBlocks, fNumBits));
|
FATAL(("Allocation::Allocate(): tried to allocate too many blocks: %u (numBlocks = %u)!\n", numBlocks, fNumBits));
|
||||||
DEBUGGER(("Allocation::Allocate(): tried to allocate too many blocks"));
|
DIE(("Allocation::Allocate(): tried to allocate too many blocks"));
|
||||||
|
|
||||||
numBlocks = fNumBits - start;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 block = start >> 5;
|
int32 block = start >> 5;
|
||||||
@@ -155,12 +151,11 @@ void
|
|||||||
AllocationBlock::Free(uint16 start, uint16 numBlocks)
|
AllocationBlock::Free(uint16 start, uint16 numBlocks)
|
||||||
{
|
{
|
||||||
ASSERT(start < fNumBits);
|
ASSERT(start < fNumBits);
|
||||||
|
ASSERT(start + numBlocks <= fNumBits);
|
||||||
|
|
||||||
if (start + numBlocks > fNumBits) {
|
if (start + numBlocks > fNumBits) {
|
||||||
FATAL(("Allocation::Free(): tried to free too many blocks: %u (numBlocks = %u)!\n", numBlocks, fNumBits));
|
FATAL(("Allocation::Free(): tried to free too many blocks: %u (numBlocks = %u)!\n", numBlocks, fNumBits));
|
||||||
DEBUGGER(("Allocation::Free(): tried to free too many blocks"));
|
DIE(("Allocation::Free(): tried to free too many blocks"));
|
||||||
|
|
||||||
numBlocks = fNumBits - start;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 block = start >> 5;
|
int32 block = start >> 5;
|
||||||
|
|||||||
Reference in New Issue
Block a user