// _UnregisterFileSystem status_t UserlandFS::_UnregisterFileSystem(const char* name) { if (!name) return B_BAD_VALUE; // find the FS and decrement its reference counter FileSystemInitializer* fileSystemInitializer = NULL; bool deleteFS = false; { FileSystemLocker _(fFileSystems); fileSystemInitializer = fFileSystems->Get(name); if (!fileSystemInitializer) return B_BAD_VALUE; deleteFS = fileSystemInitializer->RemoveReference(); if (deleteFS) fFileSystems->Remove(name); } // delete the FS, if the last reference has been removed if (deleteFS) delete fileSystemInitializer; return B_OK; }