ladybird/Kernel/Devices/RandomDevice.h

32 lines
901 B
C
Raw Normal View History

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
2018-10-14 22:44:54 +00:00
#pragma once
#include <Kernel/Devices/CharacterDevice.h>
2018-10-14 22:44:54 +00:00
namespace Kernel {
2018-10-14 22:44:54 +00:00
class RandomDevice final : public CharacterDevice {
friend class DeviceManagement;
2018-10-14 22:44:54 +00:00
public:
static NonnullLockRefPtr<RandomDevice> must_create();
virtual ~RandomDevice() override;
2018-10-14 22:44:54 +00:00
private:
RandomDevice();
// ^CharacterDevice
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
2022-04-01 17:58:27 +00:00
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, UserOrKernelBuffer const&, size_t) override;
virtual bool can_read(OpenFileDescription const&, u64) const override;
virtual bool can_write(OpenFileDescription const&, u64) const override { return true; }
virtual StringView class_name() const override { return "RandomDevice"sv; }
2018-10-14 22:44:54 +00:00
};
}