xref: /haiku/headers/private/kernel/disk_device_manager/KFileSystem.h (revision 4f00613311d0bd6b70fa82ce19931c41f071ea4e)
1 // KFileSystem.h
2 //
3 // KFileSystem implements the KDiskSystem interface for file systems.
4 // It works with the FS API.
5 
6 #ifndef _K_FILE_DISK_DEVICE_SYSTEM_H
7 #define _K_FILE_DISK_DEVICE_SYSTEM_H
8 
9 #include "KDiskSystem.h"
10 
11 struct file_system_module_info;
12 
13 namespace BPrivate {
14 namespace DiskDevice {
15 
16 class KFileSystem : public KDiskSystem {
17 public:
18 	KFileSystem(const char *name);
19 	virtual ~KFileSystem();
20 
21 	virtual status_t Init();
22 
23 	// Scanning
24 
25 	virtual float Identify(KPartition *partition, void **cookie);
26 	virtual status_t Scan(KPartition *partition, void *cookie);
27 	virtual void FreeIdentifyCookie(KPartition *partition, void *cookie);
28 	virtual void FreeContentCookie(KPartition *partition);
29 
30 	// Querying
31 
32 	virtual bool SupportsDefragmenting(KPartition *partition,
33 									   bool *whileMounted);
34 	virtual bool SupportsRepairing(KPartition *partition, bool checkOnly,
35 								   bool *whileMounted);
36 	virtual bool SupportsResizing(KPartition *partition, bool *whileMounted);
37 	virtual bool SupportsMoving(KPartition *partition, bool *isNoOp);
38 	virtual bool SupportsSettingContentName(KPartition *partition,
39 											bool *whileMounted);
40 	virtual bool SupportsSettingContentParameters(KPartition *partition,
41 												  bool *whileMounted);
42 	virtual bool SupportsInitializing(KPartition *partition);
43 
44 	virtual bool ValidateResize(KPartition *partition, off_t *size);
45 	virtual bool ValidateMove(KPartition *partition, off_t *start);
46 	virtual bool ValidateSetContentName(KPartition *partition, char *name);
47 	virtual bool ValidateSetContentParameters(KPartition *partition,
48 											  const char *parameters);
49 	virtual bool ValidateInitialize(KPartition *partition, char *name,
50 									const char *parameters);
51 
52 	// Shadow partition modification
53 
54 	virtual status_t ShadowPartitionChanged(KPartition *partition,
55 											uint32 operation);
56 
57 	// Writing
58 
59 	virtual status_t Defragment(KPartition *partition, KDiskDeviceJob *job);
60 	virtual status_t Repair(KPartition *partition, bool checkOnly,
61 							KDiskDeviceJob *job);
62 	virtual status_t Resize(KPartition *partition, off_t size,
63 							KDiskDeviceJob *job);
64 	virtual status_t Move(KPartition *partition, off_t offset,
65 						  KDiskDeviceJob *job);
66 	virtual status_t SetContentName(KPartition *partition, char *name,
67 									KDiskDeviceJob *job);
68 	virtual status_t SetContentParameters(KPartition *partition,
69 										  const char *parameters,
70 										  KDiskDeviceJob *job);
71 	virtual status_t Initialize(KPartition *partition, const char *name,
72 								const char *parameters, KDiskDeviceJob *job);
73 
74 protected:
75 	virtual status_t LoadModule();
76 	virtual void UnloadModule();
77 
78 private:
79 	file_system_module_info	*fModule;
80 };
81 
82 } // namespace DiskDevice
83 } // namespace BPrivate
84 
85 using BPrivate::DiskDevice::KFileSystem;
86 
87 #endif	// _K_FILE_DISK_DEVICE_SYSTEM_H
88