/* * Copyright (c) 2018-2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include #include #include #include #include #include #include namespace Kernel { static u32 s_lastFileSystemID; FileSystem::FileSystem() : m_fsid(++s_lastFileSystemID) { } FileSystem::~FileSystem() { } ErrorOr FileSystem::prepare_to_unmount() { return m_attach_count.with([&](auto& attach_count) -> ErrorOr { if (attach_count == 1) return prepare_to_clear_last_mount(); return {}; }); } FileSystem::DirectoryEntryView::DirectoryEntryView(StringView n, InodeIdentifier i, u8 ft) : name(n) , inode(i) , file_type(ft) { } void FileSystem::sync() { Inode::sync_all(); VirtualFileSystem::the().sync_filesystems(); } void FileSystem::lock_all() { VirtualFileSystem::the().lock_all_filesystems(); } }