xref: /haiku/headers/private/storage/PartitioningInfo.h (revision d9cebac2b77547b7064f22497514eecd2d047160)
1 //----------------------------------------------------------------------
2 //  This software is part of the OpenBeOS distribution and is covered
3 //  by the OpenBeOS license.
4 //---------------------------------------------------------------------
5 
6 #ifndef _PARTITIONING_INFO_H
7 #define _PARTITIONING_INFO_H
8 
9 #include <DiskDeviceDefs.h>
10 
11 struct partitionable_space_data;
12 
13 class BPartitioningInfo {
14 public:
15 								BPartitioningInfo();
16 	virtual						~BPartitioningInfo();
17 
18 			status_t			SetTo(off_t offset, off_t size);
19 			void				Unset();
20 
21 			status_t			ExcludeOccupiedSpace(off_t offset,
22 									off_t size);
23 
24 // TODO: We don't need the partition ID.
25 			partition_id		PartitionID() const;
26 
27 			status_t			GetPartitionableSpaceAt(int32 index,
28 									off_t* offset, off_t*size) const;
29 			int32				CountPartitionableSpaces() const;
30 
31 private:
32 			status_t			_SetTo(partition_id partition,
33 									int32 changeCounter);
34 
35 			status_t			_InsertSpaces(int32 index, int32 count);
36 			void				_RemoveSpaces(int32 index, int32 count);
37 
38 	friend class BPartition;
39 
40 			partition_id		fPartitionID;
41 			partitionable_space_data* fSpaces;
42 			int32				fCount;
43 			int32				fCapacity;
44 };
45 
46 #endif	// _PARTITIONING_INFO_H
47