1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:47:35 +00:00

Kernel/Storage: Remove the ramdisk implementation

Nobody uses this because the x86 prekernel environment is corrupting the
ramdisk image prior to running the actual kernel. In the future we can
ensure that the prekernel doesn't corrupt the ramdisk if we want to
bring support back. In addition to that, we could just use a RAM based
filesystem to load whatever is needed like in Linux, without the need of
additional filesystem driver.

For the mentioned corruption problem, look at issue #9893.
This commit is contained in:
Liav A 2022-08-10 22:08:41 +03:00 committed by Andreas Kling
parent 37f527be9c
commit 4e0f85432a
9 changed files with 0 additions and 227 deletions

View file

@ -1,67 +0,0 @@
/*
* Copyright (c) 2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/OwnPtr.h>
#include <AK/Types.h>
#include <Kernel/Library/LockRefPtr.h>
#include <Kernel/Storage/Ramdisk/Controller.h>
namespace Kernel {
NonnullLockRefPtr<RamdiskController> RamdiskController::initialize()
{
return adopt_lock_ref(*new RamdiskController());
}
bool RamdiskController::reset()
{
TODO();
}
bool RamdiskController::shutdown()
{
TODO();
}
size_t RamdiskController::devices_count() const
{
return m_devices.size();
}
void RamdiskController::complete_current_request(AsyncDeviceRequest::RequestResult)
{
VERIFY_NOT_REACHED();
}
RamdiskController::RamdiskController()
: StorageController(0)
{
// Populate ramdisk controllers from Multiboot boot modules, if any.
size_t count = 0;
MM.for_each_used_memory_range([&](auto& used_memory_range) {
if (used_memory_range.type == Memory::UsedMemoryRangeType::BootModule) {
size_t length = Memory::page_round_up(used_memory_range.end.get()).release_value_but_fixme_should_propagate_errors() - used_memory_range.start.get();
auto region_or_error = MM.allocate_kernel_region(used_memory_range.start, length, "Ramdisk"sv, Memory::Region::Access::ReadWrite);
if (region_or_error.is_error()) {
dmesgln("RamdiskController: Failed to allocate kernel region of size {}", length);
} else {
m_devices.append(RamdiskDevice::create(*this, region_or_error.release_value(), 6, count));
}
count++;
}
});
}
RamdiskController::~RamdiskController() = default;
LockRefPtr<StorageDevice> RamdiskController::device(u32 index) const
{
if (index >= m_devices.size())
return nullptr;
return m_devices[index];
}
}