Interface for custom block allocation schemes. More...
#include <mkd64/iblalloc.h>
Public Attributes | |
void(* | setImage )(IBlockAllocator *self, Image *image) |
Set the image the allocator should operate on. | |
void(* | setInterleave )(IBlockAllocator *self, int interleave) |
Set the requested interleave for all following operations. | |
void(* | setConsiderReserved )(IBlockAllocator *self, int considerReserved) |
Set whether the allocator should consider allocating reserved blocks. | |
Block *(* | allocFirstBlock )(IBlockAllocator *self) |
Try allocating a first block for a new file. | |
Block *(* | allocNextBlock )(IBlockAllocator *self, const BlockPosition *pos) |
Try allocating a new block for a file. |
Interface for custom block allocation schemes.
Block*(* IBlockAllocator::allocFirstBlock)(IBlockAllocator *self) |
Try allocating a first block for a new file.
This should locate a free block, allocate it and return it.
self | the IBlockAllocator |
Block*(* IBlockAllocator::allocNextBlock)(IBlockAllocator *self, const BlockPosition *pos) |
Try allocating a new block for a file.
This should locate the best available block for chaining to the position given in pos, honouring the current interleave value. It should NOT actively chain the blocks, this is left to the caller – just find a suitable block, allocate it and return it.
self | the IBlockAllocator |
pos | the position of the previous block in the chain |
void(* IBlockAllocator::setConsiderReserved)(IBlockAllocator *self, int considerReserved) |
Set whether the allocator should consider allocating reserved blocks.
If this was called with a 1, the allocator should try to get hold of reserved blocks and allocate them if possible.
self | the IBlockAllocator |
considerReserved | 1 or 0, 1 means try to allocate reserved blocks |
void(* IBlockAllocator::setImage)(IBlockAllocator *self, Image *image) |
Set the image the allocator should operate on.
This is always called when the allocator is attached to an image, so do all your initialization here.
self | the IBlockAllocator |
image | the image to work on |
void(* IBlockAllocator::setInterleave)(IBlockAllocator *self, int interleave) |
Set the requested interleave for all following operations.
self | the IBlockAllocator |
interleave | the requested interleave value |