xref: /haiku/headers/private/kernel/disk_device_manager/KPartitioningSystem.h (revision 1d9d47fc72028bb71b5f232a877231e59cfe2438)
1 // KPartitioningSystem.h
2 
3 #ifndef _K_PARTITIONING_DISK_DEVICE_SYSTEM_H
4 #define _K_PARTITIONING_DISK_DEVICE_SYSTEM_H
5 
6 #include "KDiskSystem.h"
7 
8 struct partition_module_info;
9 
10 namespace BPrivate {
11 namespace DiskDevice {
12 
13 class KPartitioningSystem : public KDiskSystem {
14 public:
15 	KPartitioningSystem(const char *name);
16 	virtual ~KPartitioningSystem();
17 
18 	virtual status_t Init();
19 
20 	// Scanning
21 
22 	virtual float Identify(KPartition *partition, void **cookie);
23 	virtual status_t Scan(KPartition *partition, void *cookie);
24 	virtual void FreeIdentifyCookie(KPartition *partition, void *cookie);
25 	virtual void FreeCookie(KPartition *partition);
26 	virtual void FreeContentCookie(KPartition *partition);
27 
28 	// Querying
29 
30 	virtual bool SupportsRepairing(KPartition *partition, bool checkOnly,
31 								   bool *whileMounted);
32 	virtual bool SupportsResizing(KPartition *partition, bool *whileMounted);
33 	virtual bool SupportsResizingChild(KPartition *child);
34 	virtual bool SupportsMoving(KPartition *partition, bool *isNoOp);
35 	virtual bool SupportsMovingChild(KPartition *child);
36 	virtual bool SupportsSettingName(KPartition *partition);
37 	virtual bool SupportsSettingContentName(KPartition *partition,
38 											bool *whileMounted);
39 	virtual bool SupportsSettingType(KPartition *partition);
40 	virtual bool SupportsSettingParameters(KPartition *partition);
41 	virtual bool SupportsSettingContentParameters(KPartition *partition,
42 												  bool *whileMounted);
43 	virtual bool SupportsInitializing(KPartition *partition);
44 	virtual bool SupportsInitializingChild(KPartition *child,
45 										   const char *diskSystem);
46 	virtual bool SupportsCreatingChild(KPartition *partition);
47 	virtual bool SupportsDeletingChild(KPartition *child);
48 	virtual bool IsSubSystemFor(KPartition *partition);
49 
50 	virtual bool ValidateResize(KPartition *partition, off_t *size);
51 	virtual bool ValidateResizeChild(KPartition *child, off_t *size);
52 	virtual bool ValidateMove(KPartition *partition, off_t *start);
53 	virtual bool ValidateMoveChild(KPartition *child, off_t *start);
54 	virtual bool ValidateSetName(KPartition *partition, char *name);
55 	virtual bool ValidateSetContentName(KPartition *partition, char *name);
56 	virtual bool ValidateSetType(KPartition *partition, const char *type);
57 	virtual bool ValidateSetParameters(KPartition *partition,
58 									   const char *parameters);
59 	virtual bool ValidateSetContentParameters(KPartition *parameters,
60 											  const char *parameters);
61 	virtual bool ValidateInitialize(KPartition *partition, char *name,
62 									const char *parameters);
63 	virtual bool ValidateCreateChild(KPartition *partition, off_t *start,
64 									 off_t *size, const char *type,
65 									 const char *parameters, int32 *index);
66 	virtual int32 CountPartitionableSpaces(KPartition *partition);
67 	virtual status_t GetPartitionableSpaces(KPartition *partition,
68 											partitionable_space_data *buffer,
69 											int32 count,
70 											int32 *actualCount = NULL);
71 
72 	virtual status_t GetNextSupportedType(KPartition *partition, int32 *cookie,
73 										  char *type);
74 	virtual status_t GetTypeForContentType(const char *contentType,
75 										   char *type);
76 
77 	// Shadow partition modification
78 
79 	virtual status_t ShadowPartitionChanged(KPartition *partition,
80 											uint32 operation);
81 
82 	// Writing
83 
84 	virtual status_t Repair(KPartition *partition, bool checkOnly,
85 							KDiskDeviceJob *job);
86 	virtual status_t Resize(KPartition *partition, off_t size,
87 							KDiskDeviceJob *job);
88 	virtual status_t ResizeChild(KPartition *child, off_t size,
89 								 KDiskDeviceJob *job);
90 	virtual status_t Move(KPartition *partition, off_t offset,
91 						  KDiskDeviceJob *job);
92 	virtual status_t MoveChild(KPartition *child, off_t offset,
93 							   KDiskDeviceJob *job);
94 	virtual status_t SetName(KPartition *partition, char *name,
95 							 KDiskDeviceJob *job);
96 	virtual status_t SetContentName(KPartition *partition, char *name,
97 									KDiskDeviceJob *job);
98 	virtual status_t SetType(KPartition *partition, char *type,
99 							 KDiskDeviceJob *job);
100 	virtual status_t SetParameters(KPartition *partition,
101 								   const char *parameters,
102 								   KDiskDeviceJob *job);
103 	virtual status_t SetContentParameters(KPartition *partition,
104 										  const char *parameters,
105 										  KDiskDeviceJob *job);
106 	virtual status_t CreateChild(KPartition *partition, off_t offset,
107 								 off_t size, const char *type,
108 								 const char *parameters, KDiskDeviceJob *job,
109 								 KPartition **child = NULL,
110 								 partition_id childID = -1);
111 	virtual status_t DeleteChild(KPartition *child, KDiskDeviceJob *job);
112 	virtual status_t Initialize(KPartition *partition, const char *name,
113 								const char *parameters, KDiskDeviceJob *job);
114 
115 protected:
116 	virtual status_t LoadModule();
117 	virtual void UnloadModule();
118 
119 private:
120 	partition_module_info	*fModule;
121 };
122 
123 } // namespace DiskDevice
124 } // namespace BPrivate
125 
126 using BPrivate::DiskDevice::KPartitioningSystem;
127 
128 #endif	// _K_PARTITIONING_DISK_DEVICE_SYSTEM_H
129