1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00

LibPartition: Make Kernel parts const-correct re: StorageDevice&

We can't do I/O with a const StorageDevice&, so it has to be non-const.
This commit is contained in:
Andreas Kling 2023-02-19 23:36:30 +01:00
parent c837e7bbf3
commit 456f12c5c8
Notes: sideshowbarker 2024-07-17 00:25:35 +09:00
8 changed files with 20 additions and 20 deletions

View file

@ -13,7 +13,7 @@
namespace Partition {
#ifdef KERNEL
ErrorOr<NonnullOwnPtr<EBRPartitionTable>> EBRPartitionTable::try_to_initialize(Kernel::StorageDevice const& device)
ErrorOr<NonnullOwnPtr<EBRPartitionTable>> EBRPartitionTable::try_to_initialize(Kernel::StorageDevice& device)
{
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) EBRPartitionTable(device)));
#else
@ -29,7 +29,7 @@ ErrorOr<NonnullOwnPtr<EBRPartitionTable>> EBRPartitionTable::try_to_initialize(N
}
#ifdef KERNEL
void EBRPartitionTable::search_extended_partition(Kernel::StorageDevice const& device, MBRPartitionTable& checked_ebr, u64 current_block_offset, size_t limit)
void EBRPartitionTable::search_extended_partition(Kernel::StorageDevice& device, MBRPartitionTable& checked_ebr, u64 current_block_offset, size_t limit)
#else
void EBRPartitionTable::search_extended_partition(NonnullRefPtr<Core::DeprecatedFile> device, MBRPartitionTable& checked_ebr, u64 current_block_offset, size_t limit)
#endif
@ -53,7 +53,7 @@ void EBRPartitionTable::search_extended_partition(NonnullRefPtr<Core::Deprecated
}
#ifdef KERNEL
EBRPartitionTable::EBRPartitionTable(Kernel::StorageDevice const& device)
EBRPartitionTable::EBRPartitionTable(Kernel::StorageDevice& device)
#else
EBRPartitionTable::EBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device)
#endif

View file

@ -16,8 +16,8 @@ public:
~EBRPartitionTable();
#ifdef KERNEL
static ErrorOr<NonnullOwnPtr<EBRPartitionTable>> try_to_initialize(Kernel::StorageDevice const&);
explicit EBRPartitionTable(Kernel::StorageDevice const&);
static ErrorOr<NonnullOwnPtr<EBRPartitionTable>> try_to_initialize(Kernel::StorageDevice&);
explicit EBRPartitionTable(Kernel::StorageDevice&);
#else
static ErrorOr<NonnullOwnPtr<EBRPartitionTable>> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>);
explicit EBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile>);
@ -30,7 +30,7 @@ public:
private:
#ifdef KERNEL
void search_extended_partition(Kernel::StorageDevice const&, MBRPartitionTable&, u64, size_t limit);
void search_extended_partition(Kernel::StorageDevice&, MBRPartitionTable&, u64, size_t limit);
#else
void search_extended_partition(NonnullRefPtr<Core::DeprecatedFile>, MBRPartitionTable&, u64, size_t limit);
#endif

View file

@ -49,7 +49,7 @@ struct [[gnu::packed]] GUIDPartitionHeader {
};
#ifdef KERNEL
ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> GUIDPartitionTable::try_to_initialize(Kernel::StorageDevice const& device)
ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> GUIDPartitionTable::try_to_initialize(Kernel::StorageDevice& device)
{
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) GUIDPartitionTable(device)));
#else
@ -63,7 +63,7 @@ ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> GUIDPartitionTable::try_to_initialize
}
#ifdef KERNEL
GUIDPartitionTable::GUIDPartitionTable(Kernel::StorageDevice const& device)
GUIDPartitionTable::GUIDPartitionTable(Kernel::StorageDevice& device)
: MBRPartitionTable(device)
#else
GUIDPartitionTable::GUIDPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_file)

View file

@ -16,8 +16,8 @@ public:
virtual ~GUIDPartitionTable() = default;
#ifdef KERNEL
static ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> try_to_initialize(Kernel::StorageDevice const&);
explicit GUIDPartitionTable(Kernel::StorageDevice const&);
static ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> try_to_initialize(Kernel::StorageDevice&);
explicit GUIDPartitionTable(Kernel::StorageDevice&);
#else
static ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>);
explicit GUIDPartitionTable(NonnullRefPtr<Core::DeprecatedFile>);

View file

@ -19,7 +19,7 @@ namespace Partition {
#define EBR_LBA_CONTAINER 0x0F
#ifdef KERNEL
ErrorOr<NonnullOwnPtr<MBRPartitionTable>> MBRPartitionTable::try_to_initialize(Kernel::StorageDevice const& device)
ErrorOr<NonnullOwnPtr<MBRPartitionTable>> MBRPartitionTable::try_to_initialize(Kernel::StorageDevice& device)
{
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) MBRPartitionTable(device)));
#else
@ -37,7 +37,7 @@ ErrorOr<NonnullOwnPtr<MBRPartitionTable>> MBRPartitionTable::try_to_initialize(N
}
#ifdef KERNEL
OwnPtr<MBRPartitionTable> MBRPartitionTable::try_to_initialize(Kernel::StorageDevice const& device, u32 start_lba)
OwnPtr<MBRPartitionTable> MBRPartitionTable::try_to_initialize(Kernel::StorageDevice& device, u32 start_lba)
{
auto table = adopt_nonnull_own_or_enomem(new (nothrow) MBRPartitionTable(device, start_lba)).release_value_but_fixme_should_propagate_errors();
#else
@ -66,7 +66,7 @@ bool MBRPartitionTable::read_boot_record()
}
#ifdef KERNEL
MBRPartitionTable::MBRPartitionTable(Kernel::StorageDevice const& device, u32 start_lba)
MBRPartitionTable::MBRPartitionTable(Kernel::StorageDevice& device, u32 start_lba)
: PartitionTable(device)
#else
MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_file, u32 start_lba)
@ -92,7 +92,7 @@ MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_
}
#ifdef KERNEL
MBRPartitionTable::MBRPartitionTable(Kernel::StorageDevice const& device)
MBRPartitionTable::MBRPartitionTable(Kernel::StorageDevice& device)
: PartitionTable(device)
#else
MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_file)

View file

@ -39,10 +39,10 @@ public:
~MBRPartitionTable();
#ifdef KERNEL
static ErrorOr<NonnullOwnPtr<MBRPartitionTable>> try_to_initialize(Kernel::StorageDevice const&);
static OwnPtr<MBRPartitionTable> try_to_initialize(Kernel::StorageDevice const&, u32 start_lba);
explicit MBRPartitionTable(Kernel::StorageDevice const&);
MBRPartitionTable(Kernel::StorageDevice const&, u32 start_lba);
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);

View file

@ -14,7 +14,7 @@
namespace Partition {
#ifdef KERNEL
PartitionTable::PartitionTable(Kernel::StorageDevice const& device)
PartitionTable::PartitionTable(Kernel::StorageDevice& device)
: m_device(device)
, m_block_size(device.block_size())
{

View file

@ -29,7 +29,7 @@ public:
protected:
#ifdef KERNEL
explicit PartitionTable(Kernel::StorageDevice const&);
explicit PartitionTable(Kernel::StorageDevice&);
NonnullRefPtr<Kernel::StorageDevice> m_device;
#else
explicit PartitionTable(NonnullRefPtr<Core::DeprecatedFile>);