mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:27:35 +00:00
Kernel/Devices: Ensure appropriate locking on the Device map singleton
Devices might be removed and inserted at anytime, so let's ensure we always do these kind of operations with a good known state of the HashMap. The VirtIO code was modified to create devices outside the IRQ handler, so now it works with the new locking of the devices singleton, but a better approach might be needed later on.
This commit is contained in:
parent
21b6d84ff0
commit
009feefee0
5 changed files with 57 additions and 37 deletions
|
@ -19,6 +19,7 @@
|
|||
#include <AK/HashMap.h>
|
||||
#include <Kernel/Devices/AsyncDeviceRequest.h>
|
||||
#include <Kernel/FileSystem/File.h>
|
||||
#include <Kernel/FileSystem/SysFSComponent.h>
|
||||
#include <Kernel/Locking/Mutex.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
|
||||
|
@ -61,7 +62,7 @@ protected:
|
|||
void set_uid(UserID uid) { m_uid = uid; }
|
||||
void set_gid(GroupID gid) { m_gid = gid; }
|
||||
|
||||
static HashMap<u32, Device*>& all_devices();
|
||||
static MutexProtected<HashMap<u32, Device*>>& all_devices();
|
||||
|
||||
private:
|
||||
unsigned m_major { 0 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue