mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:37:37 +00:00
Kernel: Make NNRP<PhysicalPage const> possible
This wasn't possible before as ref() and unref() were non-const.
This commit is contained in:
parent
e08c55dd8d
commit
8bf248a046
2 changed files with 5 additions and 5 deletions
|
@ -26,7 +26,7 @@ PhysicalAddress PhysicalPage::paddr() const
|
||||||
return MM.get_physical_address(*this);
|
return MM.get_physical_address(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicalPage::free_this()
|
void PhysicalPage::free_this() const
|
||||||
{
|
{
|
||||||
auto paddr = MM.get_physical_address(*this);
|
auto paddr = MM.get_physical_address(*this);
|
||||||
if (m_may_return_to_freelist == MayReturnToFreeList::Yes) {
|
if (m_may_return_to_freelist == MayReturnToFreeList::Yes) {
|
||||||
|
|
|
@ -25,12 +25,12 @@ class PhysicalPage {
|
||||||
public:
|
public:
|
||||||
PhysicalAddress paddr() const;
|
PhysicalAddress paddr() const;
|
||||||
|
|
||||||
void ref()
|
void ref() const
|
||||||
{
|
{
|
||||||
m_ref_count.fetch_add(1, AK::memory_order_relaxed);
|
m_ref_count.fetch_add(1, AK::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void unref()
|
void unref() const
|
||||||
{
|
{
|
||||||
if (m_ref_count.fetch_sub(1, AK::memory_order_acq_rel) == 1)
|
if (m_ref_count.fetch_sub(1, AK::memory_order_acq_rel) == 1)
|
||||||
free_this();
|
free_this();
|
||||||
|
@ -47,9 +47,9 @@ private:
|
||||||
explicit PhysicalPage(MayReturnToFreeList may_return_to_freelist);
|
explicit PhysicalPage(MayReturnToFreeList may_return_to_freelist);
|
||||||
~PhysicalPage() = default;
|
~PhysicalPage() = default;
|
||||||
|
|
||||||
void free_this();
|
void free_this() const;
|
||||||
|
|
||||||
Atomic<u32> m_ref_count { 1 };
|
mutable Atomic<u32> m_ref_count { 1 };
|
||||||
MayReturnToFreeList m_may_return_to_freelist { MayReturnToFreeList::Yes };
|
MayReturnToFreeList m_may_return_to_freelist { MayReturnToFreeList::Yes };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue