Kernel: Remove some unnecessary indirection in InodeFile::mmap()

InodeFile now directly calls Process::allocate_region_with_vmobject()
instead of taking an awkward detour via a special Region constructor.
This commit is contained in:
Andreas Kling 2020-02-28 20:29:14 +01:00
parent 651417a085
commit aa1e209845
Notes: sideshowbarker 2024-07-19 08:59:04 +09:00
5 changed files with 3 additions and 33 deletions

View file

@ -29,6 +29,7 @@
#include <Kernel/FileSystem/InodeFile.h>
#include <Kernel/FileSystem/VirtualFileSystem.h>
#include <Kernel/Process.h>
#include <Kernel/VM/SharedInodeVMObject.h>
namespace Kernel {
@ -63,7 +64,7 @@ KResultOr<Region*> InodeFile::mmap(Process& process, FileDescription& descriptio
{
ASSERT(offset == 0);
// FIXME: If PROT_EXEC, check that the underlying file system isn't mounted noexec.
auto* region = process.allocate_file_backed_region(preferred_vaddr, size, inode(), description.absolute_path(), prot);
auto* region = process.allocate_region_with_vmobject(preferred_vaddr, size, SharedInodeVMObject::create_with_inode(inode()), offset, description.absolute_path(), prot);
if (!region)
return KResult(-ENOMEM);
return region;