2023-03-18 09:10:33 +01:00
|
|
|
#pragma once
|
|
|
|
|
2023-06-02 21:45:31 +02:00
|
|
|
#include "fs/VFS.h"
|
2023-03-18 09:10:33 +01:00
|
|
|
#include "fs/devices/Device.h"
|
|
|
|
#include <luna/SharedPtr.h>
|
2023-05-17 19:40:37 +02:00
|
|
|
#include <sys/types.h>
|
2023-03-18 09:10:33 +01:00
|
|
|
|
|
|
|
namespace DeviceRegistry
|
|
|
|
{
|
|
|
|
enum DeviceMajorTypes : u32
|
|
|
|
{
|
|
|
|
Null = 0,
|
|
|
|
Console = 1,
|
2023-04-21 18:18:15 +02:00
|
|
|
Memory = 2,
|
|
|
|
Framebuffer = 3,
|
2023-05-17 18:15:01 +02:00
|
|
|
Disk = 4,
|
2023-06-16 21:30:50 +02:00
|
|
|
DiskPartition = 5,
|
2023-03-18 09:10:33 +01:00
|
|
|
};
|
|
|
|
|
2023-05-09 18:31:27 +02:00
|
|
|
Result<SharedPtr<Device>> fetch_special_device(u32 major, u32 minor);
|
2023-03-18 09:10:33 +01:00
|
|
|
|
2023-06-16 21:46:51 +02:00
|
|
|
Result<void> register_special_device(u32 major, u32 minor, SharedPtr<Device> device, mode_t mode = 0666);
|
2023-03-18 09:10:33 +01:00
|
|
|
|
|
|
|
Result<void> init();
|
2023-05-23 20:45:24 +02:00
|
|
|
|
|
|
|
// Used for file systems (like tmpfs) that do not have a host device.
|
|
|
|
dev_t next_null_device_id();
|
2023-06-02 21:45:31 +02:00
|
|
|
|
|
|
|
Result<SharedPtr<VFS::FileSystem>> create_devfs_instance();
|
2023-03-18 09:10:33 +01:00
|
|
|
}
|