ladybird/Kernel/Devices/NullDevice.h
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00

35 lines
1,007 B
C++

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "CharacterDevice.h"
namespace Kernel {
class NullDevice final : public CharacterDevice {
AK_MAKE_ETERNAL
public:
NullDevice();
virtual ~NullDevice() override;
static void initialize();
static NullDevice& the();
// ^Device
virtual mode_t required_mode() const override { return 0666; }
virtual String device_name() const override { return "null"; }
private:
// ^CharacterDevice
virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override;
virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
virtual bool can_write(const FileDescription&, size_t) const override { return true; }
virtual bool can_read(const FileDescription&, size_t) const override;
virtual const char* class_name() const override { return "NullDevice"; }
};
}