xref: /haiku/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystemInitializer.h (revision 21258e2674226d6aa732321b6f8494841895af5f)
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_FILE_SYSTEM_INITIALIZER_H
6 #define USERLAND_FS_FILE_SYSTEM_INITIALIZER_H
7 
8 #include <Referenceable.h>
9 
10 #include "LazyInitializable.h"
11 
12 
13 namespace UserlandFSUtil {
14 
15 class RequestPort;
16 
17 }
18 
19 using UserlandFSUtil::RequestPort;
20 
21 class FileSystem;
22 
23 class FileSystemInitializer : public LazyInitializable, public BReferenceable {
24 public:
25 								FileSystemInitializer(const char* name);
26 								~FileSystemInitializer();
27 
28 	inline	FileSystem*			GetFileSystem()	{ return fFileSystem; }
29 
30 protected:
31 	virtual	status_t			FirstTimeInit();
32 
33 	virtual	void				LastReferenceReleased();
34 
35 private:
36 			status_t			_Init(port_id port);
37 
38 private:
39 			const char*			fName;		// valid only until FirstTimeInit()
40 			FileSystem*			fFileSystem;
41 };
42 
43 #endif	// USERLAND_FS_FILE_SYSTEM_INITIALIZER_H
44