/* * 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 friend class DeviceManagement; 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&, OpenFileDescription&, Memory::VirtualRange const&, u64 offset, int prot, bool shared) override; KResultOr> open(int options) override; protected: KCOVDevice(); virtual StringView class_name() const override { return "KCOVDevice"; } virtual bool can_read(const OpenFileDescription&, size_t) const override final { return true; } virtual bool can_write(const OpenFileDescription&, size_t) const override final { return true; } virtual void start_request(AsyncBlockDeviceRequest& request) override final { request.complete(AsyncDeviceRequest::Failure); } virtual KResultOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return EINVAL; } virtual KResultOr write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return EINVAL; } virtual KResult ioctl(OpenFileDescription&, unsigned request, Userspace arg) override; }; }