summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-06-10 17:24:04 +0200
committerRichard Braun <rbraun@sceen.net>2017-06-10 17:38:47 +0200
commitb719ffa6583447ff933fbcf21274b376133cb992 (patch)
tree4bd7aaf9767dea632a1338041f0c6fdd0624f867 /kern
parent562904ff8e2f5e40e4be76dc7c4d919a4bda05f8 (diff)
Use log functions where appropriate
Diffstat (limited to 'kern')
-rw-r--r--kern/arg.c4
-rw-r--r--kern/console.c6
-rw-r--r--kern/intr.c6
-rw-r--r--kern/llsync.c4
-rw-r--r--kern/percpu.c14
-rw-r--r--kern/shell.c5
-rw-r--r--kern/sref.c4
-rw-r--r--kern/work.c10
8 files changed, 27 insertions, 26 deletions
diff --git a/kern/arg.c b/kern/arg.c
index 9c35651f..ed684ce7 100644
--- a/kern/arg.c
+++ b/kern/arg.c
@@ -18,11 +18,11 @@
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
-#include <stdio.h>
#include <string.h>
#include <kern/arg.h>
#include <kern/init.h>
+#include <kern/log.h>
#include <kern/macros.h>
#include <kern/panic.h>
@@ -72,7 +72,7 @@ arg_info(void)
}
cmdline[i] = '\0';
- printf("arg: %s\n", cmdline);
+ log_info("arg: %s", cmdline);
}
static const char * __init
diff --git a/kern/console.c b/kern/console.c
index fef4f654..bee400e0 100644
--- a/kern/console.c
+++ b/kern/console.c
@@ -18,7 +18,6 @@
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
-#include <stdio.h>
#include <string.h>
#include <kern/arg.h>
@@ -26,6 +25,7 @@
#include <kern/init.h>
#include <kern/console.h>
#include <kern/list.h>
+#include <kern/log.h>
#include <kern/mutex.h>
#include <kern/spinlock.h>
#include <kern/thread.h>
@@ -128,10 +128,10 @@ console_register(struct console *console)
console_dev = console;
}
- printf("console: %s registered\n", console->name);
+ log_info("console: %s registered", console->name);
if (console == console_dev) {
- printf("console: %s selected as active console\n", console->name);
+ log_info("console: %s selected as active console", console->name);
}
}
diff --git a/kern/intr.c b/kern/intr.c
index fe69e3e9..ca733e29 100644
--- a/kern/intr.c
+++ b/kern/intr.c
@@ -24,13 +24,13 @@
#include <stdbool.h>
#include <stddef.h>
-#include <stdio.h>
#include <kern/atomic.h>
#include <kern/kmem.h>
#include <kern/init.h>
#include <kern/intr.h>
#include <kern/list.h>
+#include <kern/log.h>
#include <kern/macros.h>
#include <kern/panic.h>
#include <kern/param.h>
@@ -388,7 +388,7 @@ intr_unregister(unsigned int intr, intr_handler_fn_t fn)
handler = intr_entry_remove(intr_get_entry(intr), fn);
if (handler == NULL) {
- printf("intr: warning: attempting to unregister unknown handler\n");
+ log_warning("intr: attempting to unregister unknown handler");
return;
}
@@ -410,7 +410,7 @@ intr_handle(unsigned int intr)
spinlock_lock(&entry->lock);
if (intr_entry_empty(entry)) {
- printf("intr: spurious interrupt %u\n", intr);
+ log_warning("intr: spurious interrupt %u", intr);
goto out;
}
diff --git a/kern/llsync.c b/kern/llsync.c
index 1c5086f3..4704e806 100644
--- a/kern/llsync.c
+++ b/kern/llsync.c
@@ -35,12 +35,12 @@
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
-#include <stdio.h>
#include <kern/condition.h>
#include <kern/cpumap.h>
#include <kern/init.h>
#include <kern/list.h>
+#include <kern/log.h>
#include <kern/llsync.h>
#include <kern/llsync_i.h>
#include <kern/macros.h>
@@ -122,7 +122,7 @@ llsync_process_global_checkpoint(void)
/* TODO Handle hysteresis */
if (!llsync_data.no_warning && (nr_works >= LLSYNC_NR_PENDING_WORKS_WARN)) {
llsync_data.no_warning = 1;
- printf("llsync: warning: large number of pending works\n");
+ log_warning("llsync: large number of pending works\n");
}
if (llsync_data.nr_registered_cpus == 0) {
diff --git a/kern/percpu.c b/kern/percpu.c
index a1f7df15..805825a8 100644
--- a/kern/percpu.c
+++ b/kern/percpu.c
@@ -18,11 +18,11 @@
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
-#include <stdio.h>
#include <string.h>
#include <kern/error.h>
#include <kern/init.h>
+#include <kern/log.h>
#include <kern/macros.h>
#include <kern/panic.h>
#include <kern/param.h>
@@ -50,8 +50,8 @@ percpu_setup(void)
unsigned int order;
percpu_area_size = &_percpu_end - &_percpu;
- printf("percpu: max_cpus: %u, section size: %zuk\n", X15_MAX_CPUS,
- percpu_area_size >> 10);
+ log_info("percpu: max_cpus: %u, section size: %zuk", X15_MAX_CPUS,
+ percpu_area_size >> 10);
assert(vm_page_aligned(percpu_area_size));
if (percpu_area_size == 0) {
@@ -77,8 +77,8 @@ percpu_add(unsigned int cpu)
if (cpu >= ARRAY_SIZE(percpu_areas)) {
if (!percpu_skip_warning) {
- printf("percpu: ignoring processor beyond id %zu\n",
- ARRAY_SIZE(percpu_areas) - 1);
+ log_warning("percpu: ignoring processor beyond id %zu",
+ ARRAY_SIZE(percpu_areas) - 1);
percpu_skip_warning = 1;
}
@@ -86,7 +86,7 @@ percpu_add(unsigned int cpu)
}
if (percpu_areas[cpu] != NULL) {
- printf("percpu: error: id %u ignored, already registered\n", cpu);
+ log_err("percpu: id %u ignored, already registered", cpu);
return ERROR_INVAL;
}
@@ -98,7 +98,7 @@ percpu_add(unsigned int cpu)
page = vm_page_alloc(order, VM_PAGE_SEL_DIRECTMAP, VM_PAGE_KERNEL);
if (page == NULL) {
- printf("percpu: error: unable to allocate percpu area\n");
+ log_err("percpu: unable to allocate percpu area");
return ERROR_NOMEM;
}
diff --git a/kern/shell.c b/kern/shell.c
index 38f29912..c526b311 100644
--- a/kern/shell.c
+++ b/kern/shell.c
@@ -20,8 +20,9 @@
#include <kern/console.h>
#include <kern/error.h>
-#include <kern/init.h>
#include <kern/hash.h>
+#include <kern/init.h>
+#include <kern/log.h>
#include <kern/macros.h>
#include <kern/mutex.h>
#include <kern/shell.h>
@@ -445,7 +446,7 @@ shell_cmd_add(struct shell_cmd *cmd)
for (;;) {
if (strcmp(cmd->name, tmp->name) == 0) {
- printf("shell: %s: shell command name collision", cmd->name);
+ log_err("shell: %s: shell command name collision", cmd->name);
return ERROR_EXIST;
}
diff --git a/kern/sref.c b/kern/sref.c
index 9c2d7761..5aad8dab 100644
--- a/kern/sref.c
+++ b/kern/sref.c
@@ -44,12 +44,12 @@
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
-#include <stdio.h>
#include <kern/condition.h>
#include <kern/cpumap.h>
#include <kern/error.h>
#include <kern/init.h>
+#include <kern/log.h>
#include <kern/macros.h>
#include <kern/mutex.h>
#include <kern/panic.h>
@@ -503,7 +503,7 @@ sref_end_epoch(struct sref_queue *queue)
if (!sref_data.no_warning
&& (sref_review_queue_size() >= SREF_NR_COUNTERS_WARN)) {
sref_data.no_warning = 1;
- printf("sref: warning: large number of counters in review queue\n");
+ log_warning("sref: large number of counters in review queue");
}
if (sref_data.nr_registered_cpus == 1) {
diff --git a/kern/work.c b/kern/work.c
index 5c33eb77..284b1e28 100644
--- a/kern/work.c
+++ b/kern/work.c
@@ -17,13 +17,13 @@
#include <assert.h>
#include <stddef.h>
-#include <stdio.h>
#include <kern/bitmap.h>
#include <kern/error.h>
#include <kern/init.h>
#include <kern/kmem.h>
#include <kern/list.h>
+#include <kern/log.h>
#include <kern/macros.h>
#include <kern/panic.h>
#include <kern/param.h>
@@ -374,7 +374,7 @@ work_process(void *arg)
if (error) {
work_pool_free_id(pool, id);
- printf("work: warning: unable to create worker thread\n");
+ log_warning("work: unable to create worker thread");
}
}
}
@@ -490,9 +490,9 @@ work_setup(void)
work_pool_init(&work_pool_highprio, WORK_INVALID_CPU,
WORK_PF_GLOBAL | WORK_PF_HIGHPRIO);
- printf("work: threads per pool (per-cpu/global): %u/%u, spare: %u\n",
- percpu_var(work_pool_cpu_main.max_threads, 0),
- work_pool_main.max_threads, WORK_THREADS_SPARE);
+ log_info("work: threads per pool (per-cpu/global): %u/%u, spare: %u",
+ percpu_var(work_pool_cpu_main.max_threads, 0),
+ work_pool_main.max_threads, WORK_THREADS_SPARE);
}
void