/* * Copyright (c) 2021, Patrick Meyer * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include namespace Kernel { class KCOVDevice final : public BlockDevice { AK_MAKE_ETERNAL public: static HashMap* proc_instance; static HashMap* thread_instance; static NonnullRefPtr must_create(); static void free_thread(); static void free_process(); // ^File KResultOr mmap(Process&, FileDescription&, Memory::VirtualRange const&, u64 offset, int prot, bool shared) override; KResultOr> open(int options) override; // ^Device virtual mode_t required_mode() const override { return 0660; } virtual String device_name() const override; protected: virtual StringView class_name() const override { return "KCOVDevice"; } virtual bool can_read(const FileDescription&, size_t) const override final { return true; } virtual bool can_write(const FileDescription&, size_t) const override final { return true; } virtual void start_request(AsyncBlockDeviceRequest& request) override final { request.complete(AsyncDeviceRequest::Failure); } virtual KResultOr read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override { return EINVAL; } virtual KResultOr write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return EINVAL; } virtual KResult ioctl(FileDescription&, unsigned request, Userspace arg) override; private: KCOVDevice(); }; }