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 "HashMap.h" 12 #include "String.h" 13 14 namespace UserlandFSUtil { 15 16 class RequestPort; 17 18 } 19 20 using UserlandFSUtil::RequestPort; 21 22 class FileSystem; 23 class FileSystemInitializer; 24 25 class UserlandFS { 26 private: 27 UserlandFS(); 28 ~UserlandFS(); 29 30 public: 31 static status_t InitUserlandFS(UserlandFS** userlandFS); 32 static void UninitUserlandFS(); 33 static UserlandFS* GetUserlandFS(); 34 35 status_t RegisterFileSystem(const char* name, 36 FileSystem** fileSystem); 37 status_t UnregisterFileSystem(FileSystem* fileSystem); 38 39 int32 CountFileSystems() const; 40 41 private: 42 friend class KernelDebug; 43 typedef SynchronizedHashMap<String, FileSystemInitializer*> 44 FileSystemMap; 45 typedef AutoLocker<UserlandFS::FileSystemMap> FileSystemLocker; 46 47 private: 48 status_t _Init(); 49 status_t _UnregisterFileSystem(const char* name); 50 51 private: 52 static UserlandFS* sUserlandFS; 53 54 FileSystemMap* fFileSystems; 55 bool fDebuggerCommandsAdded; 56 }; 57 58 #endif // USERLAND_FS_H 59