Mkd64 module API  1.3b
API for creating own mkd64 modules
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IBlockAllocator Interface Reference

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.

Detailed Description

Interface for custom block allocation schemes.

Member Data Documentation

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.

Parameters
selfthe IBlockAllocator
Returns
a newly-allocated block or 0 if no available block was found
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.

Parameters
selfthe IBlockAllocator
posthe position of the previous block in the chain
Returns
a newly-allocated block or 0 if no available block was found
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.

Parameters
selfthe IBlockAllocator
considerReserved1 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.

Parameters
selfthe IBlockAllocator
imagethe image to work on
void(* IBlockAllocator::setInterleave)(IBlockAllocator *self, int interleave)

Set the requested interleave for all following operations.

Parameters
selfthe IBlockAllocator
interleavethe requested interleave value

The documentation for this interface was generated from the following file: