diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-24 13:05:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-24 13:05:23 -0400 |
commit | 6d1e9a42e7176bbce9348274784b2e5f69223936 (patch) | |
tree | 628404d7cffd7ac8ab6629cf5052e21d50e86633 /fs | |
parent | 95985725367e55642755ca6986d0c930cd3738e2 (diff) | |
parent | 7415982732bcb30100582cff8d2aca12a55123b4 (diff) |
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6:
pstore: cleanups to pstore_dump()
[IA64] New syscalls for 2.6.39
Diffstat (limited to 'fs')
-rw-r--r-- | fs/pstore/platform.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index ce9ad84d5dd9..f835a25625ff 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c | |||
@@ -48,6 +48,10 @@ void pstore_set_kmsg_bytes(int bytes) | |||
48 | /* Tag each group of saved records with a sequence number */ | 48 | /* Tag each group of saved records with a sequence number */ |
49 | static int oopscount; | 49 | static int oopscount; |
50 | 50 | ||
51 | static char *reason_str[] = { | ||
52 | "Oops", "Panic", "Kexec", "Restart", "Halt", "Poweroff", "Emergency" | ||
53 | }; | ||
54 | |||
51 | /* | 55 | /* |
52 | * callback from kmsg_dump. (s2,l2) has the most recently | 56 | * callback from kmsg_dump. (s2,l2) has the most recently |
53 | * written bytes, older bytes are in (s1,l1). Save as much | 57 | * written bytes, older bytes are in (s1,l1). Save as much |
@@ -61,15 +65,20 @@ static void pstore_dump(struct kmsg_dumper *dumper, | |||
61 | unsigned long s1_start, s2_start; | 65 | unsigned long s1_start, s2_start; |
62 | unsigned long l1_cpy, l2_cpy; | 66 | unsigned long l1_cpy, l2_cpy; |
63 | unsigned long size, total = 0; | 67 | unsigned long size, total = 0; |
64 | char *dst; | 68 | char *dst, *why; |
65 | u64 id; | 69 | u64 id; |
66 | int hsize, part = 1; | 70 | int hsize, part = 1; |
67 | 71 | ||
72 | if (reason < ARRAY_SIZE(reason_str)) | ||
73 | why = reason_str[reason]; | ||
74 | else | ||
75 | why = "Unknown"; | ||
76 | |||
68 | mutex_lock(&psinfo->buf_mutex); | 77 | mutex_lock(&psinfo->buf_mutex); |
69 | oopscount++; | 78 | oopscount++; |
70 | while (total < kmsg_bytes) { | 79 | while (total < kmsg_bytes) { |
71 | dst = psinfo->buf; | 80 | dst = psinfo->buf; |
72 | hsize = sprintf(dst, "Oops#%d Part%d\n", oopscount, part++); | 81 | hsize = sprintf(dst, "%s#%d Part%d\n", why, oopscount, part++); |
73 | size = psinfo->bufsize - hsize; | 82 | size = psinfo->bufsize - hsize; |
74 | dst += hsize; | 83 | dst += hsize; |
75 | 84 | ||
@@ -86,7 +95,7 @@ static void pstore_dump(struct kmsg_dumper *dumper, | |||
86 | memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy); | 95 | memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy); |
87 | 96 | ||
88 | id = psinfo->write(PSTORE_TYPE_DMESG, hsize + l1_cpy + l2_cpy); | 97 | id = psinfo->write(PSTORE_TYPE_DMESG, hsize + l1_cpy + l2_cpy); |
89 | if (pstore_is_mounted()) | 98 | if (reason == KMSG_DUMP_OOPS && pstore_is_mounted()) |
90 | pstore_mkfile(PSTORE_TYPE_DMESG, psinfo->name, id, | 99 | pstore_mkfile(PSTORE_TYPE_DMESG, psinfo->name, id, |
91 | psinfo->buf, hsize + l1_cpy + l2_cpy, | 100 | psinfo->buf, hsize + l1_cpy + l2_cpy, |
92 | CURRENT_TIME, psinfo->erase); | 101 | CURRENT_TIME, psinfo->erase); |