2023-03-30 21:19:16 +02:00
|
|
|
#pragma once
|
|
|
|
#include "fs/devices/DeviceRegistry.h"
|
|
|
|
|
|
|
|
class ZeroDevice : public Device
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Initializer for DeviceRegistry.
|
2023-05-09 18:31:27 +02:00
|
|
|
static Result<void> create();
|
2023-03-30 21:19:16 +02:00
|
|
|
|
|
|
|
Result<usize> read(u8* buf, usize, usize length) const override
|
|
|
|
{
|
|
|
|
__builtin_memset(buf, 0, length);
|
|
|
|
|
|
|
|
return length;
|
|
|
|
}
|
|
|
|
|
|
|
|
Result<usize> write(const u8*, usize, usize) override
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool blocking() const override
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~ZeroDevice() = default;
|
|
|
|
};
|