mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-15 23:52:57 +00:00
Revert "Kernel: Implement an asynchronous device request stack"
This reverts commit 2fd5ce1eb0
.
This broke booting without SMP. (PR was #3921)
This commit is contained in:
parent
70eaadc1cd
commit
501cef2bd7
Notes:
sideshowbarker
2024-07-19 01:33:15 +09:00
Author: https://github.com/awesomekling
Commit: 501cef2bd7
17 changed files with 245 additions and 803 deletions
|
@ -28,66 +28,18 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
AsyncBlockDeviceRequest::AsyncBlockDeviceRequest(Device& block_device, RequestType request_type, u32 block_index, u32 block_count, const UserOrKernelBuffer& buffer, size_t buffer_size)
|
||||
: AsyncDeviceRequest(block_device)
|
||||
, m_block_device(static_cast<BlockDevice&>(block_device))
|
||||
, m_request_type(request_type)
|
||||
, m_block_index(block_index)
|
||||
, m_block_count(block_count)
|
||||
, m_buffer(buffer)
|
||||
, m_buffer_size(buffer_size)
|
||||
{
|
||||
}
|
||||
|
||||
void AsyncBlockDeviceRequest::start()
|
||||
{
|
||||
m_block_device.start_request(*this);
|
||||
}
|
||||
|
||||
BlockDevice::~BlockDevice()
|
||||
{
|
||||
}
|
||||
|
||||
bool BlockDevice::read_block(unsigned index, UserOrKernelBuffer& buffer)
|
||||
bool BlockDevice::read_block(unsigned index, UserOrKernelBuffer& buffer) const
|
||||
{
|
||||
auto read_request = make_request<AsyncBlockDeviceRequest>(AsyncBlockDeviceRequest::Read, index, 1, buffer, 512);
|
||||
switch (read_request->wait().request_result()) {
|
||||
case AsyncDeviceRequest::Success:
|
||||
return true;
|
||||
case AsyncDeviceRequest::Failure:
|
||||
dbg() << "BlockDevice::read_block(" << index << ") IO error";
|
||||
break;
|
||||
case AsyncDeviceRequest::MemoryFault:
|
||||
dbg() << "BlockDevice::read_block(" << index << ") EFAULT";
|
||||
break;
|
||||
case AsyncDeviceRequest::Cancelled:
|
||||
dbg() << "BlockDevice::read_block(" << index << ") cancelled";
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
return false;
|
||||
return const_cast<BlockDevice*>(this)->read_blocks(index, 1, buffer);
|
||||
}
|
||||
|
||||
bool BlockDevice::write_block(unsigned index, const UserOrKernelBuffer& buffer)
|
||||
bool BlockDevice::write_block(unsigned index, const UserOrKernelBuffer& data)
|
||||
{
|
||||
auto write_request = make_request<AsyncBlockDeviceRequest>(AsyncBlockDeviceRequest::Write, index, 1, buffer, 512);
|
||||
switch (write_request->wait().request_result()) {
|
||||
case AsyncDeviceRequest::Success:
|
||||
return true;
|
||||
case AsyncDeviceRequest::Failure:
|
||||
dbg() << "BlockDevice::write_block(" << index << ") IO error";
|
||||
break;
|
||||
case AsyncDeviceRequest::MemoryFault:
|
||||
dbg() << "BlockDevice::write_block(" << index << ") EFAULT";
|
||||
break;
|
||||
case AsyncDeviceRequest::Cancelled:
|
||||
dbg() << "BlockDevice::write_block(" << index << ") cancelled";
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
return false;
|
||||
return write_blocks(index, 1, data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue