Assorted whitespace cleanup and typo fixes.
[haiku.git] / src / bin / makeudfimage / Allocator.h
blob1704613a492a0e058a38371e70d0d5d7e3430813
1 //----------------------------------------------------------------------
2 // This software is part of the OpenBeOS distribution and is covered
3 // by the OpenBeOS license.
4 //
5 // Copyright (c) 2003 Tyler Dauwalder, tyler@dauwalder.net
6 //----------------------------------------------------------------------
8 /*! \file Allocator.h
10 Physical block allocator class declarations.
13 #ifndef _UDF_ALLOCATOR_H
14 #define _UDF_ALLOCATOR_H
16 #include <list>
17 using std::list;
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.
26 class Allocator {
27 public:
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);
45 private:
46 list<extent_address> fChunkList;
47 uint32 fLength; //!< Length of allocation so far, in blocks.
48 uint32 fBlockSize;
49 uint32 fBlockShift;
50 status_t fInitStatus;
53 #endif // _UDF_ALLOCATOR_H