mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
Kernel: Use operator ""sv
in all class_name() implementations
Previously there was a mix of returning plain strings and returning explicit string views using `operator ""sv`. This change switches them all to standardized on `operator ""sv` as it avoids a call to strlen.
This commit is contained in:
parent
836c22ea13
commit
5f1c98e576
39 changed files with 39 additions and 39 deletions
|
@ -31,7 +31,7 @@ public:
|
|||
virtual void initialize() override;
|
||||
|
||||
private:
|
||||
virtual StringView class_name() const override { return "VirtIOConsole"; }
|
||||
virtual StringView class_name() const override { return "VirtIOConsole"sv; }
|
||||
explicit Console(PCI::DeviceIdentifier const&);
|
||||
enum class ControlEvent : u16 {
|
||||
DeviceReady = 0,
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
private:
|
||||
constexpr static size_t RINGBUFFER_SIZE = 2 * PAGE_SIZE;
|
||||
|
||||
virtual StringView class_name() const override { return "VirtIOConsolePort"; }
|
||||
virtual StringView class_name() const override { return "VirtIOConsolePort"sv; }
|
||||
|
||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
||||
virtual KResultOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
virtual void initialize();
|
||||
|
||||
protected:
|
||||
virtual StringView class_name() const { return "VirtIO::Device"; }
|
||||
virtual StringView class_name() const { return "VirtIO::Device"sv; }
|
||||
explicit Device(PCI::DeviceIdentifier const&);
|
||||
struct MappedMMIO {
|
||||
OwnPtr<Memory::Region> base;
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
virtual void initialize() override;
|
||||
|
||||
private:
|
||||
virtual StringView class_name() const override { return "VirtIOConsole"; }
|
||||
virtual StringView class_name() const override { return "VirtIOConsole"sv; }
|
||||
explicit RNG(PCI::DeviceIdentifier const&);
|
||||
virtual bool handle_device_config_change() override;
|
||||
virtual void handle_queue_update(u16 queue_index) override;
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
virtual bool can_write(const Kernel::OpenFileDescription&, size_t) const override { return true; }
|
||||
virtual Kernel::KResultOr<size_t> read(OpenFileDescription&, u64, Kernel::UserOrKernelBuffer&, size_t) override;
|
||||
virtual Kernel::KResultOr<size_t> write(OpenFileDescription&, u64, const Kernel::UserOrKernelBuffer&, size_t) override;
|
||||
virtual StringView class_name() const override { return "Console"; }
|
||||
virtual StringView class_name() const override { return "Console"sv; }
|
||||
|
||||
void put_char(char);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ private:
|
|||
virtual KResultOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
||||
virtual StringView class_name() const override { return "FullDevice"; }
|
||||
virtual StringView class_name() const override { return "FullDevice"sv; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ protected:
|
|||
mutable Spinlock m_queue_lock;
|
||||
CircularQueue<Event, 16> m_queue;
|
||||
// ^CharacterDevice
|
||||
virtual StringView class_name() const override { return "KeyboardDevice"; }
|
||||
virtual StringView class_name() const override { return "KeyboardDevice"sv; }
|
||||
|
||||
u8 m_modifiers { 0 };
|
||||
bool m_caps_lock_to_ctrl_pressed { false };
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
protected:
|
||||
MouseDevice();
|
||||
// ^CharacterDevice
|
||||
virtual StringView class_name() const override { return "MouseDevice"; }
|
||||
virtual StringView class_name() const override { return "MouseDevice"sv; }
|
||||
|
||||
mutable Spinlock m_queue_lock;
|
||||
CircularQueue<MousePacket, 100> m_queue;
|
||||
|
|
|
@ -44,7 +44,7 @@ private:
|
|||
virtual bool handle_irq(const RegisterState&) override;
|
||||
|
||||
// ^CharacterDevice
|
||||
virtual StringView class_name() const override { return "KeyboardDevice"; }
|
||||
virtual StringView class_name() const override { return "KeyboardDevice"sv; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
protected:
|
||||
KCOVDevice();
|
||||
|
||||
virtual StringView class_name() const override { return "KCOVDevice"; }
|
||||
virtual StringView class_name() const override { return "KCOVDevice"sv; }
|
||||
|
||||
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; }
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
private:
|
||||
MemoryDevice();
|
||||
|
||||
virtual StringView class_name() const override { return "MemoryDevice"; }
|
||||
virtual StringView class_name() const override { return "MemoryDevice"sv; }
|
||||
virtual bool can_read(const OpenFileDescription&, size_t) const override { return true; }
|
||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return false; }
|
||||
virtual bool is_seekable() const override { return true; }
|
||||
|
|
|
@ -26,7 +26,7 @@ private:
|
|||
virtual KResultOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
||||
virtual StringView class_name() const override { return "NullDevice"; }
|
||||
virtual StringView class_name() const override { return "NullDevice"sv; }
|
||||
virtual bool is_seekable() const override { return true; }
|
||||
};
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ private:
|
|||
virtual KResultOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
||||
virtual StringView class_name() const override { return "RandomDevice"; }
|
||||
virtual StringView class_name() const override { return "RandomDevice"sv; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ private:
|
|||
virtual bool handle_irq(const RegisterState&) override;
|
||||
|
||||
// ^CharacterDevice
|
||||
virtual StringView class_name() const override { return "SB16"; }
|
||||
virtual StringView class_name() const override { return "SB16"sv; }
|
||||
|
||||
void initialize();
|
||||
void wait_for_irq();
|
||||
|
|
|
@ -110,7 +110,7 @@ private:
|
|||
friend class PCISerialDevice;
|
||||
|
||||
// ^CharacterDevice
|
||||
virtual StringView class_name() const override { return "SerialDevice"; }
|
||||
virtual StringView class_name() const override { return "SerialDevice"sv; }
|
||||
|
||||
void initialize();
|
||||
void set_interrupts(bool interrupt_enable);
|
||||
|
|
|
@ -26,7 +26,7 @@ private:
|
|||
virtual KResultOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
||||
virtual StringView class_name() const override { return "ZeroDevice"; }
|
||||
virtual StringView class_name() const override { return "ZeroDevice"sv; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
virtual KResultOr<Memory::Region*> mmap(Process&, OpenFileDescription&, Memory::VirtualRange const&, u64 offset, int prot, bool shared) override;
|
||||
|
||||
private:
|
||||
virtual StringView class_name() const override { return "AnonymousFile"; }
|
||||
virtual StringView class_name() const override { return "AnonymousFile"sv; }
|
||||
virtual String absolute_path(const OpenFileDescription&) const override { return ":anonymous-file:"; }
|
||||
virtual bool can_read(const OpenFileDescription&, size_t) const override { return false; }
|
||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return false; }
|
||||
|
|
|
@ -46,7 +46,7 @@ private:
|
|||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
||||
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
||||
virtual String absolute_path(const OpenFileDescription&) const override;
|
||||
virtual StringView class_name() const override { return "FIFO"; }
|
||||
virtual StringView class_name() const override { return "FIFO"sv; }
|
||||
virtual bool is_fifo() const override { return true; }
|
||||
|
||||
explicit FIFO(UserID, NonnullOwnPtr<DoubleBuffer> buffer);
|
||||
|
|
|
@ -309,7 +309,7 @@ public:
|
|||
|
||||
virtual ~ISO9660FS() override;
|
||||
virtual KResult initialize() override;
|
||||
virtual StringView class_name() const override { return "ISO9660FS"; }
|
||||
virtual StringView class_name() const override { return "ISO9660FS"sv; }
|
||||
virtual Inode& root_inode() override;
|
||||
|
||||
virtual unsigned total_block_count() const override;
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
virtual KResult chown(OpenFileDescription&, UserID, GroupID) override;
|
||||
virtual KResult chmod(OpenFileDescription&, mode_t) override;
|
||||
|
||||
virtual StringView class_name() const override { return "InodeFile"; }
|
||||
virtual StringView class_name() const override { return "InodeFile"sv; }
|
||||
|
||||
virtual bool is_seekable() const override { return true; }
|
||||
virtual bool is_inode() const override { return true; }
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
virtual KResult close() override;
|
||||
|
||||
virtual String absolute_path(const OpenFileDescription&) const override;
|
||||
virtual StringView class_name() const override { return "InodeWatcher"; };
|
||||
virtual StringView class_name() const override { return "InodeWatcher"sv; };
|
||||
virtual bool is_inode_watcher() const override { return true; }
|
||||
|
||||
void notify_inode_event(Badge<Inode>, InodeIdentifier, InodeWatcherEvent::Type, String const& name = {});
|
||||
|
|
|
@ -38,7 +38,7 @@ private:
|
|||
FramebufferDevice(const GraphicsDevice&, size_t, PhysicalAddress, size_t, size_t, size_t);
|
||||
|
||||
// ^File
|
||||
virtual StringView class_name() const override { return "FramebufferDevice"; }
|
||||
virtual StringView class_name() const override { return "FramebufferDevice"sv; }
|
||||
|
||||
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; }
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
u8* framebuffer_data();
|
||||
|
||||
private:
|
||||
virtual StringView class_name() const override { return "VirtIOFrameBuffer"; }
|
||||
virtual StringView class_name() const override { return "VirtIOFrameBuffer"sv; }
|
||||
|
||||
Protocol::DisplayInfoResponse::Display const& display_info() const;
|
||||
Protocol::DisplayInfoResponse::Display& display_info();
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
void flush_dirty_rectangle(ScanoutID, Protocol::Rect const& dirty_rect, ResourceID);
|
||||
|
||||
private:
|
||||
virtual StringView class_name() const override { return "VirtIOGPU"; }
|
||||
virtual StringView class_name() const override { return "VirtIOGPU"sv; }
|
||||
|
||||
struct Scanout {
|
||||
RefPtr<FrameBufferDevice> framebuffer;
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
|
||||
protected:
|
||||
IPv4Socket(int type, int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer, OwnPtr<KBuffer> optional_scratch_buffer);
|
||||
virtual StringView class_name() const override { return "IPv4Socket"; }
|
||||
virtual StringView class_name() const override { return "IPv4Socket"sv; }
|
||||
|
||||
PortAllocationResult allocate_local_port_if_needed();
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
|
||||
private:
|
||||
explicit LocalSocket(int type, NonnullOwnPtr<DoubleBuffer> client_buffer, NonnullOwnPtr<DoubleBuffer> server_buffer);
|
||||
virtual StringView class_name() const override { return "LocalSocket"; }
|
||||
virtual StringView class_name() const override { return "LocalSocket"sv; }
|
||||
virtual bool is_local() const override { return true; }
|
||||
bool has_attached_peer(const OpenFileDescription&) const;
|
||||
DoubleBuffer* receive_buffer_for(OpenFileDescription&);
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
virtual ~LoopbackAdapter() override;
|
||||
|
||||
virtual void send_raw(ReadonlyBytes) override;
|
||||
virtual StringView class_name() const override { return "LoopbackAdapter"; }
|
||||
virtual StringView class_name() const override { return "LoopbackAdapter"sv; }
|
||||
virtual bool link_up() override { return true; }
|
||||
virtual bool link_full_duplex() override { return true; }
|
||||
virtual int link_speed() override { return 1000; }
|
||||
|
|
|
@ -123,7 +123,7 @@ protected:
|
|||
size_t backlog() const { return m_backlog; }
|
||||
void set_backlog(size_t backlog) { m_backlog = backlog; }
|
||||
|
||||
virtual StringView class_name() const override { return "Socket"; }
|
||||
virtual StringView class_name() const override { return "Socket"sv; }
|
||||
|
||||
virtual void shut_down_for_reading() { }
|
||||
virtual void shut_down_for_writing() { }
|
||||
|
|
|
@ -166,7 +166,7 @@ protected:
|
|||
|
||||
private:
|
||||
explicit TCPSocket(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer, NonnullOwnPtr<KBuffer> scratch_buffer);
|
||||
virtual StringView class_name() const override { return "TCPSocket"; }
|
||||
virtual StringView class_name() const override { return "TCPSocket"sv; }
|
||||
|
||||
virtual void shut_down_for_writing() override;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
|
||||
private:
|
||||
explicit UDPSocket(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer);
|
||||
virtual StringView class_name() const override { return "UDPSocket"; }
|
||||
virtual StringView class_name() const override { return "UDPSocket"sv; }
|
||||
static MutexProtected<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;
|
||||
|
|
|
@ -37,7 +37,7 @@ UNMAP_AFTER_INIT PATADiskDevice::~PATADiskDevice()
|
|||
|
||||
StringView PATADiskDevice::class_name() const
|
||||
{
|
||||
return "PATADiskDevice";
|
||||
return "PATADiskDevice"sv;
|
||||
}
|
||||
|
||||
void PATADiskDevice::start_request(AsyncBlockDeviceRequest& request)
|
||||
|
|
|
@ -77,7 +77,7 @@ bool DiskPartition::can_write(const OpenFileDescription& fd, size_t offset) cons
|
|||
|
||||
StringView DiskPartition::class_name() const
|
||||
{
|
||||
return "DiskPartition";
|
||||
return "DiskPartition"sv;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ RamdiskDevice::~RamdiskDevice()
|
|||
|
||||
StringView RamdiskDevice::class_name() const
|
||||
{
|
||||
return "RamdiskDevice";
|
||||
return "RamdiskDevice"sv;
|
||||
}
|
||||
|
||||
void RamdiskDevice::start_request(AsyncBlockDeviceRequest& request)
|
||||
|
|
|
@ -33,7 +33,7 @@ SATADiskDevice::~SATADiskDevice()
|
|||
|
||||
StringView SATADiskDevice::class_name() const
|
||||
{
|
||||
return "SATADiskDevice";
|
||||
return "SATADiskDevice"sv;
|
||||
}
|
||||
|
||||
void SATADiskDevice::start_request(AsyncBlockDeviceRequest& request)
|
||||
|
|
|
@ -29,7 +29,7 @@ StorageDevice::StorageDevice(const StorageController& controller, int major, int
|
|||
|
||||
StringView StorageDevice::class_name() const
|
||||
{
|
||||
return "StorageDevice";
|
||||
return "StorageDevice"sv;
|
||||
}
|
||||
|
||||
NonnullRefPtr<StorageController> StorageDevice::controller() const
|
||||
|
|
|
@ -38,7 +38,7 @@ private:
|
|||
virtual KResult close() override;
|
||||
virtual bool is_master_pty() const override { return true; }
|
||||
virtual KResult ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg) override;
|
||||
virtual StringView class_name() const override { return "MasterPTY"; }
|
||||
virtual StringView class_name() const override { return "MasterPTY"sv; }
|
||||
|
||||
RefPtr<SlavePTY> m_slave;
|
||||
unsigned m_index;
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
|
||||
private:
|
||||
// ^CharacterDevice
|
||||
virtual StringView class_name() const override { return "PTYMultiplexer"; }
|
||||
virtual StringView class_name() const override { return "PTYMultiplexer"sv; }
|
||||
|
||||
static constexpr size_t max_pty_pairs = 64;
|
||||
MutexProtected<Vector<unsigned, max_pty_pairs>> m_freelist;
|
||||
|
|
|
@ -35,7 +35,7 @@ private:
|
|||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
||||
virtual KResultOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
||||
virtual StringView class_name() const override { return "SlavePTY"; }
|
||||
virtual StringView class_name() const override { return "SlavePTY"sv; }
|
||||
virtual KResult close() override;
|
||||
|
||||
friend class MasterPTY;
|
||||
|
|
|
@ -106,7 +106,7 @@ private:
|
|||
virtual void set_cursor_style(VT::CursorStyle) override;
|
||||
|
||||
// ^CharacterDevice
|
||||
virtual StringView class_name() const override { return "VirtualConsole"; }
|
||||
virtual StringView class_name() const override { return "VirtualConsole"sv; }
|
||||
|
||||
void set_active(bool);
|
||||
void flush_dirty_lines();
|
||||
|
|
Loading…
Add table
Reference in a new issue