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