/* * Copyright (c) 2018-2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include namespace Kernel { class ConsoleDevice final : public CharacterDevice { friend class DeviceManagement; public: static NonnullRefPtr must_create(); virtual ~ConsoleDevice() override; // ^CharacterDevice virtual bool can_read(const Kernel::OpenFileDescription&, size_t) const override; virtual bool can_write(const Kernel::OpenFileDescription&, size_t) const override { return true; } virtual ErrorOr read(OpenFileDescription&, u64, Kernel::UserOrKernelBuffer&, size_t) override; virtual ErrorOr write(OpenFileDescription&, u64, const Kernel::UserOrKernelBuffer&, size_t) override; virtual StringView class_name() const override { return "Console"sv; } void put_char(char); const CircularQueue& logbuffer() const { return m_logbuffer; } private: ConsoleDevice(); CircularQueue m_logbuffer; }; }