/* * Copyright (c) 2020-2022, Liav A. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #ifdef KERNEL # include #else # include #endif namespace Partition { class PartitionTable { public: Optional partition(unsigned index) const; size_t partitions_count() const { return m_partitions.size(); } virtual ~PartitionTable() = default; virtual bool is_valid() const = 0; Vector partitions() const { return m_partitions; } size_t block_size() const { return m_block_size; } protected: #ifdef KERNEL explicit PartitionTable(Kernel::StorageDevice const&); NonnullRefPtr m_device; #else explicit PartitionTable(NonnullRefPtr); NonnullRefPtr m_device_file; #endif Vector m_partitions; size_t m_block_size; }; }