diff options
Diffstat (limited to 'fs/pstore/platform.c')
-rw-r--r-- | fs/pstore/platform.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 9ec22d3b4293..82c585f715e3 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c | |||
@@ -68,9 +68,25 @@ void pstore_set_kmsg_bytes(int bytes) | |||
68 | /* Tag each group of saved records with a sequence number */ | 68 | /* Tag each group of saved records with a sequence number */ |
69 | static int oopscount; | 69 | static int oopscount; |
70 | 70 | ||
71 | static char *reason_str[] = { | 71 | static const char *get_reason_str(enum kmsg_dump_reason reason) |
72 | "Oops", "Panic", "Kexec", "Restart", "Halt", "Poweroff", "Emergency" | 72 | { |
73 | }; | 73 | switch (reason) { |
74 | case KMSG_DUMP_PANIC: | ||
75 | return "Panic"; | ||
76 | case KMSG_DUMP_OOPS: | ||
77 | return "Oops"; | ||
78 | case KMSG_DUMP_EMERG: | ||
79 | return "Emergency"; | ||
80 | case KMSG_DUMP_RESTART: | ||
81 | return "Restart"; | ||
82 | case KMSG_DUMP_HALT: | ||
83 | return "Halt"; | ||
84 | case KMSG_DUMP_POWEROFF: | ||
85 | return "Poweroff"; | ||
86 | default: | ||
87 | return "Unknown"; | ||
88 | } | ||
89 | } | ||
74 | 90 | ||
75 | /* | 91 | /* |
76 | * callback from kmsg_dump. (s2,l2) has the most recently | 92 | * callback from kmsg_dump. (s2,l2) has the most recently |
@@ -85,17 +101,15 @@ static void pstore_dump(struct kmsg_dumper *dumper, | |||
85 | unsigned long s1_start, s2_start; | 101 | unsigned long s1_start, s2_start; |
86 | unsigned long l1_cpy, l2_cpy; | 102 | unsigned long l1_cpy, l2_cpy; |
87 | unsigned long size, total = 0; | 103 | unsigned long size, total = 0; |
88 | char *dst, *why; | 104 | char *dst; |
105 | const char *why; | ||
89 | u64 id; | 106 | u64 id; |
90 | int hsize, ret; | 107 | int hsize, ret; |
91 | unsigned int part = 1; | 108 | unsigned int part = 1; |
92 | unsigned long flags = 0; | 109 | unsigned long flags = 0; |
93 | int is_locked = 0; | 110 | int is_locked = 0; |
94 | 111 | ||
95 | if (reason < ARRAY_SIZE(reason_str)) | 112 | why = get_reason_str(reason); |
96 | why = reason_str[reason]; | ||
97 | else | ||
98 | why = "Unknown"; | ||
99 | 113 | ||
100 | if (in_nmi()) { | 114 | if (in_nmi()) { |
101 | is_locked = spin_trylock(&psinfo->buf_lock); | 115 | is_locked = spin_trylock(&psinfo->buf_lock); |