1 /* 2 * Copyright 2011, Haiku Inc. All rights reserved. 3 * This file may be used under the terms of the MIT License. 4 * 5 * Authors: 6 * Jérôme Duval 7 * Chế Vũ Gia Hy 8 */ 9 #ifndef CHUNK_H 10 #define CHUNK_H 11 12 13 #include "btrfs.h" 14 15 16 //! Used to translate logical addresses to physical addresses 17 class Chunk { 18 public: 19 Chunk(btrfs_chunk* chunk, 20 fsblock_t offset); 21 ~Chunk(); 22 //! \return Value of current physical size 23 uint32 Size() const; 24 //! Used to convert logical addresses into physical addresses 25 status_t FindBlock(off_t logical, off_t& physical); 26 fsblock_t Offset() const { return fChunkOffset; } 27 fsblock_t End() const 28 { return fChunkOffset + fChunk->Length(); } 29 private: 30 btrfs_chunk* fChunk; 31 fsblock_t fChunkOffset; 32 status_t fInitStatus; 33 }; 34 35 #endif // CHUNK_H 36