~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/kmsg_dump.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * linux/include/kmsg_dump.h
  3  *
  4  * Copyright (C) 2009 Net Insight AB
  5  *
  6  * Author: Simon Kagstrom <simon.kagstrom@netinsight.net>
  7  *
  8  * This file is subject to the terms and conditions of the GNU General Public
  9  * License.  See the file COPYING in the main directory of this archive
 10  * for more details.
 11  */
 12 #ifndef _LINUX_KMSG_DUMP_H
 13 #define _LINUX_KMSG_DUMP_H
 14 
 15 #include <linux/errno.h>
 16 #include <linux/list.h>
 17 
 18 /*
 19  * Keep this list arranged in rough order of priority. Anything listed after
 20  * KMSG_DUMP_OOPS will not be logged by default unless printk.always_kmsg_dump
 21  * is passed to the kernel.
 22  */
 23 enum kmsg_dump_reason {
 24         KMSG_DUMP_UNDEF,
 25         KMSG_DUMP_PANIC,
 26         KMSG_DUMP_OOPS,
 27         KMSG_DUMP_EMERG,
 28         KMSG_DUMP_SHUTDOWN,
 29         KMSG_DUMP_MAX
 30 };
 31 
 32 /**
 33  * struct kmsg_dump_iter - iterator for retrieving kernel messages
 34  * @cur_seq:    Points to the oldest message to dump
 35  * @next_seq:   Points after the newest message to dump
 36  */
 37 struct kmsg_dump_iter {
 38         u64     cur_seq;
 39         u64     next_seq;
 40 };
 41 
 42 /**
 43  * struct kmsg_dumper - kernel crash message dumper structure
 44  * @list:       Entry in the dumper list (private)
 45  * @dump:       Call into dumping code which will retrieve the data with
 46  *              through the record iterator
 47  * @max_reason: filter for highest reason number that should be dumped
 48  * @registered: Flag that specifies if this is already registered
 49  */
 50 struct kmsg_dumper {
 51         struct list_head list;
 52         void (*dump)(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason);
 53         enum kmsg_dump_reason max_reason;
 54         bool registered;
 55 };
 56 
 57 #ifdef CONFIG_PRINTK
 58 void kmsg_dump(enum kmsg_dump_reason reason);
 59 
 60 bool kmsg_dump_get_line(struct kmsg_dump_iter *iter, bool syslog,
 61                         char *line, size_t size, size_t *len);
 62 
 63 bool kmsg_dump_get_buffer(struct kmsg_dump_iter *iter, bool syslog,
 64                           char *buf, size_t size, size_t *len_out);
 65 
 66 void kmsg_dump_rewind(struct kmsg_dump_iter *iter);
 67 
 68 int kmsg_dump_register(struct kmsg_dumper *dumper);
 69 
 70 int kmsg_dump_unregister(struct kmsg_dumper *dumper);
 71 
 72 const char *kmsg_dump_reason_str(enum kmsg_dump_reason reason);
 73 #else
 74 static inline void kmsg_dump(enum kmsg_dump_reason reason)
 75 {
 76 }
 77 
 78 static inline bool kmsg_dump_get_line(struct kmsg_dump_iter *iter, bool syslog,
 79                                 const char *line, size_t size, size_t *len)
 80 {
 81         return false;
 82 }
 83 
 84 static inline bool kmsg_dump_get_buffer(struct kmsg_dump_iter *iter, bool syslog,
 85                                         char *buf, size_t size, size_t *len)
 86 {
 87         return false;
 88 }
 89 
 90 static inline void kmsg_dump_rewind(struct kmsg_dump_iter *iter)
 91 {
 92 }
 93 
 94 static inline int kmsg_dump_register(struct kmsg_dumper *dumper)
 95 {
 96         return -EINVAL;
 97 }
 98 
 99 static inline int kmsg_dump_unregister(struct kmsg_dumper *dumper)
100 {
101         return -EINVAL;
102 }
103 
104 static inline const char *kmsg_dump_reason_str(enum kmsg_dump_reason reason)
105 {
106         return "Disabled";
107 }
108 #endif
109 
110 #endif /* _LINUX_KMSG_DUMP_H */
111 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php