1 /* 2 * Copyright 2003-2007, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Ingo Weinhold <bonefish@cs.tu-berlin.de> 7 * 8 * KFileSystem implements the KDiskSystem interface for file systems. 9 * It works with the FS API. 10 */ 11 #ifndef _K_FILE_DISK_DEVICE_SYSTEM_H 12 #define _K_FILE_DISK_DEVICE_SYSTEM_H 13 14 #include "KDiskSystem.h" 15 16 struct file_system_module_info; 17 18 namespace BPrivate { 19 namespace DiskDevice { 20 21 //! \brief Wrapper for the C interface of a filesystem add-on. 22 class KFileSystem : public KDiskSystem { 23 public: 24 KFileSystem(const char *name); 25 virtual ~KFileSystem(); 26 27 virtual status_t Init(); 28 29 // Scanning 30 31 virtual float Identify(KPartition *partition, void **cookie); 32 virtual status_t Scan(KPartition *partition, void *cookie); 33 virtual void FreeIdentifyCookie(KPartition *partition, void *cookie); 34 virtual void FreeContentCookie(KPartition *partition); 35 36 // Querying 37 38 virtual uint32 GetSupportedOperations(KPartition* partition, uint32 mask); 39 40 virtual bool ValidateResize(KPartition *partition, off_t *size); 41 virtual bool ValidateMove(KPartition *partition, off_t *start); 42 virtual bool ValidateSetContentName(KPartition *partition, char *name); 43 virtual bool ValidateSetContentParameters(KPartition *partition, 44 const char *parameters); 45 virtual bool ValidateInitialize(KPartition *partition, char *name, 46 const char *parameters); 47 48 // Shadow partition modification 49 50 virtual status_t ShadowPartitionChanged(KPartition *partition, 51 KPartition *child, uint32 operation); 52 53 // Writing 54 55 virtual status_t Defragment(KPartition *partition, KDiskDeviceJob *job); 56 virtual status_t Repair(KPartition *partition, bool checkOnly, 57 KDiskDeviceJob *job); 58 virtual status_t Resize(KPartition *partition, off_t size, 59 KDiskDeviceJob *job); 60 virtual status_t Move(KPartition *partition, off_t offset, 61 KDiskDeviceJob *job); 62 virtual status_t SetContentName(KPartition *partition, char *name, 63 KDiskDeviceJob *job); 64 virtual status_t SetContentParameters(KPartition *partition, 65 const char *parameters, 66 KDiskDeviceJob *job); 67 virtual status_t Initialize(KPartition *partition, const char *name, 68 const char *parameters, KDiskDeviceJob *job); 69 70 protected: 71 virtual status_t LoadModule(); 72 virtual void UnloadModule(); 73 74 private: 75 file_system_module_info *fModule; 76 }; 77 78 } // namespace DiskDevice 79 } // namespace BPrivate 80 81 using BPrivate::DiskDevice::KFileSystem; 82 83 #endif // _K_FILE_DISK_DEVICE_SYSTEM_H 84