diff options
author | Andreas Kling <kling@serenityos.org> | 2021-07-11 01:46:09 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-11 01:46:59 +0200 |
commit | c9f6786e8b726dfe3d8d4ee13e34be561c093fe5 (patch) | |
tree | 0252a8e9b9bae62762c466e33e3b1e462fe54e43 /Kernel | |
parent | fa9111ac463d645bb801140b1e121d2f00c0efa1 (diff) | |
download | serenity-c9f6786e8b726dfe3d8d4ee13e34be561c093fe5.zip |
Kernel: Make various T::class_name() and similar return StringView
Instead of returning char const*, we can also give you a StringView.
Diffstat (limited to 'Kernel')
58 files changed, 72 insertions, 72 deletions
diff --git a/Kernel/ACPI/DynamicParser.h b/Kernel/ACPI/DynamicParser.h index 3bf467718e..560edb6b06 100644 --- a/Kernel/ACPI/DynamicParser.h +++ b/Kernel/ACPI/DynamicParser.h @@ -27,7 +27,7 @@ public: virtual void disable_aml_interpretation() override; virtual void try_acpi_shutdown() override; virtual bool can_shutdown() override { return true; } - virtual const char* purpose() const override { return "ACPI Parser"; } + virtual StringView purpose() const override { return "ACPI Parser"; } protected: explicit DynamicParser(PhysicalAddress rsdp); diff --git a/Kernel/Bus/USB/UHCIController.h b/Kernel/Bus/USB/UHCIController.h index a4ab4b5a60..a25da43357 100644 --- a/Kernel/Bus/USB/UHCIController.h +++ b/Kernel/Bus/USB/UHCIController.h @@ -29,7 +29,7 @@ public: virtual ~UHCIController() override; - virtual const char* purpose() const override { return "UHCI"; } + virtual StringView purpose() const override { return "UHCI"; } void reset(); void stop(); diff --git a/Kernel/ConsoleDevice.h b/Kernel/ConsoleDevice.h index a66435f095..c64d6fb575 100644 --- a/Kernel/ConsoleDevice.h +++ b/Kernel/ConsoleDevice.h @@ -27,7 +27,7 @@ public: virtual bool can_write(const Kernel::FileDescription&, size_t) const override { return true; } virtual Kernel::KResultOr<size_t> read(FileDescription&, u64, Kernel::UserOrKernelBuffer&, size_t) override; virtual Kernel::KResultOr<size_t> write(FileDescription&, u64, const Kernel::UserOrKernelBuffer&, size_t) override; - virtual const char* class_name() const override { return "Console"; } + virtual StringView class_name() const override { return "Console"; } void put_char(char); diff --git a/Kernel/Devices/FullDevice.h b/Kernel/Devices/FullDevice.h index 2fb8d4e785..ada167cca9 100644 --- a/Kernel/Devices/FullDevice.h +++ b/Kernel/Devices/FullDevice.h @@ -28,7 +28,7 @@ private: virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override; virtual bool can_read(const FileDescription&, size_t) const override; virtual bool can_write(const FileDescription&, size_t) const override { return true; } - virtual const char* class_name() const override { return "FullDevice"; } + virtual StringView class_name() const override { return "FullDevice"; } }; } diff --git a/Kernel/Devices/HID/KeyboardDevice.h b/Kernel/Devices/HID/KeyboardDevice.h index 23964f6908..fc20140bd9 100644 --- a/Kernel/Devices/HID/KeyboardDevice.h +++ b/Kernel/Devices/HID/KeyboardDevice.h @@ -54,7 +54,7 @@ protected: mutable SpinLock<u8> m_queue_lock; CircularQueue<Event, 16> m_queue; // ^CharacterDevice - virtual const char* class_name() const override { return "KeyboardDevice"; } + virtual StringView class_name() const override { return "KeyboardDevice"; } u8 m_modifiers { 0 }; bool m_caps_lock_to_ctrl_pressed { false }; diff --git a/Kernel/Devices/HID/MouseDevice.h b/Kernel/Devices/HID/MouseDevice.h index bc0d112301..f6f2e2982d 100644 --- a/Kernel/Devices/HID/MouseDevice.h +++ b/Kernel/Devices/HID/MouseDevice.h @@ -39,7 +39,7 @@ public: protected: MouseDevice(); // ^CharacterDevice - virtual const char* class_name() const override { return "MouseDevice"; } + virtual StringView class_name() const override { return "MouseDevice"; } mutable SpinLock<u8> m_queue_lock; CircularQueue<MousePacket, 100> m_queue; diff --git a/Kernel/Devices/HID/PS2KeyboardDevice.h b/Kernel/Devices/HID/PS2KeyboardDevice.h index ceed7793d6..8fb9c285cd 100644 --- a/Kernel/Devices/HID/PS2KeyboardDevice.h +++ b/Kernel/Devices/HID/PS2KeyboardDevice.h @@ -26,7 +26,7 @@ public: virtual ~PS2KeyboardDevice() override; bool initialize(); - virtual const char* purpose() const override { return class_name(); } + virtual StringView purpose() const override { return class_name(); } // ^I8042Device virtual void irq_handle_byte_read(u8 byte) override; @@ -42,7 +42,7 @@ private: virtual bool handle_irq(const RegisterState&) override; // ^CharacterDevice - virtual const char* class_name() const override { return "KeyboardDevice"; } + virtual StringView class_name() const override { return "KeyboardDevice"; } }; } diff --git a/Kernel/Devices/HID/PS2MouseDevice.h b/Kernel/Devices/HID/PS2MouseDevice.h index fa736c541e..1182ce2946 100644 --- a/Kernel/Devices/HID/PS2MouseDevice.h +++ b/Kernel/Devices/HID/PS2MouseDevice.h @@ -23,7 +23,7 @@ public: virtual ~PS2MouseDevice() override; - virtual const char* purpose() const override { return class_name(); } + virtual StringView purpose() const override { return class_name(); } // ^I8042Device virtual void irq_handle_byte_read(u8 byte) override; diff --git a/Kernel/Devices/MemoryDevice.h b/Kernel/Devices/MemoryDevice.h index 21163ec727..d5aacf0191 100644 --- a/Kernel/Devices/MemoryDevice.h +++ b/Kernel/Devices/MemoryDevice.h @@ -27,7 +27,7 @@ public: private: MemoryDevice(); - virtual const char* class_name() const override { return "MemoryDevice"; } + virtual StringView class_name() const override { return "MemoryDevice"; } virtual bool can_read(const FileDescription&, size_t) const override { return true; } virtual bool can_write(const FileDescription&, size_t) const override { return false; } virtual bool is_seekable() const override { return true; } diff --git a/Kernel/Devices/NullDevice.h b/Kernel/Devices/NullDevice.h index 31b954928a..42a762aad3 100644 --- a/Kernel/Devices/NullDevice.h +++ b/Kernel/Devices/NullDevice.h @@ -29,7 +29,7 @@ private: 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"; } + virtual StringView class_name() const override { return "NullDevice"; } }; } diff --git a/Kernel/Devices/RandomDevice.h b/Kernel/Devices/RandomDevice.h index e553b5dc8c..8b1243f9fa 100644 --- a/Kernel/Devices/RandomDevice.h +++ b/Kernel/Devices/RandomDevice.h @@ -28,7 +28,7 @@ private: virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override; virtual bool can_read(const FileDescription&, size_t) const override; virtual bool can_write(const FileDescription&, size_t) const override { return true; } - virtual const char* class_name() const override { return "RandomDevice"; } + virtual StringView class_name() const override { return "RandomDevice"; } }; } diff --git a/Kernel/Devices/SB16.h b/Kernel/Devices/SB16.h index 9c248716e6..af4e02db8b 100644 --- a/Kernel/Devices/SB16.h +++ b/Kernel/Devices/SB16.h @@ -32,7 +32,7 @@ public: 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 const char* purpose() const override { return class_name(); } + virtual StringView purpose() const override { return class_name(); } // ^Device virtual mode_t required_mode() const override { return 0220; } @@ -43,7 +43,7 @@ private: virtual bool handle_irq(const RegisterState&) override; // ^CharacterDevice - virtual const char* class_name() const override { return "SB16"; } + virtual StringView class_name() const override { return "SB16"; } void initialize(); void wait_for_irq(); diff --git a/Kernel/Devices/SerialDevice.h b/Kernel/Devices/SerialDevice.h index fc98872586..7e0e77c01e 100644 --- a/Kernel/Devices/SerialDevice.h +++ b/Kernel/Devices/SerialDevice.h @@ -112,7 +112,7 @@ private: SerialDevice(IOAddress base_addr, unsigned minor); // ^CharacterDevice - virtual const char* class_name() const override { return "SerialDevice"; } + virtual StringView class_name() const override { return "SerialDevice"; } void initialize(); void set_interrupts(bool interrupt_enable); diff --git a/Kernel/Devices/ZeroDevice.h b/Kernel/Devices/ZeroDevice.h index df3699314a..d86c492f0a 100644 --- a/Kernel/Devices/ZeroDevice.h +++ b/Kernel/Devices/ZeroDevice.h @@ -27,7 +27,7 @@ private: virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override; virtual bool can_read(const FileDescription&, size_t) const override; virtual bool can_write(const FileDescription&, size_t) const override { return true; } - virtual const char* class_name() const override { return "ZeroDevice"; } + virtual StringView class_name() const override { return "ZeroDevice"; } }; } diff --git a/Kernel/FileSystem/AnonymousFile.h b/Kernel/FileSystem/AnonymousFile.h index 8496108ace..ac0fa0c5e5 100644 --- a/Kernel/FileSystem/AnonymousFile.h +++ b/Kernel/FileSystem/AnonymousFile.h @@ -22,7 +22,7 @@ public: virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, u64 offset, int prot, bool shared) override; private: - virtual const char* class_name() const override { return "AnonymousFile"; } + virtual StringView class_name() const override { return "AnonymousFile"; } virtual String absolute_path(const FileDescription&) const override { return ":anonymous-file:"; } virtual bool can_read(const FileDescription&, size_t) const override { return false; } virtual bool can_write(const FileDescription&, size_t) const override { return false; } diff --git a/Kernel/FileSystem/FIFO.h b/Kernel/FileSystem/FIFO.h index 52b6343e9d..2a3da33efc 100644 --- a/Kernel/FileSystem/FIFO.h +++ b/Kernel/FileSystem/FIFO.h @@ -46,7 +46,7 @@ private: virtual bool can_read(const FileDescription&, size_t) const override; virtual bool can_write(const FileDescription&, size_t) const override; virtual String absolute_path(const FileDescription&) const override; - virtual const char* class_name() const override { return "FIFO"; } + virtual StringView class_name() const override { return "FIFO"; } virtual bool is_fifo() const override { return true; } explicit FIFO(uid_t); diff --git a/Kernel/FileSystem/File.h b/Kernel/FileSystem/File.h index 32de5c75a3..f7424e6aaa 100644 --- a/Kernel/FileSystem/File.h +++ b/Kernel/FileSystem/File.h @@ -97,7 +97,7 @@ public: virtual KResult chown(FileDescription&, uid_t, gid_t) { return EBADF; } virtual KResult chmod(FileDescription&, mode_t) { return EBADF; } - virtual const char* class_name() const = 0; + virtual StringView class_name() const = 0; virtual bool is_seekable() const { return false; } diff --git a/Kernel/FileSystem/InodeFile.h b/Kernel/FileSystem/InodeFile.h index 658a03a397..7c556fcd82 100644 --- a/Kernel/FileSystem/InodeFile.h +++ b/Kernel/FileSystem/InodeFile.h @@ -42,7 +42,7 @@ public: virtual KResult chown(FileDescription&, uid_t, gid_t) override; virtual KResult chmod(FileDescription&, mode_t) override; - virtual const char* class_name() const override { return "InodeFile"; } + virtual StringView class_name() const override { return "InodeFile"; } virtual bool is_seekable() const override { return true; } virtual bool is_inode() const override { return true; } diff --git a/Kernel/FileSystem/InodeWatcher.h b/Kernel/FileSystem/InodeWatcher.h index 5b1ab5420e..01c0fa3528 100644 --- a/Kernel/FileSystem/InodeWatcher.h +++ b/Kernel/FileSystem/InodeWatcher.h @@ -55,7 +55,7 @@ public: virtual KResult close() override; virtual String absolute_path(const FileDescription&) const override; - virtual const char* class_name() const override { return "InodeWatcher"; }; + virtual StringView class_name() const override { return "InodeWatcher"; }; virtual bool is_inode_watcher() const override { return true; } void notify_inode_event(Badge<Inode>, InodeIdentifier, InodeWatcherEvent::Type, String const& name = {}); diff --git a/Kernel/Graphics/FramebufferDevice.h b/Kernel/Graphics/FramebufferDevice.h index 55dfe90302..ebe3bbcc77 100644 --- a/Kernel/Graphics/FramebufferDevice.h +++ b/Kernel/Graphics/FramebufferDevice.h @@ -38,7 +38,7 @@ public: private: // ^File - virtual const char* class_name() const override { return "FramebufferDevice"; } + virtual StringView class_name() const override { return "FramebufferDevice"; } 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; } diff --git a/Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.h b/Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.h index 323feecd93..6955d51d0d 100644 --- a/Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.h +++ b/Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.h @@ -51,7 +51,7 @@ public: u8* framebuffer_data(); private: - virtual const char* class_name() const override { return "VirtIOFrameBuffer"; } + virtual StringView class_name() const override { return "VirtIOFrameBuffer"; } VirtIOGPURespDisplayInfo::VirtIOGPUDisplayOne const& display_info() const; VirtIOGPURespDisplayInfo::VirtIOGPUDisplayOne& display_info(); diff --git a/Kernel/Interrupts/APIC.cpp b/Kernel/Interrupts/APIC.cpp index d56743e8de..5122f52fe7 100644 --- a/Kernel/Interrupts/APIC.cpp +++ b/Kernel/Interrupts/APIC.cpp @@ -76,8 +76,8 @@ public: virtual bool eoi() override; virtual HandlerType type() const override { return HandlerType::IRQHandler; } - virtual const char* purpose() const override { return "IPI Handler"; } - virtual const char* controller() const override { return nullptr; } + virtual StringView purpose() const override { return "IPI Handler"; } + virtual StringView controller() const override { return nullptr; } virtual size_t sharing_devices_count() const override { return 0; } virtual bool is_shared_handler() const override { return false; } @@ -107,8 +107,8 @@ public: virtual bool eoi() override; virtual HandlerType type() const override { return HandlerType::IRQHandler; } - virtual const char* purpose() const override { return "SMP Error Handler"; } - virtual const char* controller() const override { return nullptr; } + virtual StringView purpose() const override { return "SMP Error Handler"; } + virtual StringView controller() const override { return nullptr; } virtual size_t sharing_devices_count() const override { return 0; } virtual bool is_shared_handler() const override { return false; } diff --git a/Kernel/Interrupts/GenericInterruptHandler.h b/Kernel/Interrupts/GenericInterruptHandler.h index 4acdc47a7f..3f68ae8ee5 100644 --- a/Kernel/Interrupts/GenericInterruptHandler.h +++ b/Kernel/Interrupts/GenericInterruptHandler.h @@ -45,8 +45,8 @@ public: virtual bool is_sharing_with_others() const = 0; virtual HandlerType type() const = 0; - virtual const char* purpose() const = 0; - virtual const char* controller() const = 0; + virtual StringView purpose() const = 0; + virtual StringView controller() const = 0; virtual bool eoi() = 0; ALWAYS_INLINE void increment_invoking_counter() diff --git a/Kernel/Interrupts/IRQHandler.h b/Kernel/Interrupts/IRQHandler.h index ffd8ec9f52..2dd6361353 100644 --- a/Kernel/Interrupts/IRQHandler.h +++ b/Kernel/Interrupts/IRQHandler.h @@ -27,8 +27,8 @@ public: virtual bool eoi() override; virtual HandlerType type() const override { return HandlerType::IRQHandler; } - virtual const char* purpose() const override { return "IRQ Handler"; } - virtual const char* controller() const override { return m_responsible_irq_controller->model(); } + virtual StringView purpose() const override { return "IRQ Handler"; } + virtual StringView controller() const override { return m_responsible_irq_controller->model(); } virtual size_t sharing_devices_count() const override { return 0; } virtual bool is_shared_handler() const override { return false; } diff --git a/Kernel/Interrupts/SharedIRQHandler.h b/Kernel/Interrupts/SharedIRQHandler.h index c71d69b5ff..de7e363fcb 100644 --- a/Kernel/Interrupts/SharedIRQHandler.h +++ b/Kernel/Interrupts/SharedIRQHandler.h @@ -33,8 +33,8 @@ public: virtual bool is_sharing_with_others() const override { return false; } virtual HandlerType type() const override { return HandlerType::SharedIRQHandler; } - virtual const char* purpose() const override { return "Shared IRQ Handler"; } - virtual const char* controller() const override { return m_responsible_irq_controller->model(); } + virtual StringView purpose() const override { return "Shared IRQ Handler"; } + virtual StringView controller() const override { return m_responsible_irq_controller->model(); } private: void enable_interrupt_vector(); diff --git a/Kernel/Interrupts/SpuriousInterruptHandler.cpp b/Kernel/Interrupts/SpuriousInterruptHandler.cpp index fd9ec678e7..ec6ee74589 100644 --- a/Kernel/Interrupts/SpuriousInterruptHandler.cpp +++ b/Kernel/Interrupts/SpuriousInterruptHandler.cpp @@ -38,7 +38,7 @@ bool SpuriousInterruptHandler::eoi() return false; } -const char* SpuriousInterruptHandler::purpose() const +StringView SpuriousInterruptHandler::purpose() const { if (!m_real_handler) return "Spurious Interrupt Handler"; @@ -87,7 +87,7 @@ void SpuriousInterruptHandler::disable_interrupt_vector() m_responsible_irq_controller->disable(*this); } -const char* SpuriousInterruptHandler::controller() const +StringView SpuriousInterruptHandler::controller() const { if (m_responsible_irq_controller->type() == IRQControllerType::i82093AA) return ""; diff --git a/Kernel/Interrupts/SpuriousInterruptHandler.h b/Kernel/Interrupts/SpuriousInterruptHandler.h index 90e58a1f16..129a0f6683 100644 --- a/Kernel/Interrupts/SpuriousInterruptHandler.h +++ b/Kernel/Interrupts/SpuriousInterruptHandler.h @@ -29,8 +29,8 @@ public: virtual bool is_sharing_with_others() const override { return false; } virtual HandlerType type() const override { return HandlerType::SpuriousInterruptHandler; } - virtual const char* purpose() const override; - virtual const char* controller() const override; + virtual StringView purpose() const override; + virtual StringView controller() const override; private: void enable_interrupt_vector(); diff --git a/Kernel/Interrupts/UnhandledInterruptHandler.h b/Kernel/Interrupts/UnhandledInterruptHandler.h index 618edc83ed..ba846647d4 100644 --- a/Kernel/Interrupts/UnhandledInterruptHandler.h +++ b/Kernel/Interrupts/UnhandledInterruptHandler.h @@ -21,8 +21,8 @@ public: [[noreturn]] virtual bool eoi() override; virtual HandlerType type() const override { return HandlerType::UnhandledInterruptHandler; } - virtual const char* purpose() const override { return "Unhandled Interrupt Handler"; } - virtual const char* controller() const override { VERIFY_NOT_REACHED(); } + virtual StringView purpose() const override { return "Unhandled Interrupt Handler"; } + virtual StringView controller() const override { VERIFY_NOT_REACHED(); } virtual size_t sharing_devices_count() const override { return 0; } virtual bool is_shared_handler() const override { return false; } diff --git a/Kernel/Net/E1000ENetworkAdapter.h b/Kernel/Net/E1000ENetworkAdapter.h index 5d3ee68710..9289adc917 100644 --- a/Kernel/Net/E1000ENetworkAdapter.h +++ b/Kernel/Net/E1000ENetworkAdapter.h @@ -27,7 +27,7 @@ public: virtual ~E1000ENetworkAdapter() override; - virtual const char* purpose() const override { return class_name(); } + virtual StringView purpose() const override { return class_name(); } private: E1000ENetworkAdapter(PCI::Address, u8 irq); diff --git a/Kernel/Net/E1000NetworkAdapter.h b/Kernel/Net/E1000NetworkAdapter.h index 71d5566b47..74dc5106b2 100644 --- a/Kernel/Net/E1000NetworkAdapter.h +++ b/Kernel/Net/E1000NetworkAdapter.h @@ -29,7 +29,7 @@ public: virtual void send_raw(ReadonlyBytes) override; virtual bool link_up() override; - virtual const char* purpose() const override { return class_name(); } + virtual StringView purpose() const override { return class_name(); } protected: void setup_interrupts(); diff --git a/Kernel/Net/IPv4Socket.h b/Kernel/Net/IPv4Socket.h index f089cb409f..19005f683b 100644 --- a/Kernel/Net/IPv4Socket.h +++ b/Kernel/Net/IPv4Socket.h @@ -75,7 +75,7 @@ public: protected: IPv4Socket(int type, int protocol); - virtual const char* class_name() const override { return "IPv4Socket"; } + virtual StringView class_name() const override { return "IPv4Socket"; } PortAllocationResult allocate_local_port_if_needed(); diff --git a/Kernel/Net/LocalSocket.h b/Kernel/Net/LocalSocket.h index f86707cc23..818608d8a5 100644 --- a/Kernel/Net/LocalSocket.h +++ b/Kernel/Net/LocalSocket.h @@ -52,7 +52,7 @@ public: private: explicit LocalSocket(int type); - virtual const char* class_name() const override { return "LocalSocket"; } + virtual StringView class_name() const override { return "LocalSocket"; } virtual bool is_local() const override { return true; } bool has_attached_peer(const FileDescription&) const; DoubleBuffer* receive_buffer_for(FileDescription&); diff --git a/Kernel/Net/NE2000NetworkAdapter.h b/Kernel/Net/NE2000NetworkAdapter.h index 555deaff54..cb58071f63 100644 --- a/Kernel/Net/NE2000NetworkAdapter.h +++ b/Kernel/Net/NE2000NetworkAdapter.h @@ -25,7 +25,7 @@ public: virtual void send_raw(ReadonlyBytes) override; virtual bool link_up() override { return m_link_up; } - virtual const char* purpose() const override { return class_name(); } + virtual StringView purpose() const override { return class_name(); } private: NE2000NetworkAdapter(PCI::Address, u8 irq); diff --git a/Kernel/Net/RTL8139NetworkAdapter.h b/Kernel/Net/RTL8139NetworkAdapter.h index 3b4b8ca3b7..8ab694e66a 100644 --- a/Kernel/Net/RTL8139NetworkAdapter.h +++ b/Kernel/Net/RTL8139NetworkAdapter.h @@ -27,7 +27,7 @@ public: virtual void send_raw(ReadonlyBytes) override; virtual bool link_up() override { return m_link_up; } - virtual const char* purpose() const override { return class_name(); } + virtual StringView purpose() const override { return class_name(); } private: RTL8139NetworkAdapter(PCI::Address, u8 irq); diff --git a/Kernel/Net/RTL8168NetworkAdapter.h b/Kernel/Net/RTL8168NetworkAdapter.h index 180279c3d3..079fad897c 100644 --- a/Kernel/Net/RTL8168NetworkAdapter.h +++ b/Kernel/Net/RTL8168NetworkAdapter.h @@ -27,7 +27,7 @@ public: virtual void send_raw(ReadonlyBytes) override; virtual bool link_up() override { return m_link_up; } - virtual const char* purpose() const override { return class_name(); } + virtual StringView purpose() const override { return class_name(); } private: // FIXME: should this be increased? (maximum allowed here is 1024) - memory usage vs packet loss chance tradeoff diff --git a/Kernel/Net/Socket.h b/Kernel/Net/Socket.h index c2ee27ea69..85a4f771a6 100644 --- a/Kernel/Net/Socket.h +++ b/Kernel/Net/Socket.h @@ -124,7 +124,7 @@ protected: size_t backlog() const { return m_backlog; } void set_backlog(size_t backlog) { m_backlog = backlog; } - virtual const char* class_name() const override { return "Socket"; } + virtual StringView class_name() const override { return "Socket"; } virtual void shut_down_for_reading() { } virtual void shut_down_for_writing() { } diff --git a/Kernel/Net/TCPSocket.h b/Kernel/Net/TCPSocket.h index 024543139f..5441a991c7 100644 --- a/Kernel/Net/TCPSocket.h +++ b/Kernel/Net/TCPSocket.h @@ -164,7 +164,7 @@ protected: private: explicit TCPSocket(int protocol); - virtual const char* class_name() const override { return "TCPSocket"; } + virtual StringView class_name() const override { return "TCPSocket"; } static NetworkOrdered<u16> compute_tcp_checksum(const IPv4Address& source, const IPv4Address& destination, const TCPPacket&, u16 payload_size); diff --git a/Kernel/Net/UDPSocket.h b/Kernel/Net/UDPSocket.h index dd4ce967bb..338682ce5f 100644 --- a/Kernel/Net/UDPSocket.h +++ b/Kernel/Net/UDPSocket.h @@ -21,7 +21,7 @@ public: private: explicit UDPSocket(int protocol); - virtual const char* class_name() const override { return "UDPSocket"; } + virtual StringView class_name() const override { return "UDPSocket"; } static Lockable<HashMap<u16, UDPSocket*>>& sockets_by_port(); virtual KResultOr<size_t> protocol_receive(ReadonlyBytes raw_ipv4_packet, UserOrKernelBuffer& buffer, size_t buffer_size, int flags) override; diff --git a/Kernel/Storage/AHCIPortHandler.h b/Kernel/Storage/AHCIPortHandler.h index 1d5fe52321..36c1fe071a 100644 --- a/Kernel/Storage/AHCIPortHandler.h +++ b/Kernel/Storage/AHCIPortHandler.h @@ -37,7 +37,7 @@ public: virtual ~AHCIPortHandler() override; RefPtr<StorageDevice> device_at_port(size_t port_index) const; - virtual const char* purpose() const override { return "SATA Port Handler"; } + virtual StringView purpose() const override { return "SATA Port Handler"; } AHCI::HBADefinedCapabilities hba_capabilities() const; NonnullRefPtr<AHCIController> hba_controller() const { return m_parent_controller; } diff --git a/Kernel/Storage/IDEChannel.h b/Kernel/Storage/IDEChannel.h index 96f9f6dc4a..73c427e689 100644 --- a/Kernel/Storage/IDEChannel.h +++ b/Kernel/Storage/IDEChannel.h @@ -99,7 +99,7 @@ public: RefPtr<StorageDevice> master_device() const; RefPtr<StorageDevice> slave_device() const; - virtual const char* purpose() const override { return "PATA Channel"; } + virtual StringView purpose() const override { return "PATA Channel"; } virtual bool is_dma_enabled() const { return false; } diff --git a/Kernel/Storage/PATADiskDevice.cpp b/Kernel/Storage/PATADiskDevice.cpp index 078d69e53f..928a2f0c51 100644 --- a/Kernel/Storage/PATADiskDevice.cpp +++ b/Kernel/Storage/PATADiskDevice.cpp @@ -32,7 +32,7 @@ UNMAP_AFTER_INIT PATADiskDevice::~PATADiskDevice() { } -const char* PATADiskDevice::class_name() const +StringView PATADiskDevice::class_name() const { return "PATADiskDevice"; } diff --git a/Kernel/Storage/PATADiskDevice.h b/Kernel/Storage/PATADiskDevice.h index e91807ffe2..1d2fc24d13 100644 --- a/Kernel/Storage/PATADiskDevice.h +++ b/Kernel/Storage/PATADiskDevice.h @@ -48,7 +48,7 @@ private: PATADiskDevice(const IDEController&, IDEChannel&, DriveType, InterfaceType, u16, u64); // ^DiskDevice - virtual const char* class_name() const override; + virtual StringView class_name() const override; bool is_slave() const; diff --git a/Kernel/Storage/Partition/DiskPartition.cpp b/Kernel/Storage/Partition/DiskPartition.cpp index 9d4dfbc1f4..d3d0140363 100644 --- a/Kernel/Storage/Partition/DiskPartition.cpp +++ b/Kernel/Storage/Partition/DiskPartition.cpp @@ -72,7 +72,7 @@ String DiskPartition::device_name() const return String::formatted("{}{}", m_device->device_name(), partition_index + 1); } -const char* DiskPartition::class_name() const +StringView DiskPartition::class_name() const { return "DiskPartition"; } diff --git a/Kernel/Storage/Partition/DiskPartition.h b/Kernel/Storage/Partition/DiskPartition.h index 435a28010e..c7a473b9b4 100644 --- a/Kernel/Storage/Partition/DiskPartition.h +++ b/Kernel/Storage/Partition/DiskPartition.h @@ -32,7 +32,7 @@ public: const DiskPartitionMetadata& metadata() const; private: - virtual const char* class_name() const override; + virtual StringView class_name() const override; DiskPartition(BlockDevice&, unsigned, DiskPartitionMetadata); diff --git a/Kernel/Storage/RamdiskDevice.cpp b/Kernel/Storage/RamdiskDevice.cpp index 47b44a8a88..92d307f31b 100644 --- a/Kernel/Storage/RamdiskDevice.cpp +++ b/Kernel/Storage/RamdiskDevice.cpp @@ -28,7 +28,7 @@ RamdiskDevice::~RamdiskDevice() { } -const char* RamdiskDevice::class_name() const +StringView RamdiskDevice::class_name() const { return "RamdiskDevice"; } diff --git a/Kernel/Storage/RamdiskDevice.h b/Kernel/Storage/RamdiskDevice.h index c23dbc3fae..e244808280 100644 --- a/Kernel/Storage/RamdiskDevice.h +++ b/Kernel/Storage/RamdiskDevice.h @@ -25,7 +25,7 @@ public: virtual void start_request(AsyncBlockDeviceRequest&) override; // ^DiskDevice - virtual const char* class_name() const override; + virtual StringView class_name() const override; virtual String device_name() const override; bool is_slave() const; diff --git a/Kernel/Storage/SATADiskDevice.cpp b/Kernel/Storage/SATADiskDevice.cpp index 4d0677dc61..abff0f24b8 100644 --- a/Kernel/Storage/SATADiskDevice.cpp +++ b/Kernel/Storage/SATADiskDevice.cpp @@ -28,7 +28,7 @@ SATADiskDevice::~SATADiskDevice() { } -const char* SATADiskDevice::class_name() const +StringView SATADiskDevice::class_name() const { return "SATADiskDevice"; } diff --git a/Kernel/Storage/SATADiskDevice.h b/Kernel/Storage/SATADiskDevice.h index 5d75134205..cf656162c0 100644 --- a/Kernel/Storage/SATADiskDevice.h +++ b/Kernel/Storage/SATADiskDevice.h @@ -36,7 +36,7 @@ private: SATADiskDevice(const AHCIController&, const AHCIPort&, size_t sector_size, u64 max_addressable_block); // ^DiskDevice - virtual const char* class_name() const override; + virtual StringView class_name() const override; NonnullRefPtr<AHCIPort> m_port; }; diff --git a/Kernel/Storage/StorageDevice.cpp b/Kernel/Storage/StorageDevice.cpp index ab526deb19..6ca9980d8f 100644 --- a/Kernel/Storage/StorageDevice.cpp +++ b/Kernel/Storage/StorageDevice.cpp @@ -27,7 +27,7 @@ StorageDevice::StorageDevice(const StorageController& controller, int major, int { } -const char* StorageDevice::class_name() const +StringView StorageDevice::class_name() const { return "StorageDevice"; } diff --git a/Kernel/Storage/StorageDevice.h b/Kernel/Storage/StorageDevice.h index 58b45453b1..f1c375ef8a 100644 --- a/Kernel/Storage/StorageDevice.h +++ b/Kernel/Storage/StorageDevice.h @@ -36,7 +36,7 @@ protected: StorageDevice(const StorageController&, size_t, u64); StorageDevice(const StorageController&, int, int, size_t, u64); // ^DiskDevice - virtual const char* class_name() const override; + virtual StringView class_name() const override; private: NonnullRefPtr<StorageController> m_storage_controller; diff --git a/Kernel/TTY/MasterPTY.h b/Kernel/TTY/MasterPTY.h index abc117b95b..fa54d7f837 100644 --- a/Kernel/TTY/MasterPTY.h +++ b/Kernel/TTY/MasterPTY.h @@ -41,7 +41,7 @@ private: virtual KResult close() override; virtual bool is_master_pty() const override { return true; } virtual int ioctl(FileDescription&, unsigned request, FlatPtr arg) override; - virtual const char* class_name() const override { return "MasterPTY"; } + virtual StringView class_name() const override { return "MasterPTY"; } RefPtr<SlavePTY> m_slave; unsigned m_index; diff --git a/Kernel/TTY/PTYMultiplexer.h b/Kernel/TTY/PTYMultiplexer.h index 04e5e245b2..b0eaf9fc69 100644 --- a/Kernel/TTY/PTYMultiplexer.h +++ b/Kernel/TTY/PTYMultiplexer.h @@ -41,7 +41,7 @@ public: private: // ^CharacterDevice - virtual const char* class_name() const override { return "PTYMultiplexer"; } + virtual StringView class_name() const override { return "PTYMultiplexer"; } Lock m_lock { "PTYMultiplexer" }; Vector<unsigned> m_freelist; diff --git a/Kernel/TTY/SlavePTY.h b/Kernel/TTY/SlavePTY.h index bc0fc15ee3..0539042afe 100644 --- a/Kernel/TTY/SlavePTY.h +++ b/Kernel/TTY/SlavePTY.h @@ -34,7 +34,7 @@ private: virtual bool can_read(const FileDescription&, size_t) const override; virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual bool can_write(const FileDescription&, size_t) const override; - virtual const char* class_name() const override { return "SlavePTY"; } + virtual StringView class_name() const override { return "SlavePTY"; } virtual KResult close() override; // ^Device diff --git a/Kernel/TTY/VirtualConsole.h b/Kernel/TTY/VirtualConsole.h index 8609d76a8f..4491a17617 100644 --- a/Kernel/TTY/VirtualConsole.h +++ b/Kernel/TTY/VirtualConsole.h @@ -105,7 +105,7 @@ private: virtual void set_cursor_style(VT::CursorStyle) override; // ^CharacterDevice - virtual const char* class_name() const override { return "VirtualConsole"; } + virtual StringView class_name() const override { return "VirtualConsole"; } // ^Device virtual String device_name() const override; diff --git a/Kernel/Time/HardwareTimer.h b/Kernel/Time/HardwareTimer.h index 76adb108f6..5abe78c0c4 100644 --- a/Kernel/Time/HardwareTimer.h +++ b/Kernel/Time/HardwareTimer.h @@ -67,7 +67,7 @@ public: IRQHandler::will_be_destroyed(); } - virtual const char* purpose() const override + virtual StringView purpose() const override { if (TimeManagement::the().is_system_timer(*this)) return "System Timer"; @@ -118,7 +118,7 @@ public: GenericInterruptHandler::will_be_destroyed(); } - virtual const char* purpose() const override + virtual StringView purpose() const override { return model(); } @@ -134,7 +134,7 @@ public: virtual bool is_shared_handler() const override { return false; } virtual bool is_sharing_with_others() const override { return false; } virtual HandlerType type() const override { return HandlerType::IRQHandler; } - virtual const char* controller() const override { return nullptr; } + virtual StringView controller() const override { return nullptr; } virtual bool eoi() override; virtual u32 frequency() const override { return (u32)m_frequency; } diff --git a/Kernel/VirtIO/VirtIOConsole.h b/Kernel/VirtIO/VirtIOConsole.h index 267c448b2b..a31907f252 100644 --- a/Kernel/VirtIO/VirtIOConsole.h +++ b/Kernel/VirtIO/VirtIOConsole.h @@ -21,7 +21,7 @@ public: VirtIOConsole(PCI::Address); virtual ~VirtIOConsole() override = default; - virtual const char* purpose() const override { return "VirtIOConsole"; } + virtual StringView purpose() const override { return "VirtIOConsole"; } unsigned device_id() const { diff --git a/Kernel/VirtIO/VirtIOConsolePort.h b/Kernel/VirtIO/VirtIOConsolePort.h index 6390a4ae77..2180c52124 100644 --- a/Kernel/VirtIO/VirtIOConsolePort.h +++ b/Kernel/VirtIO/VirtIOConsolePort.h @@ -32,7 +32,7 @@ public: private: constexpr static size_t RINGBUFFER_SIZE = 2 * PAGE_SIZE; - virtual const char* class_name() const override { return "VirtIOConsolePort"; } + virtual StringView class_name() const override { return "VirtIOConsolePort"; } virtual bool can_read(const FileDescription&, size_t) const override; virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override; diff --git a/Kernel/VirtIO/VirtIORNG.h b/Kernel/VirtIO/VirtIORNG.h index 720b044dc4..74826606db 100644 --- a/Kernel/VirtIO/VirtIORNG.h +++ b/Kernel/VirtIO/VirtIORNG.h @@ -17,8 +17,8 @@ namespace Kernel { class VirtIORNG final : public CharacterDevice , public VirtIODevice { public: - virtual const char* purpose() const override { return class_name(); } - virtual const char* class_name() const override { return m_class_name.characters(); } + virtual StringView purpose() const override { return class_name(); } + virtual StringView class_name() const override { return m_class_name; } virtual bool can_read(const FileDescription&, size_t) const override { return false; } virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override { return 0; } |