mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
f6ab636d31
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.
41 lines
1.2 KiB
C++
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;
|
|
};
|
|
|
|
}
|