summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-06 13:49:36 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-06 14:05:58 +0200
commit93d98d49769de22695f8cb4c96c5ad6f7ac39d83 (patch)
tree416a0551a39e61ca79b10a07750898f050e220c8 /Kernel/FileSystem
parenta1d7ebf85adca1550b5d61c8b7ab7fe95217e0e2 (diff)
downloadserenity-93d98d49769de22695f8cb4c96c5ad6f7ac39d83.zip
Kernel: Move Kernel/Memory/ code into Kernel::Memory namespace
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r--Kernel/FileSystem/AnonymousFile.cpp4
-rw-r--r--Kernel/FileSystem/AnonymousFile.h8
-rw-r--r--Kernel/FileSystem/Ext2FileSystem.cpp4
-rw-r--r--Kernel/FileSystem/File.cpp2
-rw-r--r--Kernel/FileSystem/File.h2
-rw-r--r--Kernel/FileSystem/FileDescription.cpp2
-rw-r--r--Kernel/FileSystem/FileDescription.h2
-rw-r--r--Kernel/FileSystem/Inode.cpp4
-rw-r--r--Kernel/FileSystem/Inode.h6
-rw-r--r--Kernel/FileSystem/InodeFile.cpp8
-rw-r--r--Kernel/FileSystem/InodeFile.h2
-rw-r--r--Kernel/FileSystem/Plan9FileSystem.cpp2
12 files changed, 23 insertions, 23 deletions
diff --git a/Kernel/FileSystem/AnonymousFile.cpp b/Kernel/FileSystem/AnonymousFile.cpp
index 580a5906f4..e21c329832 100644
--- a/Kernel/FileSystem/AnonymousFile.cpp
+++ b/Kernel/FileSystem/AnonymousFile.cpp
@@ -10,7 +10,7 @@
namespace Kernel {
-AnonymousFile::AnonymousFile(NonnullRefPtr<AnonymousVMObject> vmobject)
+AnonymousFile::AnonymousFile(NonnullRefPtr<Memory::AnonymousVMObject> vmobject)
: m_vmobject(move(vmobject))
{
}
@@ -19,7 +19,7 @@ AnonymousFile::~AnonymousFile()
{
}
-KResultOr<Region*> AnonymousFile::mmap(Process& process, FileDescription&, const Range& range, u64 offset, int prot, bool shared)
+KResultOr<Memory::Region*> AnonymousFile::mmap(Process& process, FileDescription&, Memory::Range const& 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 361143ba67..e6b25fc15e 100644
--- a/Kernel/FileSystem/AnonymousFile.h
+++ b/Kernel/FileSystem/AnonymousFile.h
@@ -13,14 +13,14 @@ namespace Kernel {
class AnonymousFile final : public File {
public:
- static RefPtr<AnonymousFile> create(NonnullRefPtr<AnonymousVMObject> vmobject)
+ static RefPtr<AnonymousFile> create(NonnullRefPtr<Memory::AnonymousVMObject> vmobject)
{
return adopt_ref_if_nonnull(new (nothrow) AnonymousFile(move(vmobject)));
}
virtual ~AnonymousFile() override;
- virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, u64 offset, int prot, bool shared) override;
+ virtual KResultOr<Memory::Region*> mmap(Process&, FileDescription&, Memory::Range const&, u64 offset, int prot, bool shared) override;
private:
virtual StringView class_name() const override { return "AnonymousFile"; }
@@ -30,9 +30,9 @@ private:
virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override { return ENOTSUP; }
virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return ENOTSUP; }
- explicit AnonymousFile(NonnullRefPtr<AnonymousVMObject>);
+ explicit AnonymousFile(NonnullRefPtr<Memory::AnonymousVMObject>);
- NonnullRefPtr<AnonymousVMObject> m_vmobject;
+ NonnullRefPtr<Memory::AnonymousVMObject> m_vmobject;
};
}
diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp
index 2bd8ddb7ce..00f20c085b 100644
--- a/Kernel/FileSystem/Ext2FileSystem.cpp
+++ b/Kernel/FileSystem/Ext2FileSystem.cpp
@@ -132,7 +132,7 @@ bool Ext2FS::initialize()
auto blocks_to_read = ceil_div(m_block_group_count * sizeof(ext2_group_desc), block_size());
BlockIndex first_block_of_bgdt = block_size() == 1024 ? 2 : 1;
- m_cached_group_descriptor_table = KBuffer::try_create_with_size(block_size() * blocks_to_read, Region::Access::Read | Region::Access::Write, "Ext2FS: Block group descriptors");
+ m_cached_group_descriptor_table = KBuffer::try_create_with_size(block_size() * blocks_to_read, Memory::Region::Access::Read | Memory::Region::Access::Write, "Ext2FS: Block group descriptors");
if (!m_cached_group_descriptor_table) {
dbgln("Ext2FS: Failed to allocate memory for group descriptor table");
return false;
@@ -1505,7 +1505,7 @@ KResultOr<Ext2FS::CachedBitmap*> Ext2FS::get_bitmap_block(BlockIndex bitmap_bloc
return cached_bitmap;
}
- auto block = KBuffer::try_create_with_size(block_size(), Region::Access::Read | Region::Access::Write, "Ext2FS: Cached bitmap block");
+ auto block = KBuffer::try_create_with_size(block_size(), Memory::Region::Access::Read | Memory::Region::Access::Write, "Ext2FS: Cached bitmap block");
if (!block)
return ENOMEM;
auto buffer = UserOrKernelBuffer::for_kernel_buffer(block->data());
diff --git a/Kernel/FileSystem/File.cpp b/Kernel/FileSystem/File.cpp
index 355b6ed56d..07226edbcf 100644
--- a/Kernel/FileSystem/File.cpp
+++ b/Kernel/FileSystem/File.cpp
@@ -40,7 +40,7 @@ KResult File::ioctl(FileDescription&, unsigned, Userspace<void*>)
return ENOTTY;
}
-KResultOr<Region*> File::mmap(Process&, FileDescription&, const Range&, u64, int, bool)
+KResultOr<Memory::Region*> File::mmap(Process&, FileDescription&, Memory::Range const&, u64, int, bool)
{
return ENODEV;
}
diff --git a/Kernel/FileSystem/File.h b/Kernel/FileSystem/File.h
index 6410d1e1cb..0e719f291f 100644
--- a/Kernel/FileSystem/File.h
+++ b/Kernel/FileSystem/File.h
@@ -88,7 +88,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 KResult ioctl(FileDescription&, unsigned request, Userspace<void*> arg);
- virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, u64 offset, int prot, bool shared);
+ virtual KResultOr<Memory::Region*> mmap(Process&, FileDescription&, Memory::Range const&, 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 6d795f81bc..19822a8309 100644
--- a/Kernel/FileSystem/FileDescription.cpp
+++ b/Kernel/FileSystem/FileDescription.cpp
@@ -380,7 +380,7 @@ InodeMetadata FileDescription::metadata() const
return {};
}
-KResultOr<Region*> FileDescription::mmap(Process& process, const Range& range, u64 offset, int prot, bool shared)
+KResultOr<Memory::Region*> FileDescription::mmap(Process& process, Memory::Range const& range, u64 offset, int prot, bool shared)
{
MutexLocker 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 c22e8a9d22..e1a05d293d 100644
--- a/Kernel/FileSystem/FileDescription.h
+++ b/Kernel/FileSystem/FileDescription.h
@@ -96,7 +96,7 @@ public:
Custody* custody() { return m_custody.ptr(); }
const Custody* custody() const { return m_custody.ptr(); }
- KResultOr<Region*> mmap(Process&, const Range&, u64 offset, int prot, bool shared);
+ KResultOr<Memory::Region*> mmap(Process&, Memory::Range const&, 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/Inode.cpp b/Kernel/FileSystem/Inode.cpp
index 37b20b1c66..9db65ef1dd 100644
--- a/Kernel/FileSystem/Inode.cpp
+++ b/Kernel/FileSystem/Inode.cpp
@@ -141,7 +141,7 @@ KResult Inode::decrement_link_count()
return ENOTIMPL;
}
-void Inode::set_shared_vmobject(SharedInodeVMObject& vmobject)
+void Inode::set_shared_vmobject(Memory::SharedInodeVMObject& vmobject)
{
MutexLocker locker(m_inode_lock);
m_shared_vmobject = vmobject;
@@ -271,7 +271,7 @@ KResult Inode::prepare_to_write_data()
return KSuccess;
}
-RefPtr<SharedInodeVMObject> Inode::shared_vmobject() const
+RefPtr<Memory::SharedInodeVMObject> Inode::shared_vmobject() const
{
MutexLocker locker(m_inode_lock);
return m_shared_vmobject.strong_ref();
diff --git a/Kernel/FileSystem/Inode.h b/Kernel/FileSystem/Inode.h
index f35a27e71b..1b21564ad5 100644
--- a/Kernel/FileSystem/Inode.h
+++ b/Kernel/FileSystem/Inode.h
@@ -84,8 +84,8 @@ public:
void will_be_destroyed();
- void set_shared_vmobject(SharedInodeVMObject&);
- RefPtr<SharedInodeVMObject> shared_vmobject() const;
+ void set_shared_vmobject(Memory::SharedInodeVMObject&);
+ RefPtr<Memory::SharedInodeVMObject> shared_vmobject() const;
static void sync();
@@ -116,7 +116,7 @@ protected:
private:
FileSystem& m_file_system;
InodeIndex m_index { 0 };
- WeakPtr<SharedInodeVMObject> m_shared_vmobject;
+ WeakPtr<Memory::SharedInodeVMObject> m_shared_vmobject;
RefPtr<LocalSocket> m_socket;
HashTable<InodeWatcher*> m_watchers;
bool m_metadata_dirty { false };
diff --git a/Kernel/FileSystem/InodeFile.cpp b/Kernel/FileSystem/InodeFile.cpp
index 876224b165..9b40bc730d 100644
--- a/Kernel/FileSystem/InodeFile.cpp
+++ b/Kernel/FileSystem/InodeFile.cpp
@@ -93,14 +93,14 @@ KResult InodeFile::ioctl(FileDescription& description, unsigned request, Userspa
}
}
-KResultOr<Region*> InodeFile::mmap(Process& process, FileDescription& description, const Range& range, u64 offset, int prot, bool shared)
+KResultOr<Memory::Region*> InodeFile::mmap(Process& process, FileDescription& description, Memory::Range const& range, u64 offset, int prot, bool shared)
{
// FIXME: If PROT_EXEC, check that the underlying file system isn't mounted noexec.
- RefPtr<InodeVMObject> vmobject;
+ RefPtr<Memory::InodeVMObject> vmobject;
if (shared)
- vmobject = SharedInodeVMObject::try_create_with_inode(inode());
+ vmobject = Memory::SharedInodeVMObject::try_create_with_inode(inode());
else
- vmobject = PrivateInodeVMObject::try_create_with_inode(inode());
+ vmobject = Memory::PrivateInodeVMObject::try_create_with_inode(inode());
if (!vmobject)
return ENOMEM;
return process.space().allocate_region_with_vmobject(range, vmobject.release_nonnull(), offset, description.absolute_path(), prot, shared);
diff --git a/Kernel/FileSystem/InodeFile.h b/Kernel/FileSystem/InodeFile.h
index 5fe928a21d..2a20673593 100644
--- a/Kernel/FileSystem/InodeFile.h
+++ b/Kernel/FileSystem/InodeFile.h
@@ -33,7 +33,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 KResult ioctl(FileDescription&, unsigned request, Userspace<void*> arg) override;
- virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, u64 offset, int prot, bool shared) override;
+ virtual KResultOr<Memory::Region*> mmap(Process&, FileDescription&, Memory::Range const&, u64 offset, int prot, bool shared) override;
virtual KResult stat(::stat& buffer) const override { return inode().metadata().stat(buffer); }
virtual String absolute_path(const FileDescription&) const override;
diff --git a/Kernel/FileSystem/Plan9FileSystem.cpp b/Kernel/FileSystem/Plan9FileSystem.cpp
index b21c81143a..6b73dc98c9 100644
--- a/Kernel/FileSystem/Plan9FileSystem.cpp
+++ b/Kernel/FileSystem/Plan9FileSystem.cpp
@@ -560,7 +560,7 @@ KResult Plan9FS::read_and_dispatch_one_message()
if (result.is_error())
return result;
- auto buffer = KBuffer::try_create_with_size(header.size, Region::Access::Read | Region::Access::Write);
+ auto buffer = KBuffer::try_create_with_size(header.size, Memory::Region::Access::Read | Memory::Region::Access::Write);
if (!buffer)
return ENOMEM;
// Copy the already read header into the buffer.