| .. | .. |
|---|
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
|---|
| 2 | 2 | #include <linux/kmsg_dump.h> |
|---|
| 3 | | -#include <linux/spinlock.h> |
|---|
| 4 | 3 | #include <linux/console.h> |
|---|
| 5 | 4 | #include <shared/init.h> |
|---|
| 6 | 5 | #include <shared/kern.h> |
|---|
| 7 | 6 | #include <os.h> |
|---|
| 8 | 7 | |
|---|
| 9 | 8 | static void kmsg_dumper_stdout(struct kmsg_dumper *dumper, |
|---|
| 10 | | - enum kmsg_dump_reason reason, |
|---|
| 11 | | - struct kmsg_dumper_iter *iter) |
|---|
| 9 | + enum kmsg_dump_reason reason) |
|---|
| 12 | 10 | { |
|---|
| 13 | | - static DEFINE_SPINLOCK(lock); |
|---|
| 14 | 11 | static char line[1024]; |
|---|
| 15 | 12 | struct console *con; |
|---|
| 16 | | - unsigned long flags; |
|---|
| 17 | 13 | size_t len = 0; |
|---|
| 18 | 14 | |
|---|
| 19 | 15 | /* only dump kmsg when no console is available */ |
|---|
| .. | .. |
|---|
| 28 | 24 | if (con) |
|---|
| 29 | 25 | return; |
|---|
| 30 | 26 | |
|---|
| 31 | | - if (!spin_trylock_irqsave(&lock, flags)) |
|---|
| 32 | | - return; |
|---|
| 33 | | - |
|---|
| 34 | 27 | printf("kmsg_dump:\n"); |
|---|
| 35 | | - while (kmsg_dump_get_line(iter, true, line, sizeof(line), &len)) { |
|---|
| 28 | + while (kmsg_dump_get_line(dumper, true, line, sizeof(line), &len)) { |
|---|
| 36 | 29 | line[len] = '\0'; |
|---|
| 37 | 30 | printf("%s", line); |
|---|
| 38 | 31 | } |
|---|
| 39 | | - |
|---|
| 40 | | - spin_unlock_irqrestore(&lock, flags); |
|---|
| 41 | 32 | } |
|---|
| 42 | 33 | |
|---|
| 43 | 34 | static struct kmsg_dumper kmsg_dumper = { |
|---|