1// FileSystem.h 2 3#ifndef USERLAND_FS_FILE_SYSTEM_H 4#define USERLAND_FS_FILE_SYSTEM_H 5 6#include <fsproto.h> 7 8#include "LazyInitializable.h" 9#include "Locker.h" 10#include "Referencable.h" 11#include "RequestPortPool.h" 12#include "String.h" 13#include "Vector.h" 14 15namespace UserlandFSUtil { 16 17class RequestPort; 18 19} 20 21using UserlandFSUtil::RequestPort; 22 23struct IOCtlInfo; 24class Settings; 25class Volume; 26 27class FileSystem : public LazyInitializable, public Referencable { 28public: 29 FileSystem(const char* name, 30 RequestPort* initPort, 31 status_t* error); 32 ~FileSystem(); 33 34 const char* GetName() const; 35 36 RequestPortPool* GetPortPool(); 37 38 status_t Mount(nspace_id id, const char* device, 39 ulong flags, const char* parameters, 40 int32 len, 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(nspace_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 55protected: 56 virtual status_t FirstTimeInit(); 57 58private: 59 static int32 _NotificationThreadEntry(void* data); 60 int32 _NotificationThread(); 61 62private: 63 friend class KernelDebug; 64 struct SelectSyncEntry; 65 struct SelectSyncMap; 66 67 Vector<Volume*> fVolumes; 68 Locker fVolumeLock; 69 String fName; 70 RequestPort* fInitPort; 71 RequestPort* fNotificationPort; 72 thread_id fNotificationThread; 73 RequestPortPool fPortPool; 74 SelectSyncMap* fSelectSyncs; 75 Settings* fSettings; 76 team_id fUserlandServerTeam; 77 volatile bool fTerminating; 78}; 79 80#endif // USERLAND_FS_FILE_SYSTEM_H 81