public:
virtual bool allocate( IORangeScalar size, IORangeScalar * result, IORangeScalar alignment = 0 );
This method allocates a range from the free list. The alignment will default to the alignment set when the allocator was created or may be set here.
Result: True if the allocation was successful, else false.
Name Description size The size of the range requested. result The beginning of the range allocated is returned here on success. alignment If zero is passed, default to the allocators alignment, otherwise pass an alignment required for the allocation, for example 4096 to page align.
public:
virtual bool allocateRange( IORangeScalar start, IORangeScalar size );
This method allocates a range from the free list, given a set offset passed in.
Result: True if the allocation was successful, else false.
Name Description start The beginning of the range requested. size The size of the range requested.
public:
virtual void deallocate( IORangeScalar start, IORangeScalar size );
This method deallocates a range to the free list, given a the start offset and length passed in.
Name Description start The beginning of the range requested. size The size of the range requested.
public:
virtual UInt32 getFragmentCapacity( void );
This method returns the current capacity of the free fragment list.
Result: The current capacity of free fragment list.public:
virtual UInt32 getFragmentCount( void );
This method returns a count of free fragments. Each fragment describes a non-contiguous free range - deallocations will merge contiguous fragments together.
Result: The count of free fragments.public:
virtual IORangeScalar getFreeCount( void );
This method returns the total of the sizes of the fragments on the free list.
Result: The total of the free fragments sizes.public:
virtual bool init( IORangeScalar endOfRange, IORangeScalar defaultAlignment, UInt32 capacity, IOOptionBits options );
This method initializes an IORangeAllocator and optionally sets the free list to contain one fragment, from zero to an endOfRange parameter. The capacity in terms of free fragments and locking options are set for the instance.
Result: Returns true if the instance is successfully initialize, false on failure.
Name Description endOfRange If the free list is to contain an initial fragment, set endOfRange to the last offset in the range, ie. size - 1, to create a free fragment for the range zero to endOfRange inclusive. If zero is passed the free list will be initialized empty, and can be populated with calls to the deallocate method. defaultAlignment If this parameter is non-zero it specifies a required alignment for all allocations, for example pass 256 to align allocations on 256 byte boundaries. Zero or one specify unaligned allocations. capacity Sets the initial size of the free list in number of non-contiguous fragments. This value is also used for the capacityIncrement. options Pass kLocking if the instance can be used by multiple threads.
public:
virtual void setFragmentCapacityIncrement( UInt32 count );
This method sets the number of extra fragments the free list will expand to when full. It defaults to the initial capacity.
Name Description count The number of fragments to increment the capacity by when the free list is full.
public:
static IORangeAllocator * withRange( IORangeScalar endOfRange, IORangeScalar defaultAlignment = 0, UInt32 capacity = 0, IOOptionBits options = 0 );
This method allocates and initializes an IORangeAllocator and optionally sets the free list to contain one fragment, from zero to an endOfRange parameter. The capacity in terms of free fragments and locking options are set for the instance.
Result: Returns the new IORangeAllocator instance, to be released by the caller, or zero on failure.
Name Description endOfRange If the free list is to contain an initial fragment, set endOfRange to the last offset in the range, ie. size - 1, to create a free fragment for the range zero to endOfRange inclusive. If zero is passed the free list will be initialized empty, and can be populated with calls to the deallocate method. defaultAlignment If this parameter is non-zero it specifies a required alignment for all allocations, for example pass 256 to align allocations on 256 byte boundaries. Zero or one specify unaligned allocations. capacity Sets the initial size of the free list in number of non-contiguous fragments. This value is also used for the capacityIncrement. options Pass kLocking if the instance can be used by multiple threads.
© 2000 Apple Computer, Inc. (Last Updated 2/23/2000)