mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-21 18:42:53 +00:00
Kernel: Convert the PhysicalPage bool parameter to an enum
This commit is contained in:
parent
399be9bcc3
commit
d879709ec7
Notes:
sideshowbarker
2024-07-18 08:52:05 +09:00
Author: https://github.com/bgianfo
Commit: d879709ec7
Pull-request: https://github.com/SerenityOS/serenity/pull/8833
6 changed files with 18 additions and 13 deletions
|
@ -10,13 +10,13 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
NonnullRefPtr<PhysicalPage> PhysicalPage::create(PhysicalAddress paddr, bool may_return_to_freelist)
|
||||
NonnullRefPtr<PhysicalPage> PhysicalPage::create(PhysicalAddress paddr, MayReturnToFreeList may_return_to_freelist)
|
||||
{
|
||||
auto& physical_page_entry = MM.get_physical_page_entry(paddr);
|
||||
return adopt_ref(*new (&physical_page_entry.allocated.physical_page) PhysicalPage(may_return_to_freelist));
|
||||
}
|
||||
|
||||
PhysicalPage::PhysicalPage(bool may_return_to_freelist)
|
||||
PhysicalPage::PhysicalPage(MayReturnToFreeList may_return_to_freelist)
|
||||
: m_may_return_to_freelist(may_return_to_freelist)
|
||||
{
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ PhysicalAddress PhysicalPage::paddr() const
|
|||
void PhysicalPage::free_this()
|
||||
{
|
||||
auto paddr = MM.get_physical_address(*this);
|
||||
if (m_may_return_to_freelist) {
|
||||
if (m_may_return_to_freelist == MayReturnToFreeList::Yes) {
|
||||
auto& this_as_freelist_entry = MM.get_physical_page_entry(paddr).freelist;
|
||||
this->~PhysicalPage(); // delete in place
|
||||
this_as_freelist_entry.next_index = -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue