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