1 /* 2 * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef USERLAND_FS_H 6 #define USERLAND_FS_H 7 8 #include <SupportDefs.h> 9 10 #include "AutoLocker.h" 11 #include "Locker.h" 12 #include "HashMap.h" 13 #include "String.h" 14 15 namespace UserlandFSUtil { 16 17 class RequestPort; 18 19 } 20 21 using UserlandFSUtil::RequestPort; 22 23 class FileSystem; 24 class FileSystemInitializer; 25 26 class UserlandFS { 27 private: 28 UserlandFS(); 29 ~UserlandFS(); 30 31 public: 32 static status_t InitUserlandFS(UserlandFS** userlandFS); 33 static void UninitUserlandFS(); 34 static UserlandFS* GetUserlandFS(); 35 36 status_t RegisterFileSystem(const char* name, 37 FileSystem** fileSystem); 38 status_t UnregisterFileSystem(FileSystem* fileSystem); 39 40 int32 CountFileSystems() const; 41 42 private: 43 friend class KernelDebug; 44 typedef SynchronizedHashMap<String, FileSystemInitializer*, Locker> 45 FileSystemMap; 46 typedef AutoLocker<UserlandFS::FileSystemMap> FileSystemLocker; 47 48 private: 49 status_t _Init(); 50 status_t _UnregisterFileSystem(const char* name); 51 52 private: 53 static UserlandFS* sUserlandFS; 54 55 FileSystemMap* fFileSystems; 56 bool fDebuggerCommandsAdded; 57 }; 58 59 #endif // USERLAND_FS_H 60