mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:57:35 +00:00
Kernel/VirtIO: Make RNG device to not be a CharacterDevice
This class as a CharacterDevice really was not useful, because you couldn't even read from it. Also, the random number generator interface should be the /dev/random, so any other interface to get random numbers is generally not a good idea. Instead, let's keep this functionality as an entropy source for random numbers generation, but without exposing a device node.
This commit is contained in:
parent
c9b384da92
commit
b596af363c
2 changed files with 5 additions and 13 deletions
|
@ -10,8 +10,7 @@
|
|||
namespace Kernel {
|
||||
|
||||
UNMAP_AFTER_INIT VirtIORNG::VirtIORNG(PCI::Address address)
|
||||
: CharacterDevice(10, 183)
|
||||
, VirtIODevice(address, "VirtIORNG")
|
||||
: VirtIODevice(address, "VirtIORNG")
|
||||
{
|
||||
bool success = negotiate_features([&](auto) {
|
||||
return 0;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/RefCounted.h>
|
||||
#include <Kernel/Bus/VirtIO/VirtIO.h>
|
||||
#include <Kernel/Devices/CharacterDevice.h>
|
||||
#include <Kernel/Random.h>
|
||||
|
@ -14,19 +15,11 @@ namespace Kernel {
|
|||
|
||||
#define REQUESTQ 0
|
||||
|
||||
class VirtIORNG final : public CharacterDevice
|
||||
class VirtIORNG final
|
||||
: public RefCounted<VirtIORNG>
|
||||
, public VirtIODevice {
|
||||
public:
|
||||
virtual StringView purpose() const override { return class_name(); }
|
||||
virtual StringView class_name() const override { return m_class_name; }
|
||||
|
||||
virtual bool can_read(const FileDescription&, size_t) const override { return false; }
|
||||
virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override { return 0; }
|
||||
virtual bool can_write(const FileDescription&, size_t) const override { return false; }
|
||||
virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return 0; }
|
||||
|
||||
virtual mode_t required_mode() const override { return 0666; }
|
||||
virtual String device_name() const override { return "hwrng"; }
|
||||
virtual StringView purpose() const override { return m_class_name; }
|
||||
|
||||
VirtIORNG(PCI::Address);
|
||||
virtual ~VirtIORNG() override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue