mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 17:28:48 +00:00
Kernel/Storage: Migrate the partition code to use the ErrorOr container
That code used the old AK::Result container, which leads to overly complicated initialization flow when trying to figure out the correct partition table type. Instead, when using the ErrorOr container the code is much simpler and more understandable.
This commit is contained in:
parent
19912a0b32
commit
5ed3f7c6bf
Notes:
sideshowbarker
2024-07-17 11:29:39 +09:00
Author: https://github.com/supercomputer7
Commit: 5ed3f7c6bf
Pull-request: https://github.com/SerenityOS/serenity/pull/13796
Reviewed-by: https://github.com/linusg
9 changed files with 39 additions and 50 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Liav A. <liavalb@hotmail.co.il>
|
||||
* Copyright (c) 2020-2022, Liav A. <liavalb@hotmail.co.il>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -47,11 +47,11 @@ struct [[gnu::packed]] GUIDPartitionHeader {
|
|||
u32 crc32_entries_array;
|
||||
};
|
||||
|
||||
Result<NonnullOwnPtr<GUIDPartitionTable>, PartitionTable::Error> GUIDPartitionTable::try_to_initialize(StorageDevice const& device)
|
||||
ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> GUIDPartitionTable::try_to_initialize(StorageDevice const& device)
|
||||
{
|
||||
auto table = adopt_nonnull_own_or_enomem(new (nothrow) GUIDPartitionTable(device)).release_value_but_fixme_should_propagate_errors();
|
||||
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) GUIDPartitionTable(device)));
|
||||
if (!table->is_valid())
|
||||
return { PartitionTable::Error::Invalid };
|
||||
return Error::from_errno(EINVAL);
|
||||
return table;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue