kern: refactor to use m_ for member variables

This commit is contained in:
Michael Scire 2020-12-17 17:18:47 -08:00 committed by SciresM
parent 0bf2ade76f
commit 968f50bc07
135 changed files with 3727 additions and 3734 deletions

View file

@ -19,17 +19,17 @@ namespace ams::kern {
void KClientPort::Initialize(KPort *parent, s32 max_sessions) {
/* Set member variables. */
this->num_sessions = 0;
this->peak_sessions = 0;
this->parent = parent;
this->max_sessions = max_sessions;
m_num_sessions = 0;
m_peak_sessions = 0;
m_parent = parent;
m_max_sessions = max_sessions;
}
void KClientPort::OnSessionFinalized() {
KScopedSchedulerLock sl;
const auto prev = this->num_sessions--;
if (prev == this->max_sessions) {
const auto prev = m_num_sessions--;
if (prev == m_max_sessions) {
this->NotifyAvailable();
}
}
@ -44,15 +44,15 @@ namespace ams::kern {
void KClientPort::Destroy() {
/* Note with our parent that we're closed. */
this->parent->OnClientClosed();
m_parent->OnClientClosed();
/* Close our reference to our parent. */
this->parent->Close();
m_parent->Close();
}
bool KClientPort::IsSignaled() const {
MESOSPHERE_ASSERT_THIS();
return this->num_sessions < this->max_sessions;
return m_num_sessions < m_max_sessions;
}
Result KClientPort::CreateSession(KClientSession **out) {
@ -67,23 +67,23 @@ namespace ams::kern {
/* Atomically increment the number of sessions. */
s32 new_sessions;
{
const auto max = this->max_sessions;
auto cur_sessions = this->num_sessions.load(std::memory_order_acquire);
const auto max = m_max_sessions;
auto cur_sessions = m_num_sessions.load(std::memory_order_acquire);
do {
R_UNLESS(cur_sessions < max, svc::ResultOutOfSessions());
new_sessions = cur_sessions + 1;
} while (!this->num_sessions.compare_exchange_weak(cur_sessions, new_sessions, std::memory_order_relaxed));
} while (!m_num_sessions.compare_exchange_weak(cur_sessions, new_sessions, std::memory_order_relaxed));
}
/* Atomically update the peak session tracking. */
{
auto peak = this->peak_sessions.load(std::memory_order_acquire);
auto peak = m_peak_sessions.load(std::memory_order_acquire);
do {
if (peak >= new_sessions) {
break;
}
} while (!this->peak_sessions.compare_exchange_weak(peak, new_sessions, std::memory_order_relaxed));
} while (!m_peak_sessions.compare_exchange_weak(peak, new_sessions, std::memory_order_relaxed));
}
}
@ -91,8 +91,8 @@ namespace ams::kern {
KSession *session = KSession::Create();
if (session == nullptr) {
/* Decrement the session count. */
const auto prev = this->num_sessions--;
if (prev == this->max_sessions) {
const auto prev = m_num_sessions--;
if (prev == m_max_sessions) {
this->NotifyAvailable();
}
@ -100,7 +100,7 @@ namespace ams::kern {
}
/* Initialize the session. */
session->Initialize(this, this->parent->GetName());
session->Initialize(this, m_parent->GetName());
/* Commit the session reservation. */
session_reservation.Commit();
@ -113,7 +113,7 @@ namespace ams::kern {
};
/* Enqueue the session with our parent. */
R_TRY(this->parent->EnqueueSession(std::addressof(session->GetServerSession())));
R_TRY(m_parent->EnqueueSession(std::addressof(session->GetServerSession())));
/* We succeeded, so set the output. */
session_guard.Cancel();
@ -133,23 +133,23 @@ namespace ams::kern {
/* Atomically increment the number of sessions. */
s32 new_sessions;
{
const auto max = this->max_sessions;
auto cur_sessions = this->num_sessions.load(std::memory_order_acquire);
const auto max = m_max_sessions;
auto cur_sessions = m_num_sessions.load(std::memory_order_acquire);
do {
R_UNLESS(cur_sessions < max, svc::ResultOutOfSessions());
new_sessions = cur_sessions + 1;
} while (!this->num_sessions.compare_exchange_weak(cur_sessions, new_sessions, std::memory_order_relaxed));
} while (!m_num_sessions.compare_exchange_weak(cur_sessions, new_sessions, std::memory_order_relaxed));
}
/* Atomically update the peak session tracking. */
{
auto peak = this->peak_sessions.load(std::memory_order_acquire);
auto peak = m_peak_sessions.load(std::memory_order_acquire);
do {
if (peak >= new_sessions) {
break;
}
} while (!this->peak_sessions.compare_exchange_weak(peak, new_sessions, std::memory_order_relaxed));
} while (!m_peak_sessions.compare_exchange_weak(peak, new_sessions, std::memory_order_relaxed));
}
}
@ -157,8 +157,8 @@ namespace ams::kern {
KLightSession *session = KLightSession::Create();
if (session == nullptr) {
/* Decrement the session count. */
const auto prev = this->num_sessions--;
if (prev == this->max_sessions) {
const auto prev = m_num_sessions--;
if (prev == m_max_sessions) {
this->NotifyAvailable();
}
@ -166,7 +166,7 @@ namespace ams::kern {
}
/* Initialize the session. */
session->Initialize(this, this->parent->GetName());
session->Initialize(this, m_parent->GetName());
/* Commit the session reservation. */
session_reservation.Commit();
@ -179,7 +179,7 @@ namespace ams::kern {
};
/* Enqueue the session with our parent. */
R_TRY(this->parent->EnqueueSession(std::addressof(session->GetServerSession())));
R_TRY(m_parent->EnqueueSession(std::addressof(session->GetServerSession())));
/* We succeeded, so set the output. */
session_guard.Cancel();