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 13namespace UserlandFSUtil { 14 15class RequestPort; 16 17} 18 19using UserlandFSUtil::RequestPort; 20 21class FileSystem; 22 23class FileSystemInitializer : public LazyInitializable, public BReferenceable { 24public: 25 FileSystemInitializer(const char* name); 26 ~FileSystemInitializer(); 27 28 inline FileSystem* GetFileSystem() { return fFileSystem; } 29 30protected: 31 virtual status_t FirstTimeInit(); 32 33 virtual void LastReferenceReleased(); 34 35private: 36 status_t _Init(port_id port); 37 38private: 39 const char* fName; // valid only until FirstTimeInit() 40 FileSystem* fFileSystem; 41}; 42 43#endif // USERLAND_FS_FILE_SYSTEM_INITIALIZER_H 44