Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242221
b: refs/heads/master
c: 7415982
h: refs/heads/master
i:
  242219: 2865114
v: v3
  • Loading branch information
Tony Luck committed Mar 23, 2011
1 parent 0fbbe8e commit 60a8ee7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9298168d16faf939141cddc836b6b9b1ef2a8aac
refs/heads/master: 7415982732bcb30100582cff8d2aca12a55123b4
15 changes: 12 additions & 3 deletions trunk/fs/pstore/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ void pstore_set_kmsg_bytes(int bytes)
/* Tag each group of saved records with a sequence number */
static int oopscount;

static char *reason_str[] = {
"Oops", "Panic", "Kexec", "Restart", "Halt", "Poweroff", "Emergency"
};

/*
* callback from kmsg_dump. (s2,l2) has the most recently
* written bytes, older bytes are in (s1,l1). Save as much
Expand All @@ -61,15 +65,20 @@ static void pstore_dump(struct kmsg_dumper *dumper,
unsigned long s1_start, s2_start;
unsigned long l1_cpy, l2_cpy;
unsigned long size, total = 0;
char *dst;
char *dst, *why;
u64 id;
int hsize, part = 1;

if (reason < ARRAY_SIZE(reason_str))
why = reason_str[reason];
else
why = "Unknown";

mutex_lock(&psinfo->buf_mutex);
oopscount++;
while (total < kmsg_bytes) {
dst = psinfo->buf;
hsize = sprintf(dst, "Oops#%d Part%d\n", oopscount, part++);
hsize = sprintf(dst, "%s#%d Part%d\n", why, oopscount, part++);
size = psinfo->bufsize - hsize;
dst += hsize;

Expand All @@ -86,7 +95,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy);

id = psinfo->write(PSTORE_TYPE_DMESG, hsize + l1_cpy + l2_cpy);
if (pstore_is_mounted())
if (reason == KMSG_DUMP_OOPS && pstore_is_mounted())
pstore_mkfile(PSTORE_TYPE_DMESG, psinfo->name, id,
psinfo->buf, hsize + l1_cpy + l2_cpy,
CURRENT_TIME, psinfo->erase);
Expand Down

0 comments on commit 60a8ee7

Please sign in to comment.