From b6403ff57172fcb596f24d6b274bc033fbe1f47e Mon Sep 17 00:00:00 2001 From: Enrico Fraccaroli Date: Thu, 19 Jan 2023 09:56:58 -0500 Subject: [PATCH] Unify debugging setup in process-related files. --- mentos/src/process/process.c | 12 +++++------- mentos/src/process/scheduler.c | 12 +++++------- mentos/src/process/scheduler_algorithm.c | 12 +++++------- mentos/src/process/wait.c | 11 +++++------ 4 files changed, 20 insertions(+), 27 deletions(-) diff --git a/mentos/src/process/process.c b/mentos/src/process/process.c index 1e0105f..cc76e0f 100644 --- a/mentos/src/process/process.c +++ b/mentos/src/process/process.c @@ -3,12 +3,11 @@ /// @copyright (c) 2014-2022 This file is distributed under the MIT License. /// See LICENSE.md for details. -// Include the kernel log levels. -#include "sys/kernel_levels.h" -/// Change the header. -#define __DEBUG_HEADER__ "[PROC ]" -/// Set the log level. -#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE +// Setup the logging for this file (do this before any other include). +#include "sys/kernel_levels.h" // Include kernel log levels. +#define __DEBUG_HEADER__ "[PROC ]" ///< Change header. +#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE ///< Set log level. +#include "io/debug.h" // Include debugging functions. #include "process/process.h" #include "process/scheduler.h" @@ -19,7 +18,6 @@ #include "sys/errno.h" #include "fcntl.h" #include "system/panic.h" -#include "io/debug.h" #include "process/wait.h" #include "process/prio.h" #include "fs/vfs.h" diff --git a/mentos/src/process/scheduler.c b/mentos/src/process/scheduler.c index 23af5c3..7bbb3ab 100644 --- a/mentos/src/process/scheduler.c +++ b/mentos/src/process/scheduler.c @@ -3,12 +3,11 @@ /// @copyright (c) 2014-2022 This file is distributed under the MIT License. /// See LICENSE.md for details. -// Include the kernel log levels. -#include "sys/kernel_levels.h" -/// Change the header. -#define __DEBUG_HEADER__ "[SCHED ]" -/// Set the log level. -#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE +// Setup the logging for this file (do this before any other include). +#include "sys/kernel_levels.h" // Include kernel log levels. +#define __DEBUG_HEADER__ "[SCHED ]" ///< Change header. +#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE ///< Set log level. +#include "io/debug.h" // Include debugging functions. #include "assert.h" #include "strerror.h" @@ -20,7 +19,6 @@ #include "process/wait.h" #include "mem/kheap.h" #include "system/panic.h" -#include "io/debug.h" #include "time.h" #include "sys/errno.h" #include "klib/list_head.h" diff --git a/mentos/src/process/scheduler_algorithm.c b/mentos/src/process/scheduler_algorithm.c index 1400a39..24a9f6d 100644 --- a/mentos/src/process/scheduler_algorithm.c +++ b/mentos/src/process/scheduler_algorithm.c @@ -3,16 +3,14 @@ /// @copyright (c) 2014-2022 This file is distributed under the MIT License. /// See LICENSE.md for details. -// Include the kernel log levels. -#include "sys/kernel_levels.h" -/// Change the header. -#define __DEBUG_HEADER__ "[SCHALG]" -/// Set the log level. -#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE +// Setup the logging for this file (do this before any other include). +#include "sys/kernel_levels.h" // Include kernel log levels. +#define __DEBUG_HEADER__ "[SCHALG]" ///< Change header. +#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE ///< Set log level. +#include "io/debug.h" // Include debugging functions. #include "hardware/timer.h" #include "process/prio.h" -#include "io/debug.h" #include "assert.h" #include "klib/list_head.h" #include "process/wait.h" diff --git a/mentos/src/process/wait.c b/mentos/src/process/wait.c index cbd1b4c..0631e44 100644 --- a/mentos/src/process/wait.c +++ b/mentos/src/process/wait.c @@ -3,12 +3,11 @@ /// @copyright (c) 2014-2022 This file is distributed under the MIT License. /// See LICENSE.md for details. -// Include the kernel log levels. -#include "sys/kernel_levels.h" -/// Change the header. -#define __DEBUG_HEADER__ "[WAIT ]" -/// Set the log level. -#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE +// Setup the logging for this file (do this before any other include). +#include "sys/kernel_levels.h" // Include kernel log levels. +#define __DEBUG_HEADER__ "[WAIT ]" ///< Change header. +#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE ///< Set log level. +#include "io/debug.h" // Include debugging functions. #include "process/wait.h"