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 */ 8 #ifndef CHUNK_H 9 #define CHUNK_H 10 11 12 #include "btrfs.h" 13 14 15 class Chunk { 16 public: 17 Chunk(struct btrfs_chunk* chunk, 18 fsblock_t offset); 19 ~Chunk(); 20 uint32 Size() const; 21 status_t FindBlock(off_t logical, off_t &physical); 22 fsblock_t Offset() const { return fChunkOffset; } 23 fsblock_t End() const 24 { return fChunkOffset + fChunk->Length(); } 25 private: 26 struct btrfs_chunk* fChunk; 27 fsblock_t fChunkOffset; 28 status_t fInitStatus; 29 }; 30 31 #endif // CHUNK_H 32