ladybird/Kernel/Storage/DiskPartition.h
Samuel Bowman f6ab636d31 Kernel: Move DiskPartition up into Kernel/Storage
Everything in Kernel/Storage/Partition but DiskPartition has been moved
into LibPartiton. This makes the Partition directory unnecessary so
DiskPartition is moved up into Kernel/Storage.
2022-07-21 20:13:44 +01:00

41 lines
1.2 KiB
C++

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/RefPtr.h>
#include <AK/WeakPtr.h>
#include <Kernel/Devices/BlockDevice.h>
#include <LibPartition/DiskPartitionMetadata.h>
namespace Kernel {
class DiskPartition final : public BlockDevice {
friend class DeviceManagement;
public:
static NonnullRefPtr<DiskPartition> create(BlockDevice&, unsigned, Partition::DiskPartitionMetadata);
virtual ~DiskPartition();
virtual void start_request(AsyncBlockDeviceRequest&) override;
// ^BlockDevice
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
virtual bool can_read(OpenFileDescription const&, u64) const override;
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, UserOrKernelBuffer const&, size_t) override;
virtual bool can_write(OpenFileDescription const&, u64) const override;
Partition::DiskPartitionMetadata const& metadata() const;
private:
DiskPartition(BlockDevice&, unsigned, Partition::DiskPartitionMetadata);
virtual StringView class_name() const override;
WeakPtr<BlockDevice> m_device;
Partition::DiskPartitionMetadata m_metadata;
};
}