Skip to content

Commit

Permalink
Kernel: Add virtio-blk devices to DeviceManager
Browse files Browse the repository at this point in the history
This was erroneously not done, because the VirtIOBlockDevice is created
using a raw new statement, and not using
DeviceManager::try_create_device.
  • Loading branch information
sleirsgoevy committed Jul 11, 2024
1 parent 3961002 commit 4a67996
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Kernel/Devices/Storage/VirtIO/VirtIOBlockDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ UNMAP_AFTER_INIT ErrorOr<void> VirtIOBlockDevice::initialize_virtio_resources()
}));
TRY(setup_queues(1)); // REQUESTQ
finish_init();
return {};

// This device is not added to DeviceManagement, as we've bypassed try_create_device, so we need to add it ourselves
// We can't call the method directly, as it is redeclared as private in the StorageDevice class, thus the cast
return static_cast<Kernel::Device*>(this)->after_inserting();
}

ErrorOr<void> VirtIOBlockDevice::handle_device_config_change()
Expand Down

0 comments on commit 4a67996

Please sign in to comment.