xref: /haiku/src/add-ons/kernel/file_systems/ext2/ExtentStream.h (revision d482c34e49ef2163e25b86cf61eee008c46fc50c)
145af882dSJérôme Duval /*
2*d482c34eSJérôme Duval  * Copyright 2001-2011, Haiku Inc. All rights reserved.
345af882dSJérôme Duval  * This file may be used under the terms of the MIT License.
445af882dSJérôme Duval  *
545af882dSJérôme Duval  * Authors:
645af882dSJérôme Duval  *		Jérôme Duval
745af882dSJérôme Duval  */
845af882dSJérôme Duval #ifndef EXTENTSTREAM_H
945af882dSJérôme Duval #define EXTENTSTREAM_H
1045af882dSJérôme Duval 
11*d482c34eSJérôme Duval 
1245af882dSJérôme Duval #include "ext2.h"
1345af882dSJérôme Duval #include "Transaction.h"
1445af882dSJérôme Duval 
1545af882dSJérôme Duval 
1645af882dSJérôme Duval class Volume;
1745af882dSJérôme Duval 
1845af882dSJérôme Duval 
1945af882dSJérôme Duval class ExtentStream
2045af882dSJérôme Duval {
2145af882dSJérôme Duval public:
2245af882dSJérôme Duval 					ExtentStream(Volume* volume, ext2_extent_stream* stream,
2345af882dSJérôme Duval 						off_t size);
2445af882dSJérôme Duval 					~ExtentStream();
2545af882dSJérôme Duval 
2645af882dSJérôme Duval 	status_t		FindBlock(off_t offset, fsblock_t& block,
2745af882dSJérôme Duval 						uint32 *_count = NULL);
2845af882dSJérôme Duval 	status_t		Enlarge(Transaction& transaction, off_t& numBlocks);
2945af882dSJérôme Duval 	status_t		Shrink(Transaction& transaction, off_t& numBlocks);
3045af882dSJérôme Duval 	void			Init();
3145af882dSJérôme Duval 
3245af882dSJérôme Duval 	bool			Check();
3345af882dSJérôme Duval 
3445af882dSJérôme Duval private:
3545af882dSJérôme Duval 	status_t		_Check(ext2_extent_stream *stream, fileblock_t &block);
3645af882dSJérôme Duval 	status_t		_CheckBlock(ext2_extent_stream *stream, fsblock_t block);
3745af882dSJérôme Duval 
3845af882dSJérôme Duval 	Volume*			fVolume;
3945af882dSJérôme Duval 	ext2_extent_stream* fStream;
4045af882dSJérôme Duval 	fsblock_t		fFirstBlock;
4145af882dSJérôme Duval 
4245af882dSJérôme Duval 	fsblock_t		fAllocatedPos;
4345af882dSJérôme Duval 
4445af882dSJérôme Duval 	off_t			fNumBlocks;
4545af882dSJérôme Duval 	off_t			fSize;
4645af882dSJérôme Duval };
4745af882dSJérôme Duval 
4845af882dSJérôme Duval #endif	// EXTENTSTREAM_H
4945af882dSJérôme Duval 
50