mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:57:43 +00:00
Kernel: Remove FIFO::{attach,detach}(Direction)
These functions would have caused a `-Woverloaded-virtual` warning with GCC 13, as they shadow `File::{attach,detach}(OpenFileDescription&)`. Both of these functions had a single call site. This commit inlines `attach` into its only caller, `FIFO::open_direction`. Instead of explicitly checking `is_fifo()` in `~OpenFileDescription` before running the `detach(Direction)` overload, let's just override the regular `detach(OpenFileDescription&)` for `FIFO` to perform this action instead.
This commit is contained in:
parent
f666989c9e
commit
2123fdd678
3 changed files with 10 additions and 20 deletions
|
@ -25,7 +25,12 @@ ErrorOr<NonnullRefPtr<FIFO>> FIFO::try_create(UserID uid)
|
|||
ErrorOr<NonnullRefPtr<OpenFileDescription>> FIFO::open_direction(FIFO::Direction direction)
|
||||
{
|
||||
auto description = TRY(OpenFileDescription::try_create(*this));
|
||||
attach(direction);
|
||||
if (direction == Direction::Reader) {
|
||||
++m_readers;
|
||||
} else if (direction == Direction::Writer) {
|
||||
++m_writers;
|
||||
}
|
||||
evaluate_block_conditions();
|
||||
description->set_fifo_direction({}, direction);
|
||||
return description;
|
||||
}
|
||||
|
@ -73,19 +78,11 @@ FIFO::FIFO(UserID uid, NonnullOwnPtr<DoubleBuffer> buffer)
|
|||
|
||||
FIFO::~FIFO() = default;
|
||||
|
||||
void FIFO::attach(Direction direction)
|
||||
void FIFO::detach(OpenFileDescription& description)
|
||||
{
|
||||
if (direction == Direction::Reader) {
|
||||
++m_readers;
|
||||
} else if (direction == Direction::Writer) {
|
||||
++m_writers;
|
||||
}
|
||||
File::detach(description);
|
||||
|
||||
evaluate_block_conditions();
|
||||
}
|
||||
|
||||
void FIFO::detach(Direction direction)
|
||||
{
|
||||
auto direction = description.fifo_direction();
|
||||
if (direction == Direction::Reader) {
|
||||
VERIFY(m_readers);
|
||||
--m_readers;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue