1 /* 2 * Copyright 2001-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 EXTENTSTREAM_H 9 #define EXTENTSTREAM_H 10 11 12 #include "ext2.h" 13 #include "Transaction.h" 14 15 16 class Volume; 17 18 19 class ExtentStream 20 { 21 public: 22 ExtentStream(Volume* volume, ext2_extent_stream* stream, 23 off_t size); 24 ~ExtentStream(); 25 26 status_t FindBlock(off_t offset, fsblock_t& block, 27 uint32 *_count = NULL); 28 status_t Enlarge(Transaction& transaction, off_t& numBlocks); 29 status_t Shrink(Transaction& transaction, off_t& numBlocks); 30 void Init(); 31 32 bool Check(); 33 34 private: 35 status_t _Check(ext2_extent_stream *stream, fileblock_t &block); 36 status_t _CheckBlock(ext2_extent_stream *stream, fsblock_t block); 37 38 Volume* fVolume; 39 ext2_extent_stream* fStream; 40 fsblock_t fFirstBlock; 41 42 fsblock_t fAllocatedPos; 43 44 off_t fNumBlocks; 45 off_t fSize; 46 }; 47 48 #endif // EXTENTSTREAM_H 49 50