1/*
2 * Copyright 2001-2008, pinc Software. All Rights Reserved.
3 */
4#ifndef BITMAP_H
5#define BITMAP_H
6
7
8#include <SupportDefs.h>
9
10class Disk;
11class Inode;
12
13
14class Bitmap {
15	public:
16		Bitmap(Disk *disk);
17		Bitmap();
18		~Bitmap();
19
20		status_t	SetTo(Disk *disk);
21		status_t	InitCheck();
22
23		off_t		FreeBlocks() const;
24		off_t		UsedBlocks() const { return fUsedBlocks; }
25
26		bool		UsedAt(off_t block) const;
27		bool		BackupUsedAt(off_t block) const;
28		bool		BackupSetAt(off_t block,bool used);
29		void		BackupSet(Inode *inode,bool used);
30
31		status_t	Validate();
32		status_t	CompareWithBackup();
33		bool		TrustBlockContaining(off_t block) const;
34
35		size_t		Size() const { return fSize; }
36
37	private:
38		Disk	*fDisk;
39		uint32	*fBitmap;
40		uint32	*fBackupBitmap;
41		size_t	fSize;
42		size_t	fByteSize;
43		off_t	fUsedBlocks;
44};
45
46#endif	/* BITMAP_H */
47