MCPcopy Create free account
hub / github.com/Bananymous/banan-os / destroy_callback

Method destroy_callback

kernel/kernel/FS/Ext2/FileSystem.cpp:552–579  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

550 };
551 }
552
553 void Ext2FS::BlockBufferManager::destroy_callback(const uint8_t* buffer_ptr)
554 {
555 const auto tid = Thread::current_tid();
556
557 LockGuard _(m_buffer_mutex);
558
559 for (auto& buffer : m_buffers)
560 {
561 if (buffer.buffer.data() != buffer_ptr)
562 continue;
563 ASSERT(buffer.used);
564 buffer.used = false;
565 break;
566 }
567
568 for (auto& info : m_thread_infos)
569 {
570 if (info.tid != tid)
571 continue;
572 ASSERT(info.buffers > 0);
573 info.buffers--;
574 if (info.buffers != 0)
575 break;
576 info.tid = 0;
577 m_buffer_blocker.unblock();
578 break;
579 }
580 }
581
582 BAN::ErrorOr<Ext2FS::BlockBufferWrapper> Ext2FS::BlockBufferManager::get_buffer()

Callers 1

get_bufferMethod · 0.80

Calls 2

unblockMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected