ladybird/Userland/Libraries/LibPartition/EBRPartitionTable.h
Ben Wiederhake 3d6b838df3 LibPartition: Migrate from DeprecatedFile to File
The implemented cloning mechanism should be sound:
- If a PartitionTable is passed a File with
  ShouldCloseFileDescriptor::Yes, then it will keep it alive until the
  PartitionTable is destroyed.
- If a PartitionTable is passed a File with
  ShouldCloseFileDescriptor::No, then the caller has to ensure that the
  file descriptor remains alive.
If the caller is EBRPartitionTable, the same consideration holds.
If the caller is PartitionEditor::PartitionModel, this is satisfied by
keeping an OwnPtr<Core::File> around which is the originally opened
file.

Therefore, we never leak any fds, and never access a Core::File or fd
after destroying it.
2023-06-05 14:50:09 +02:00

33 lines
655 B
C++

/*
* 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();
static ErrorOr<NonnullOwnPtr<EBRPartitionTable>> try_to_initialize(PartitionableDevice);
explicit EBRPartitionTable(PartitionableDevice);
virtual bool is_valid() const override
{
return m_valid;
}
private:
void search_extended_partition(MBRPartitionTable&, u64, size_t limit);
bool m_valid { false };
};
}