All checks were successful
continuous-integration/drone/push Build is passing
This will make sure we cannot unmount a file system while there is another one mounted inside it.
27 lines
605 B
C++
27 lines
605 B
C++
#include "fs/Mount.h"
|
|
|
|
LinkedList<MountInode> g_mounts;
|
|
|
|
Result<SharedPtr<VFS::Inode>> MountInode::create(SharedPtr<VFS::Inode> source, SharedPtr<VFS::FileSystem> fs)
|
|
{
|
|
auto inode = TRY(adopt_shared_if_nonnull(new (std::nothrow) MountInode()));
|
|
|
|
inode->m_source = source;
|
|
inode->m_mountee = fs;
|
|
inode->m_mount_root_inode = fs->root_inode();
|
|
|
|
auto parent = TRY(source->find(".."));
|
|
TRY(fs->set_mount_dir(parent));
|
|
|
|
source->add_handle();
|
|
|
|
g_mounts.append(inode.ptr());
|
|
|
|
return (SharedPtr<VFS::Inode>)inode;
|
|
}
|
|
|
|
MountInode::~MountInode()
|
|
{
|
|
m_source->remove_handle();
|
|
}
|