12f1f4f54SIngo Weinhold /* 22f1f4f54SIngo Weinhold * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold@gmx.de. 32f1f4f54SIngo Weinhold * Distributed under the terms of the MIT License. 42f1f4f54SIngo Weinhold */ 55a5aaccaSIngo Weinhold #ifndef USERLAND_FS_FILE_SYSTEM_INITIALIZER_H 65a5aaccaSIngo Weinhold #define USERLAND_FS_FILE_SYSTEM_INITIALIZER_H 75a5aaccaSIngo Weinhold 8c0509cccSIngo Weinhold #include <Referenceable.h> 9c0509cccSIngo Weinhold 105a5aaccaSIngo Weinhold #include "LazyInitializable.h" 115a5aaccaSIngo Weinhold 125a5aaccaSIngo Weinhold 135a5aaccaSIngo Weinhold namespace UserlandFSUtil { 145a5aaccaSIngo Weinhold 155a5aaccaSIngo Weinhold class RequestPort; 165a5aaccaSIngo Weinhold 175a5aaccaSIngo Weinhold } 185a5aaccaSIngo Weinhold 195a5aaccaSIngo Weinhold using UserlandFSUtil::RequestPort; 205a5aaccaSIngo Weinhold 215a5aaccaSIngo Weinhold class FileSystem; 225a5aaccaSIngo Weinhold 23*88e38c17SIngo Weinhold class FileSystemInitializer : public LazyInitializable, public BReferenceable { 245a5aaccaSIngo Weinhold public: 252f1f4f54SIngo Weinhold FileSystemInitializer(const char* name); 265a5aaccaSIngo Weinhold ~FileSystemInitializer(); 275a5aaccaSIngo Weinhold GetFileSystem()285a5aaccaSIngo Weinhold inline FileSystem* GetFileSystem() { return fFileSystem; } 295a5aaccaSIngo Weinhold 305a5aaccaSIngo Weinhold protected: 315a5aaccaSIngo Weinhold virtual status_t FirstTimeInit(); 325a5aaccaSIngo Weinhold 33*88e38c17SIngo Weinhold virtual void LastReferenceReleased(); 34*88e38c17SIngo Weinhold 355a5aaccaSIngo Weinhold private: 362f1f4f54SIngo Weinhold status_t _Init(port_id port); 372f1f4f54SIngo Weinhold 382f1f4f54SIngo Weinhold private: 395a5aaccaSIngo Weinhold const char* fName; // valid only until FirstTimeInit() 405a5aaccaSIngo Weinhold FileSystem* fFileSystem; 415a5aaccaSIngo Weinhold }; 425a5aaccaSIngo Weinhold 435a5aaccaSIngo Weinhold #endif // USERLAND_FS_FILE_SYSTEM_INITIALIZER_H 44