summaryrefslogtreecommitdiff
path: root/Kernel/Devices/KCOVDevice.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-08-23 18:51:18 +0200
committerAndreas Kling <kling@serenityos.org>2022-08-24 14:57:51 +0200
commit30861daa93c06280cff4e355b31d11ecbf8079ec (patch)
treefdb41ebda018893cf9498a11126194cf71e9395a /Kernel/Devices/KCOVDevice.h
parentcf16b2c8e64709d570c5f54a981017d217e95ed0 (diff)
downloadserenity-30861daa93c06280cff4e355b31d11ecbf8079ec.zip
Kernel: Simplify the File memory-mapping API
Before this change, we had File::mmap() which did all the work of setting up a VMObject, and then creating a Region in the current process's address space. This patch simplifies the interface by removing the region part. Files now only have to return a suitable VMObject from vmobject_for_mmap(), and then sys$mmap() itself will take care of actually mapping it into the address space. This fixes an issue where we'd try to block on I/O (for inode metadata lookup) while holding the address space spinlock. It also reduces time spent holding the address space lock.
Diffstat (limited to 'Kernel/Devices/KCOVDevice.h')
-rw-r--r--Kernel/Devices/KCOVDevice.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Devices/KCOVDevice.h b/Kernel/Devices/KCOVDevice.h
index bc5883c61f..40d7e70872 100644
--- a/Kernel/Devices/KCOVDevice.h
+++ b/Kernel/Devices/KCOVDevice.h
@@ -22,7 +22,7 @@ public:
static void free_process();
// ^File
- ErrorOr<Memory::Region*> mmap(Process&, Memory::AddressSpace&, OpenFileDescription&, Memory::VirtualRange const&, u64 offset, int prot, bool shared) override;
+ ErrorOr<NonnullLockRefPtr<Memory::VMObject>> vmobject_for_mmap(Process&, Memory::VirtualRange const&, u64& offset, bool shared) override;
ErrorOr<NonnullLockRefPtr<OpenFileDescription>> open(int options) override;
protected: