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 14namespace UserlandFSUtil { 15 16class RequestPort; 17 18} 19 20using UserlandFSUtil::RequestPort; 21 22class FileSystem; 23class FileSystemInitializer; 24 25class UserlandFS { 26private: 27 UserlandFS(); 28 ~UserlandFS(); 29 30public: 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 41private: 42 friend class KernelDebug; 43 typedef SynchronizedHashMap<String, FileSystemInitializer*> 44 FileSystemMap; 45 typedef AutoLocker<UserlandFS::FileSystemMap> FileSystemLocker; 46 47private: 48 status_t _Init(); 49 status_t _UnregisterFileSystem(const char* name); 50 51private: 52 static UserlandFS* sUserlandFS; 53 54 FileSystemMap* fFileSystems; 55 bool fDebuggerCommandsAdded; 56}; 57 58#endif // USERLAND_FS_H 59