mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 20:05:07 +00:00
Kernel: Changed serial debug functions and variables for readability
Change the name of set_serial_debug(bool on_or_off) to set_serial_debug_enabled(bool desired_state). This is to make the names more expressive and less unclear as to what the function does, as it only sets the enabled state. Likewise, change the name of get_serial_debug() to is_serial_debug_enabled() in order to make clear from the name that this is simply the state of s_serial_debug_enabled. Change the name of serial_debug to s_serial_debug_enabled since this is a static bool describing this state. Finally, change the signature of set_serial_debug_enabled to return a bool, as this is more logical and understandable.
This commit is contained in:
parent
cd763de280
commit
eca85f2050
3 changed files with 12 additions and 12 deletions
|
@ -23,19 +23,19 @@ namespace Kernel {
|
|||
extern Atomic<Graphics::Console*> g_boot_console;
|
||||
}
|
||||
|
||||
static bool serial_debug;
|
||||
static bool s_serial_debug_enabled;
|
||||
// A recursive spinlock allows us to keep writing in the case where a
|
||||
// page fault happens in the middle of a dbgln(), etc
|
||||
static RecursiveSpinlock s_log_lock { LockRank::None };
|
||||
|
||||
void set_serial_debug(bool on_or_off)
|
||||
void set_serial_debug_enabled(bool desired_state)
|
||||
{
|
||||
serial_debug = on_or_off;
|
||||
s_serial_debug_enabled = desired_state;
|
||||
}
|
||||
|
||||
int get_serial_debug()
|
||||
bool is_serial_debug_enabled()
|
||||
{
|
||||
return serial_debug;
|
||||
return s_serial_debug_enabled;
|
||||
}
|
||||
|
||||
static void serial_putch(char ch)
|
||||
|
@ -71,7 +71,7 @@ static void serial_putch(char ch)
|
|||
|
||||
static void critical_console_out(char ch)
|
||||
{
|
||||
if (serial_debug)
|
||||
if (s_serial_debug_enabled)
|
||||
serial_putch(ch);
|
||||
// No need to output things to the real ConsoleDevice as no one is likely
|
||||
// to read it (because we are in a fatal situation, so only print things and halt)
|
||||
|
@ -87,7 +87,7 @@ static void critical_console_out(char ch)
|
|||
|
||||
static void console_out(char ch)
|
||||
{
|
||||
if (serial_debug)
|
||||
if (s_serial_debug_enabled)
|
||||
serial_putch(ch);
|
||||
|
||||
// It would be bad to reach the assert in ConsoleDevice()::the() and do a stack overflow
|
||||
|
@ -151,7 +151,7 @@ int snprintf(char* buffer, size_t size, char const* fmt, ...)
|
|||
|
||||
static inline void internal_dbgputch(char ch)
|
||||
{
|
||||
if (serial_debug)
|
||||
if (s_serial_debug_enabled)
|
||||
serial_putch(ch);
|
||||
IO::out8(IO::BOCHS_DEBUG_PORT, ch);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue