mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:07:36 +00:00
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.
This commit is contained in:
parent
c197fb4037
commit
3d6b838df3
14 changed files with 221 additions and 177 deletions
|
@ -38,17 +38,10 @@ public:
|
|||
public:
|
||||
~MBRPartitionTable();
|
||||
|
||||
#ifdef KERNEL
|
||||
static ErrorOr<NonnullOwnPtr<MBRPartitionTable>> try_to_initialize(Kernel::StorageDevice&);
|
||||
static OwnPtr<MBRPartitionTable> try_to_initialize(Kernel::StorageDevice&, u32 start_lba);
|
||||
explicit MBRPartitionTable(Kernel::StorageDevice&);
|
||||
MBRPartitionTable(Kernel::StorageDevice&, u32 start_lba);
|
||||
#else
|
||||
static ErrorOr<NonnullOwnPtr<MBRPartitionTable>> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>);
|
||||
static OwnPtr<MBRPartitionTable> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>, u32 start_lba);
|
||||
explicit MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile>);
|
||||
MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile>, u32 start_lba);
|
||||
#endif
|
||||
static ErrorOr<NonnullOwnPtr<MBRPartitionTable>> try_to_initialize(PartitionableDevice);
|
||||
static OwnPtr<MBRPartitionTable> try_to_initialize(PartitionableDevice, u32 start_lba);
|
||||
explicit MBRPartitionTable(PartitionableDevice);
|
||||
MBRPartitionTable(PartitionableDevice, u32 start_lba);
|
||||
|
||||
bool is_protective_mbr() const;
|
||||
bool contains_ebr() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue