xref: /freebsd/sys/compat/linuxkpi/common/include/linux/kmsg_dump.h (revision 576ee62dd2e5e0454a5316eb9207f4ebaa543171)
1 /*
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2025-2026 The FreeBSD Foundation
5  * Copyright (c) 2025-2026 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
6  *
7  * This software was developed by Jean-Sébastien Pédron under sponsorship
8  * from the FreeBSD Foundation.
9  */
10 
11 #ifndef _LINUXKPI_LINUX_KMSG_DUMP_H_
12 #define	_LINUXKPI_LINUX_KMSG_DUMP_H_
13 
14 #include <linux/errno.h>
15 #include <linux/list.h>
16 
17 #include <linux/kernel.h> /* For pr_debug() */
18 
19 enum kmsg_dump_reason {
20 	KMSG_DUMP_UNDEF,
21 	KMSG_DUMP_PANIC,
22 	KMSG_DUMP_OOPS,
23 	KMSG_DUMP_EMERG,
24 	KMSG_DUMP_SHUTDOWN,
25 	KMSG_DUMP_MAX
26 };
27 
28 struct kmsg_dumper {
29 	struct list_head list;
30 	void (*dump)(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason);
31 	enum kmsg_dump_reason max_reason;
32 	bool registered;
33 };
34 
35 static inline int
36 kmsg_dump_register(struct kmsg_dumper *dumper)
37 {
38 	pr_debug("TODO");
39 
40 	return (-EINVAL);
41 }
42 
43 static inline int
44 kmsg_dump_unregister(struct kmsg_dumper *dumper)
45 {
46 	pr_debug("TODO");
47 
48 	return (-EINVAL);
49 }
50 
51 #endif
52