1 //----------------------------------------------------------------------
2 // This software is part of the OpenBeOS distribution and is covered
3 // by the OpenBeOS license.
5 // Copyright (c) 2003 Tyler Dauwalder, tyler@dauwalder.net
6 //----------------------------------------------------------------------
10 Physical block allocator class declarations.
13 #ifndef _UDF_ALLOCATOR_H
14 #define _UDF_ALLOCATOR_H
19 #include "UdfStructures.h"
21 /*! \brief This class keeps track of allocated and unallocated
22 blocks in the range of 0 to 2^32.
24 By default, all blocks are unallocated.
28 Allocator(uint32 blockSize
);
29 status_t
InitCheck() const;
31 status_t
GetBlock(uint32 block
);
32 status_t
GetExtent(extent_address extent
);
34 status_t
GetNextBlock(uint32
&block
, uint32 minimumBlock
= 0);
35 status_t
GetNextExtent(uint32 length
, bool contiguous
,
36 extent_address
&extent
,
37 uint32 minimumStartingBlock
= 0);
39 uint32
Length() const { return fLength
; }
40 uint32
Tail() const { return fLength
; } //!< Returns the first unallocated block in the tail
41 uint32
BlockSize() const { return fBlockSize
; }
42 uint32
BlockShift() const { return fBlockShift
; }
44 uint32
BlocksFor(off_t bytes
);
46 list
<extent_address
> fChunkList
;
47 uint32 fLength
; //!< Length of allocation so far, in blocks.
53 #endif // _UDF_ALLOCATOR_H