mirror of
https://github.com/RGBCube/serenity
synced 2025-05-21 15:45:07 +00:00
Kernel: Added unmount ability to VFS
It is now possible to unmount file systems from the VFS via `umount`. It works via looking up the `fsid` of the filesystem from the `Inode`'s metatdata so I'm not sure how fragile it is. It seems to work for now though as something to get us going.
This commit is contained in:
parent
f7251c74a9
commit
bc22456f89
13 changed files with 98 additions and 3 deletions
|
@ -1395,3 +1395,16 @@ unsigned Ext2FS::free_inode_count() const
|
|||
LOCKER(m_lock);
|
||||
return super_block().s_free_inodes_count;
|
||||
}
|
||||
|
||||
KResult Ext2FS::prepare_to_unmount() const
|
||||
{
|
||||
LOCKER(m_lock); // Acquire lock for this FS
|
||||
for (auto it = m_inode_cache.begin(); it != m_inode_cache.end(); ++it) {
|
||||
if (it->value.ptr()->ref_count() > 1)
|
||||
return KResult(-EBUSY);
|
||||
}
|
||||
|
||||
dbg() << "here!";
|
||||
m_inode_cache.clear();
|
||||
return KSuccess;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue