mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
Kernel: Allow getting a Device from a FileDescription
Like we already do for other kinds of files.
This commit is contained in:
parent
35b0f10f20
commit
3393b78623
Notes:
sideshowbarker
2024-07-19 10:07:36 +09:00
Author: https://github.com/bugaevc Commit: https://github.com/SerenityOS/serenity/commit/3393b786238 Pull-request: https://github.com/SerenityOS/serenity/pull/1063
@ -172,6 +172,20 @@ bool FileDescription::is_device() const
|
||||
return m_file->is_device();
|
||||
}
|
||||
|
||||
const Device* FileDescription::device() const
|
||||
{
|
||||
if (!is_device())
|
||||
return nullptr;
|
||||
return static_cast<const Device*>(m_file.ptr());
|
||||
}
|
||||
|
||||
Device* FileDescription::device()
|
||||
{
|
||||
if (!is_device())
|
||||
return nullptr;
|
||||
return static_cast<Device*>(m_file.ptr());
|
||||
}
|
||||
|
||||
bool FileDescription::is_tty() const
|
||||
{
|
||||
return m_file->is_tty();
|
||||
|
@ -71,6 +71,8 @@ public:
|
||||
const File& file() const { return *m_file; }
|
||||
|
||||
bool is_device() const;
|
||||
const Device* device() const;
|
||||
Device* device();
|
||||
|
||||
bool is_tty() const;
|
||||
const TTY* tty() const;
|
||||
|
Loading…
Reference in New Issue
Block a user