1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 09:45:08 +00:00
serenity/Kernel/Storage/Partition/PartitionTable.h
Liav A 5ed3f7c6bf Kernel/Storage: Migrate the partition code to use the ErrorOr container
That code used the old AK::Result container, which leads to overly
complicated initialization flow when trying to figure out the correct
partition table type. Instead, when using the ErrorOr container the code
is much simpler and more understandable.
2022-04-28 22:13:54 +02:00

33 lines
829 B
C++

/*
* Copyright (c) 2020-2022, Liav A. <liavalb@hotmail.co.il>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/RefPtr.h>
#include <AK/Vector.h>
#include <Kernel/Storage/Partition/DiskPartition.h>
#include <Kernel/Storage/Partition/DiskPartitionMetadata.h>
#include <Kernel/Storage/StorageDevice.h>
namespace Kernel {
class PartitionTable {
public:
Optional<DiskPartitionMetadata> partition(unsigned index);
size_t partitions_count() const { return m_partitions.size(); }
virtual ~PartitionTable() = default;
virtual bool is_valid() const = 0;
Vector<DiskPartitionMetadata> partitions() const { return m_partitions; }
protected:
explicit PartitionTable(StorageDevice const&);
NonnullRefPtr<StorageDevice> m_device;
Vector<DiskPartitionMetadata> m_partitions;
};
}