xref: /haiku/headers/private/storage/PartitioningInfo.h (revision 268f99dd7dc4bd7474a8bd2742d3f1ec1de6752a)
15b3f1d0cSTyler Dauwalder //----------------------------------------------------------------------
2*2ca13760SColdfirex //  This software is part of the Haiku distribution and is covered
3b6f76ebeSAugustin Cavalier //  by the MIT License.
45b3f1d0cSTyler Dauwalder //---------------------------------------------------------------------
55b3f1d0cSTyler Dauwalder 
65b3f1d0cSTyler Dauwalder #ifndef _PARTITIONING_INFO_H
75b3f1d0cSTyler Dauwalder #define _PARTITIONING_INFO_H
85b3f1d0cSTyler Dauwalder 
9fb82e723SIngo Weinhold #include <DiskDeviceDefs.h>
10fb82e723SIngo Weinhold 
11fb82e723SIngo Weinhold struct partitionable_space_data;
125b3f1d0cSTyler Dauwalder 
135b3f1d0cSTyler Dauwalder class BPartitioningInfo {
145b3f1d0cSTyler Dauwalder public:
15fb82e723SIngo Weinhold 								BPartitioningInfo();
16fb82e723SIngo Weinhold 	virtual						~BPartitioningInfo();
17fb82e723SIngo Weinhold 
18103ca6a3SIngo Weinhold 			status_t			SetTo(off_t offset, off_t size);
19fb82e723SIngo Weinhold 			void				Unset();
20fb82e723SIngo Weinhold 
21103ca6a3SIngo Weinhold 			status_t			ExcludeOccupiedSpace(off_t offset,
22103ca6a3SIngo Weinhold 									off_t size);
23103ca6a3SIngo Weinhold 
24103ca6a3SIngo Weinhold // TODO: We don't need the partition ID.
25fb82e723SIngo Weinhold 			partition_id		PartitionID() const;
26fb82e723SIngo Weinhold 
27103ca6a3SIngo Weinhold 			status_t			GetPartitionableSpaceAt(int32 index,
28103ca6a3SIngo Weinhold 									off_t* offset, off_t*size) const;
29bef8916eSIngo Weinhold 			int32				CountPartitionableSpaces() const;
305b3f1d0cSTyler Dauwalder 
3196418817SStephan Aßmus 			void				PrintToStream() const;
325b3f1d0cSTyler Dauwalder private:
33103ca6a3SIngo Weinhold 			status_t			_InsertSpaces(int32 index, int32 count);
34103ca6a3SIngo Weinhold 			void				_RemoveSpaces(int32 index, int32 count);
35fb82e723SIngo Weinhold 
36fb82e723SIngo Weinhold 	friend class BPartition;
37fb82e723SIngo Weinhold 
38fb82e723SIngo Weinhold 			partition_id		fPartitionID;
39fb82e723SIngo Weinhold 			partitionable_space_data* fSpaces;
40bef8916eSIngo Weinhold 			int32				fCount;
41103ca6a3SIngo Weinhold 			int32				fCapacity;
425b3f1d0cSTyler Dauwalder };
435b3f1d0cSTyler Dauwalder 
445b3f1d0cSTyler Dauwalder #endif	// _PARTITIONING_INFO_H
45