xref: /haiku/headers/private/kernel/disk_device_manager/KPartitioningSystem.h (revision 2a596c013a8ac49bea49a64faedcfbb7c45c743a)
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);
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 	// Writing
78 
79 	virtual status_t Repair(KPartition *partition, bool checkOnly,
80 							KDiskDeviceJob *job);
81 	virtual status_t Resize(KPartition *partition, off_t size,
82 							KDiskDeviceJob *job);
83 	virtual status_t ResizeChild(KPartition *child, off_t size,
84 								 KDiskDeviceJob *job);
85 	virtual status_t Move(KPartition *partition, off_t offset,
86 						  KDiskDeviceJob *job);
87 	virtual status_t MoveChild(KPartition *child, off_t offset,
88 							   KDiskDeviceJob *job);
89 	virtual status_t SetName(KPartition *partition, char *name,
90 							 KDiskDeviceJob *job);
91 	virtual status_t SetContentName(KPartition *partition, char *name,
92 									KDiskDeviceJob *job);
93 	virtual status_t SetType(KPartition *partition, char *type,
94 							 KDiskDeviceJob *job);
95 	virtual status_t SetParameters(KPartition *partition,
96 								   const char *parameters,
97 								   KDiskDeviceJob *job);
98 	virtual status_t SetContentParameters(KPartition *partition,
99 										  const char *parameters,
100 										  KDiskDeviceJob *job);
101 	virtual status_t CreateChild(KPartition *partition, off_t offset,
102 								 off_t size, const char *type,
103 								 const char *parameters, KDiskDeviceJob *job,
104 								 KPartition **child = NULL,
105 								 partition_id childID = -1);
106 	virtual status_t DeleteChild(KPartition *child, KDiskDeviceJob *job);
107 	virtual status_t Initialize(KPartition *partition, const char *name,
108 								const char *parameters, KDiskDeviceJob *job);
109 
110 protected:
111 	virtual status_t LoadModule();
112 	virtual void UnloadModule();
113 
114 private:
115 	partition_module_info	*fModule;
116 };
117 
118 } // namespace DiskDevice
119 } // namespace BPrivate
120 
121 using BPrivate::DiskDevice::KPartitioningSystem;
122 
123 #endif	// _K_PARTITIONING_DISK_DEVICE_SYSTEM_H
124