mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 23:07:34 +00: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:
parent
c837e7bbf3
commit
456f12c5c8
8 changed files with 20 additions and 20 deletions
|
@ -13,7 +13,7 @@
|
||||||
namespace Partition {
|
namespace Partition {
|
||||||
|
|
||||||
#ifdef KERNEL
|
#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)));
|
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) EBRPartitionTable(device)));
|
||||||
#else
|
#else
|
||||||
|
@ -29,7 +29,7 @@ ErrorOr<NonnullOwnPtr<EBRPartitionTable>> EBRPartitionTable::try_to_initialize(N
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KERNEL
|
#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
|
#else
|
||||||
void EBRPartitionTable::search_extended_partition(NonnullRefPtr<Core::DeprecatedFile> device, MBRPartitionTable& checked_ebr, u64 current_block_offset, size_t limit)
|
void EBRPartitionTable::search_extended_partition(NonnullRefPtr<Core::DeprecatedFile> device, MBRPartitionTable& checked_ebr, u64 current_block_offset, size_t limit)
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,7 +53,7 @@ void EBRPartitionTable::search_extended_partition(NonnullRefPtr<Core::Deprecated
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
EBRPartitionTable::EBRPartitionTable(Kernel::StorageDevice const& device)
|
EBRPartitionTable::EBRPartitionTable(Kernel::StorageDevice& device)
|
||||||
#else
|
#else
|
||||||
EBRPartitionTable::EBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device)
|
EBRPartitionTable::EBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,8 +16,8 @@ public:
|
||||||
~EBRPartitionTable();
|
~EBRPartitionTable();
|
||||||
|
|
||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
static ErrorOr<NonnullOwnPtr<EBRPartitionTable>> try_to_initialize(Kernel::StorageDevice const&);
|
static ErrorOr<NonnullOwnPtr<EBRPartitionTable>> try_to_initialize(Kernel::StorageDevice&);
|
||||||
explicit EBRPartitionTable(Kernel::StorageDevice const&);
|
explicit EBRPartitionTable(Kernel::StorageDevice&);
|
||||||
#else
|
#else
|
||||||
static ErrorOr<NonnullOwnPtr<EBRPartitionTable>> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>);
|
static ErrorOr<NonnullOwnPtr<EBRPartitionTable>> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>);
|
||||||
explicit EBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile>);
|
explicit EBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile>);
|
||||||
|
@ -30,7 +30,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef KERNEL
|
#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
|
#else
|
||||||
void search_extended_partition(NonnullRefPtr<Core::DeprecatedFile>, MBRPartitionTable&, u64, size_t limit);
|
void search_extended_partition(NonnullRefPtr<Core::DeprecatedFile>, MBRPartitionTable&, u64, size_t limit);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -49,7 +49,7 @@ struct [[gnu::packed]] GUIDPartitionHeader {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef KERNEL
|
#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)));
|
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) GUIDPartitionTable(device)));
|
||||||
#else
|
#else
|
||||||
|
@ -63,7 +63,7 @@ ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> GUIDPartitionTable::try_to_initialize
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
GUIDPartitionTable::GUIDPartitionTable(Kernel::StorageDevice const& device)
|
GUIDPartitionTable::GUIDPartitionTable(Kernel::StorageDevice& device)
|
||||||
: MBRPartitionTable(device)
|
: MBRPartitionTable(device)
|
||||||
#else
|
#else
|
||||||
GUIDPartitionTable::GUIDPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_file)
|
GUIDPartitionTable::GUIDPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_file)
|
||||||
|
|
|
@ -16,8 +16,8 @@ public:
|
||||||
virtual ~GUIDPartitionTable() = default;
|
virtual ~GUIDPartitionTable() = default;
|
||||||
|
|
||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
static ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> try_to_initialize(Kernel::StorageDevice const&);
|
static ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> try_to_initialize(Kernel::StorageDevice&);
|
||||||
explicit GUIDPartitionTable(Kernel::StorageDevice const&);
|
explicit GUIDPartitionTable(Kernel::StorageDevice&);
|
||||||
#else
|
#else
|
||||||
static ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>);
|
static ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>);
|
||||||
explicit GUIDPartitionTable(NonnullRefPtr<Core::DeprecatedFile>);
|
explicit GUIDPartitionTable(NonnullRefPtr<Core::DeprecatedFile>);
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace Partition {
|
||||||
#define EBR_LBA_CONTAINER 0x0F
|
#define EBR_LBA_CONTAINER 0x0F
|
||||||
|
|
||||||
#ifdef KERNEL
|
#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)));
|
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) MBRPartitionTable(device)));
|
||||||
#else
|
#else
|
||||||
|
@ -37,7 +37,7 @@ ErrorOr<NonnullOwnPtr<MBRPartitionTable>> MBRPartitionTable::try_to_initialize(N
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KERNEL
|
#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();
|
auto table = adopt_nonnull_own_or_enomem(new (nothrow) MBRPartitionTable(device, start_lba)).release_value_but_fixme_should_propagate_errors();
|
||||||
#else
|
#else
|
||||||
|
@ -66,7 +66,7 @@ bool MBRPartitionTable::read_boot_record()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
MBRPartitionTable::MBRPartitionTable(Kernel::StorageDevice const& device, u32 start_lba)
|
MBRPartitionTable::MBRPartitionTable(Kernel::StorageDevice& device, u32 start_lba)
|
||||||
: PartitionTable(device)
|
: PartitionTable(device)
|
||||||
#else
|
#else
|
||||||
MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_file, u32 start_lba)
|
MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_file, u32 start_lba)
|
||||||
|
@ -92,7 +92,7 @@ MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
MBRPartitionTable::MBRPartitionTable(Kernel::StorageDevice const& device)
|
MBRPartitionTable::MBRPartitionTable(Kernel::StorageDevice& device)
|
||||||
: PartitionTable(device)
|
: PartitionTable(device)
|
||||||
#else
|
#else
|
||||||
MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_file)
|
MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_file)
|
||||||
|
|
|
@ -39,10 +39,10 @@ public:
|
||||||
~MBRPartitionTable();
|
~MBRPartitionTable();
|
||||||
|
|
||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
static ErrorOr<NonnullOwnPtr<MBRPartitionTable>> try_to_initialize(Kernel::StorageDevice const&);
|
static ErrorOr<NonnullOwnPtr<MBRPartitionTable>> try_to_initialize(Kernel::StorageDevice&);
|
||||||
static OwnPtr<MBRPartitionTable> try_to_initialize(Kernel::StorageDevice const&, u32 start_lba);
|
static OwnPtr<MBRPartitionTable> try_to_initialize(Kernel::StorageDevice&, u32 start_lba);
|
||||||
explicit MBRPartitionTable(Kernel::StorageDevice const&);
|
explicit MBRPartitionTable(Kernel::StorageDevice&);
|
||||||
MBRPartitionTable(Kernel::StorageDevice const&, u32 start_lba);
|
MBRPartitionTable(Kernel::StorageDevice&, u32 start_lba);
|
||||||
#else
|
#else
|
||||||
static ErrorOr<NonnullOwnPtr<MBRPartitionTable>> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>);
|
static ErrorOr<NonnullOwnPtr<MBRPartitionTable>> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>);
|
||||||
static OwnPtr<MBRPartitionTable> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>, u32 start_lba);
|
static OwnPtr<MBRPartitionTable> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>, u32 start_lba);
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
namespace Partition {
|
namespace Partition {
|
||||||
|
|
||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
PartitionTable::PartitionTable(Kernel::StorageDevice const& device)
|
PartitionTable::PartitionTable(Kernel::StorageDevice& device)
|
||||||
: m_device(device)
|
: m_device(device)
|
||||||
, m_block_size(device.block_size())
|
, m_block_size(device.block_size())
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
explicit PartitionTable(Kernel::StorageDevice const&);
|
explicit PartitionTable(Kernel::StorageDevice&);
|
||||||
NonnullRefPtr<Kernel::StorageDevice> m_device;
|
NonnullRefPtr<Kernel::StorageDevice> m_device;
|
||||||
#else
|
#else
|
||||||
explicit PartitionTable(NonnullRefPtr<Core::DeprecatedFile>);
|
explicit PartitionTable(NonnullRefPtr<Core::DeprecatedFile>);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue