diff options
author | Jean-Baptiste Boric <jblbeurope@gmail.com> | 2021-03-18 22:57:25 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-19 09:15:19 +0100 |
commit | 6698fd84fff34f9fb2dec78c20519b5c89b2c8f9 (patch) | |
tree | 67631de5cb5b4a950d8bb9a244bf446e674ce151 | |
parent | 0d8c9024eec12d57270cca1cf6bfc7d03c0ca229 (diff) | |
download | serenity-6698fd84fff34f9fb2dec78c20519b5c89b2c8f9.zip |
Kernel: Refactor storage stack with u64 as mmap offset
-rw-r--r-- | Kernel/Devices/BXVGADevice.cpp | 2 | ||||
-rw-r--r-- | Kernel/Devices/BXVGADevice.h | 2 | ||||
-rw-r--r-- | Kernel/Devices/MBVGADevice.cpp | 2 | ||||
-rw-r--r-- | Kernel/Devices/MBVGADevice.h | 2 | ||||
-rw-r--r-- | Kernel/Devices/MemoryDevice.cpp | 2 | ||||
-rw-r--r-- | Kernel/Devices/MemoryDevice.h | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/AnonymousFile.cpp | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/AnonymousFile.h | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/File.cpp | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/File.h | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/FileDescription.cpp | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/FileDescription.h | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/InodeFile.cpp | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/InodeFile.h | 2 | ||||
-rw-r--r-- | Kernel/Syscalls/mmap.cpp | 14 |
15 files changed, 21 insertions, 21 deletions
diff --git a/Kernel/Devices/BXVGADevice.cpp b/Kernel/Devices/BXVGADevice.cpp index 54765c44c4..90161dea2f 100644 --- a/Kernel/Devices/BXVGADevice.cpp +++ b/Kernel/Devices/BXVGADevice.cpp @@ -173,7 +173,7 @@ UNMAP_AFTER_INIT u32 BXVGADevice::find_framebuffer_address() return framebuffer_address; } -KResultOr<Region*> BXVGADevice::mmap(Process& process, FileDescription&, const Range& range, size_t offset, int prot, bool shared) +KResultOr<Region*> BXVGADevice::mmap(Process& process, FileDescription&, const Range& range, u64 offset, int prot, bool shared) { REQUIRE_PROMISE(video); if (!shared) diff --git a/Kernel/Devices/BXVGADevice.h b/Kernel/Devices/BXVGADevice.h index ed780ad6a0..ea85e4faf8 100644 --- a/Kernel/Devices/BXVGADevice.h +++ b/Kernel/Devices/BXVGADevice.h @@ -42,7 +42,7 @@ public: BXVGADevice(); virtual int ioctl(FileDescription&, unsigned request, FlatPtr arg) override; - virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, size_t offset, int prot, bool shared) override; + virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, u64 offset, int prot, bool shared) override; // ^Device virtual mode_t required_mode() const override { return 0660; } diff --git a/Kernel/Devices/MBVGADevice.cpp b/Kernel/Devices/MBVGADevice.cpp index 49c85c2204..3de979fd04 100644 --- a/Kernel/Devices/MBVGADevice.cpp +++ b/Kernel/Devices/MBVGADevice.cpp @@ -51,7 +51,7 @@ UNMAP_AFTER_INIT MBVGADevice::MBVGADevice(PhysicalAddress addr, size_t pitch, si s_the = this; } -KResultOr<Region*> MBVGADevice::mmap(Process& process, FileDescription&, const Range& range, size_t offset, int prot, bool shared) +KResultOr<Region*> MBVGADevice::mmap(Process& process, FileDescription&, const Range& range, u64 offset, int prot, bool shared) { REQUIRE_PROMISE(video); if (!shared) diff --git a/Kernel/Devices/MBVGADevice.h b/Kernel/Devices/MBVGADevice.h index dd06c7b7cb..e11d7f8e92 100644 --- a/Kernel/Devices/MBVGADevice.h +++ b/Kernel/Devices/MBVGADevice.h @@ -41,7 +41,7 @@ public: MBVGADevice(PhysicalAddress addr, size_t pitch, size_t width, size_t height); virtual int ioctl(FileDescription&, unsigned request, FlatPtr arg) override; - virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, size_t offset, int prot, bool shared) override; + virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, u64 offset, int prot, bool shared) override; // ^Device virtual mode_t required_mode() const override { return 0660; } diff --git a/Kernel/Devices/MemoryDevice.cpp b/Kernel/Devices/MemoryDevice.cpp index f82b3d5d5f..3e53c90f3c 100644 --- a/Kernel/Devices/MemoryDevice.cpp +++ b/Kernel/Devices/MemoryDevice.cpp @@ -52,7 +52,7 @@ void MemoryDevice::did_seek(FileDescription&, off_t) TODO(); } -KResultOr<Region*> MemoryDevice::mmap(Process& process, FileDescription&, const Range& range, size_t offset, int prot, bool shared) +KResultOr<Region*> MemoryDevice::mmap(Process& process, FileDescription&, const Range& range, u64 offset, int prot, bool shared) { auto viewed_address = PhysicalAddress(offset); diff --git a/Kernel/Devices/MemoryDevice.h b/Kernel/Devices/MemoryDevice.h index 37b1f1dfc4..ae6e1d4fc0 100644 --- a/Kernel/Devices/MemoryDevice.h +++ b/Kernel/Devices/MemoryDevice.h @@ -39,7 +39,7 @@ public: MemoryDevice(); ~MemoryDevice(); - virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, size_t offset, int prot, bool shared) override; + virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, u64 offset, int prot, bool shared) override; // ^Device virtual mode_t required_mode() const override { return 0660; } diff --git a/Kernel/FileSystem/AnonymousFile.cpp b/Kernel/FileSystem/AnonymousFile.cpp index 82a5669f84..23cf376614 100644 --- a/Kernel/FileSystem/AnonymousFile.cpp +++ b/Kernel/FileSystem/AnonymousFile.cpp @@ -39,7 +39,7 @@ AnonymousFile::~AnonymousFile() { } -KResultOr<Region*> AnonymousFile::mmap(Process& process, FileDescription&, const Range& range, size_t offset, int prot, bool shared) +KResultOr<Region*> AnonymousFile::mmap(Process& process, FileDescription&, const Range& range, u64 offset, int prot, bool shared) { if (offset != 0) return EINVAL; diff --git a/Kernel/FileSystem/AnonymousFile.h b/Kernel/FileSystem/AnonymousFile.h index 51455db60e..3e57c5601b 100644 --- a/Kernel/FileSystem/AnonymousFile.h +++ b/Kernel/FileSystem/AnonymousFile.h @@ -39,7 +39,7 @@ public: virtual ~AnonymousFile() override; - virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, size_t offset, int prot, bool shared) override; + virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, u64 offset, int prot, bool shared) override; private: virtual const char* class_name() const override { return "AnonymousFile"; } diff --git a/Kernel/FileSystem/File.cpp b/Kernel/FileSystem/File.cpp index fcf1f99075..ed141ff1d6 100644 --- a/Kernel/FileSystem/File.cpp +++ b/Kernel/FileSystem/File.cpp @@ -59,7 +59,7 @@ int File::ioctl(FileDescription&, unsigned, FlatPtr) return -ENOTTY; } -KResultOr<Region*> File::mmap(Process&, FileDescription&, const Range&, size_t, int, bool) +KResultOr<Region*> File::mmap(Process&, FileDescription&, const Range&, u64, int, bool) { return ENODEV; } diff --git a/Kernel/FileSystem/File.h b/Kernel/FileSystem/File.h index 38aac0a62c..c8bd71725b 100644 --- a/Kernel/FileSystem/File.h +++ b/Kernel/FileSystem/File.h @@ -114,7 +114,7 @@ public: virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) = 0; virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) = 0; virtual int ioctl(FileDescription&, unsigned request, FlatPtr arg); - virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, size_t offset, int prot, bool shared); + virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, u64 offset, int prot, bool shared); virtual KResult stat(::stat&) const { return EBADF; } virtual String absolute_path(const FileDescription&) const = 0; diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp index f66811d450..c499b0daa7 100644 --- a/Kernel/FileSystem/FileDescription.cpp +++ b/Kernel/FileSystem/FileDescription.cpp @@ -327,7 +327,7 @@ InodeMetadata FileDescription::metadata() const return {}; } -KResultOr<Region*> FileDescription::mmap(Process& process, const Range& range, size_t offset, int prot, bool shared) +KResultOr<Region*> FileDescription::mmap(Process& process, const Range& range, u64 offset, int prot, bool shared) { LOCKER(m_lock); return m_file->mmap(process, *this, range, offset, prot, shared); diff --git a/Kernel/FileSystem/FileDescription.h b/Kernel/FileSystem/FileDescription.h index 2b340b11d3..df9fda57a7 100644 --- a/Kernel/FileSystem/FileDescription.h +++ b/Kernel/FileSystem/FileDescription.h @@ -108,7 +108,7 @@ public: Custody* custody() { return m_custody.ptr(); } const Custody* custody() const { return m_custody.ptr(); } - KResultOr<Region*> mmap(Process&, const Range&, size_t offset, int prot, bool shared); + KResultOr<Region*> mmap(Process&, const Range&, u64 offset, int prot, bool shared); bool is_blocking() const { return m_is_blocking; } void set_blocking(bool b) { m_is_blocking = b; } diff --git a/Kernel/FileSystem/InodeFile.cpp b/Kernel/FileSystem/InodeFile.cpp index 4c13865f08..9dfe97495d 100644 --- a/Kernel/FileSystem/InodeFile.cpp +++ b/Kernel/FileSystem/InodeFile.cpp @@ -107,7 +107,7 @@ int InodeFile::ioctl(FileDescription& description, unsigned request, FlatPtr arg } } -KResultOr<Region*> InodeFile::mmap(Process& process, FileDescription& description, const Range& range, size_t offset, int prot, bool shared) +KResultOr<Region*> InodeFile::mmap(Process& process, FileDescription& description, const Range& range, u64 offset, int prot, bool shared) { // FIXME: If PROT_EXEC, check that the underlying file system isn't mounted noexec. RefPtr<InodeVMObject> vmobject; diff --git a/Kernel/FileSystem/InodeFile.h b/Kernel/FileSystem/InodeFile.h index e00dfc8d67..a145d870fe 100644 --- a/Kernel/FileSystem/InodeFile.h +++ b/Kernel/FileSystem/InodeFile.h @@ -50,7 +50,7 @@ public: virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override; virtual int ioctl(FileDescription&, unsigned request, FlatPtr arg) override; - virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, size_t offset, int prot, bool shared) override; + virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, u64 offset, int prot, bool shared) override; virtual String absolute_path(const FileDescription&) const override; diff --git a/Kernel/Syscalls/mmap.cpp b/Kernel/Syscalls/mmap.cpp index 68447db9f2..d818701629 100644 --- a/Kernel/Syscalls/mmap.cpp +++ b/Kernel/Syscalls/mmap.cpp @@ -148,12 +148,12 @@ KResultOr<FlatPtr> Process::sys$mmap(Userspace<const Syscall::SC_mmap_params*> u return EFAULT; FlatPtr addr = params.addr; - size_t size = params.size; - size_t alignment = params.alignment; - int prot = params.prot; - int flags = params.flags; - int fd = params.fd; - int offset = params.offset; + auto size = params.size; + auto alignment = params.alignment; + auto prot = params.prot; + auto flags = params.flags; + auto fd = params.fd; + auto offset = params.offset; if (prot & PROT_EXEC) { REQUIRE_PROMISE(prot_exec); @@ -255,7 +255,7 @@ KResultOr<FlatPtr> Process::sys$mmap(Userspace<const Syscall::SC_mmap_params*> u return EACCES; } - auto region_or_error = description->mmap(*this, range.value(), static_cast<size_t>(offset), prot, map_shared); + auto region_or_error = description->mmap(*this, range.value(), static_cast<u64>(offset), prot, map_shared); if (region_or_error.is_error()) return region_or_error.error().error(); region = region_or_error.value(); |