summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibPartition/EBRPartitionTable.h
blob: 0e381293a3c8b75ccc1ab8c7de04b43bf1a24688 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * Copyright (c) 2020-2022, Liav A. <liavalb@hotmail.co.il>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibPartition/MBRPartitionTable.h>

namespace Partition {

struct EBRPartitionHeader;
class EBRPartitionTable : public MBRPartitionTable {
public:
    ~EBRPartitionTable();

#ifdef KERNEL
    static ErrorOr<NonnullOwnPtr<EBRPartitionTable>> try_to_initialize(Kernel::StorageDevice const&);
    explicit EBRPartitionTable(Kernel::StorageDevice const&);
#else
    static ErrorOr<NonnullOwnPtr<EBRPartitionTable>> try_to_initialize(NonnullRefPtr<Core::File>);
    explicit EBRPartitionTable(NonnullRefPtr<Core::File>);
#endif

    virtual bool is_valid() const override
    {
        return m_valid;
    }

private:
#ifdef KERNEL
    void search_extended_partition(Kernel::StorageDevice const&, MBRPartitionTable&, u64, size_t limit);
#else
    void search_extended_partition(NonnullRefPtr<Core::File>, MBRPartitionTable&, u64, size_t limit);
#endif

    bool m_valid { false };
};

}