1 // FileSystem.h 2 3 #ifndef USERLAND_FS_FILE_SYSTEM_H 4 #define USERLAND_FS_FILE_SYSTEM_H 5 6 #include <fs_interface.h> 7 8 #include "FSCapabilities.h" 9 #include "LazyInitializable.h" 10 #include "Locker.h" 11 #include "Referencable.h" 12 #include "RequestPort.h" 13 #include "RequestPortPool.h" 14 #include "String.h" 15 #include "Vector.h" 16 17 18 struct IOCtlInfo; 19 class Settings; 20 class Volume; 21 22 class FileSystem { 23 public: 24 FileSystem(); 25 ~FileSystem(); 26 27 status_t Init(const char* name, Port::Info* infos, 28 int32 infoCount, 29 const FSCapabilities& capabilities); 30 31 const char* GetName() const; 32 33 const FSCapabilities& GetCapabilities() const; 34 inline bool HasCapability(uint32 capability) const; 35 36 RequestPortPool* GetPortPool(); 37 38 status_t Mount(mount_id id, const char* device, 39 ulong flags, const char* parameters, 40 Volume** volume); 41 // status_t Initialize(const char* deviceName, 42 // const char* parameters, size_t len); 43 void VolumeUnmounted(Volume* volume); 44 45 Volume* GetVolume(mount_id id); 46 47 const IOCtlInfo* GetIOCtlInfo(int command) const; 48 49 status_t AddSelectSyncEntry(selectsync* sync); 50 void RemoveSelectSyncEntry(selectsync* sync); 51 bool KnowsSelectSyncEntry(selectsync* sync); 52 53 bool IsUserlandServerThread() const; 54 55 private: 56 static int32 _NotificationThreadEntry(void* data); 57 int32 _NotificationThread(); 58 59 private: 60 friend class KernelDebug; 61 struct SelectSyncEntry; 62 struct SelectSyncMap; 63 64 Vector<Volume*> fVolumes; 65 Locker fVolumeLock; 66 String fName; 67 FSCapabilities fCapabilities; 68 RequestPort* fNotificationPort; 69 thread_id fNotificationThread; 70 RequestPortPool fPortPool; 71 SelectSyncMap* fSelectSyncs; 72 Settings* fSettings; 73 team_id fUserlandServerTeam; 74 bool fInitialized; 75 volatile bool fTerminating; 76 }; 77 78 79 // HasCapability 80 inline bool 81 FileSystem::HasCapability(uint32 capability) const 82 { 83 return fCapabilities.Get(capability); 84 } 85 86 #endif // USERLAND_FS_FILE_SYSTEM_H 87