diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2020-05-28 18:46:16 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-29 07:53:30 +0200 |
commit | d395b93b150ab1819f4480d966169e6ef12b636b (patch) | |
tree | e33117163ba6117965de43bacb5c469daf6fddda /Kernel | |
parent | ec4902d1dd039436118cd821b76dbacec6d7cdca (diff) | |
download | serenity-d395b93b150ab1819f4480d966169e6ef12b636b.zip |
Kernel: Misc tweaks
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/FileSystem/VirtualFileSystem.cpp | 4 | ||||
-rw-r--r-- | Kernel/FileSystem/VirtualFileSystem.h | 3 | ||||
-rw-r--r-- | Kernel/Process.cpp | 6 |
3 files changed, 8 insertions, 5 deletions
diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp index b68eaffc67..df3000e38e 100644 --- a/Kernel/FileSystem/VirtualFileSystem.cpp +++ b/Kernel/FileSystem/VirtualFileSystem.cpp @@ -70,6 +70,8 @@ InodeIdentifier VFS::root_inode_id() const KResult VFS::mount(FS& file_system, Custody& mount_point, int flags) { + LOCKER(m_lock); + auto& inode = mount_point.inode(); dbg() << "VFS: Mounting " << file_system.class_name() << " at " << mount_point.absolute_path() << " (inode: " << inode.identifier() << ") with flags " << flags; // FIXME: check that this is not already a mount point @@ -80,6 +82,8 @@ KResult VFS::mount(FS& file_system, Custody& mount_point, int flags) KResult VFS::bind_mount(Custody& source, Custody& mount_point, int flags) { + LOCKER(m_lock); + dbg() << "VFS: Bind-mounting " << source.absolute_path() << " at " << mount_point.absolute_path(); // FIXME: check that this is not already a mount point Mount mount { source.inode(), mount_point, flags }; diff --git a/Kernel/FileSystem/VirtualFileSystem.h b/Kernel/FileSystem/VirtualFileSystem.h index 06f9c470eb..4ea33b3d58 100644 --- a/Kernel/FileSystem/VirtualFileSystem.h +++ b/Kernel/FileSystem/VirtualFileSystem.h @@ -132,8 +132,7 @@ private: Lock m_lock { "VFSLock" }; RefPtr<Inode> m_root_inode; - Vector<Mount> m_mounts; - + Vector<Mount, 16> m_mounts; RefPtr<Custody> m_root_custody; }; diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index f7c4b5a9cd..cd11dd1767 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -4088,7 +4088,7 @@ int Process::sys$mount(const Syscall::SC_mount_params* user_params) auto target = validate_and_copy_string_from_user(params.target); auto fs_type = validate_and_copy_string_from_user(params.fs_type); - if (target.is_null() || fs_type.is_null()) + if (target.is_null()) return -EFAULT; auto description = file_description(source_fd); @@ -4103,8 +4103,6 @@ int Process::sys$mount(const Syscall::SC_mount_params* user_params) auto& target_custody = custody_or_error.value(); - RefPtr<FS> fs; - if (params.flags & MS_BIND) { // We're doing a bind mount. if (description.is_null()) @@ -4116,6 +4114,8 @@ int Process::sys$mount(const Syscall::SC_mount_params* user_params) return VFS::the().bind_mount(*description->custody(), target_custody, params.flags); } + RefPtr<FS> fs; + if (fs_type == "ext2" || fs_type == "Ext2FS") { if (description.is_null()) return -EBADF; |