2020-01-18 09:38:21 +01:00
|
|
|
/*
|
2020-12-26 16:53:30 +02:00
|
|
|
* Copyright (c) 2020, Liav A. <liavalb@hotmail.co.il>
|
2020-01-18 09:38:21 +01:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
|
2019-10-07 03:12:37 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/RefPtr.h>
|
2020-12-26 16:53:30 +02:00
|
|
|
#include <AK/Result.h>
|
2020-02-01 18:17:50 +02:00
|
|
|
#include <AK/Types.h>
|
2019-10-07 03:12:37 +03:00
|
|
|
#include <AK/Vector.h>
|
2020-12-26 16:53:30 +02:00
|
|
|
#include <Kernel/Storage/Partition/MBRPartitionTable.h>
|
2019-10-07 03:12:37 +03:00
|
|
|
|
2020-02-16 01:27:42 +01:00
|
|
|
namespace Kernel {
|
|
|
|
|
|
2020-12-26 16:53:30 +02:00
|
|
|
struct GUIDPartitionHeader;
|
|
|
|
|
class GUIDPartitionTable final : public MBRPartitionTable {
|
2019-10-07 03:12:37 +03:00
|
|
|
public:
|
2021-02-28 14:42:08 +01:00
|
|
|
virtual ~GUIDPartitionTable() = default;
|
|
|
|
|
;
|
2019-10-07 03:12:37 +03:00
|
|
|
|
2022-04-01 20:58:27 +03:00
|
|
|
static Result<NonnullOwnPtr<GUIDPartitionTable>, PartitionTable::Error> try_to_initialize(StorageDevice const&);
|
|
|
|
|
explicit GUIDPartitionTable(StorageDevice const&);
|
2019-10-07 03:12:37 +03:00
|
|
|
|
2020-12-26 16:53:30 +02:00
|
|
|
virtual bool is_valid() const override { return m_valid; };
|
2019-10-07 03:12:37 +03:00
|
|
|
|
2020-12-26 16:53:30 +02:00
|
|
|
private:
|
2020-12-31 13:17:03 +02:00
|
|
|
bool is_unused_entry(Array<u8, 16>) const;
|
2022-04-01 20:58:27 +03:00
|
|
|
GUIDPartitionHeader const& header() const;
|
2020-12-26 16:53:30 +02:00
|
|
|
bool initialize();
|
2019-10-07 03:12:37 +03:00
|
|
|
|
2020-12-26 16:53:30 +02:00
|
|
|
bool m_valid { true };
|
|
|
|
|
ByteBuffer m_cached_header;
|
2019-10-07 03:12:37 +03:00
|
|
|
};
|
2020-02-16 01:27:42 +01:00
|
|
|
|
|
|
|
|
}
|