1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:58:12 +00:00

Kernel/FileSystem: Add the DevLoopFS filesystem

Similarly to DevPtsFS, this filesystem is about exposing loop device
nodes easily in /dev/loop, so userspace doesn't need to do anything in
order to use new devices immediately.
This commit is contained in:
Liav A 2024-02-09 15:30:09 +02:00 committed by Andrew Kaster
parent 11ead5c84f
commit 0d2e4a7e67
6 changed files with 292 additions and 0 deletions

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2024, Liav A. <liavalb@hotmail.co.il>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Types.h>
#include <Kernel/FileSystem/FileSystem.h>
#include <Kernel/FileSystem/Inode.h>
namespace Kernel {
class LoopDevice;
class DevLoopFSInode;
class DevLoopFS final : public FileSystem {
friend class DevLoopFSInode;
public:
virtual ~DevLoopFS() override;
static ErrorOr<NonnullRefPtr<FileSystem>> try_create(ReadonlyBytes);
virtual ErrorOr<void> initialize() override;
virtual StringView class_name() const override { return "DevLoopFS"sv; }
virtual Inode& root_inode() override;
private:
virtual u8 internal_file_type_to_directory_entry_type(DirectoryEntryView const& entry) const override;
DevLoopFS();
ErrorOr<NonnullRefPtr<Inode>> get_inode(InodeIdentifier) const;
RefPtr<DevLoopFSInode> m_root_inode;
};
}