aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChen Gong <gong.chen@linux.intel.com>2011-10-12 12:17:24 -0400
committerTony Luck <tony.luck@intel.com>2011-10-12 12:17:24 -0400
commitb238b8fa93353ab50c9a2b1e2fa47a0ab01c37cd (patch)
treea46a6ce7567d9826ae48c2f3dc5aa0167de1f26c /fs
parentabd4d5587be911f63592537284dad78766d97d62 (diff)
pstore: make pstore write function return normal success/fail value
Currently pstore write interface employs record id as return value, but it is not enough because it can't tell caller if the write operation is successful. Pass the record id back via an argument pointer and return zero for success, non-zero for failure. Signed-off-by: Chen Gong <gong.chen@linux.intel.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/pstore/platform.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 0472924024cc..2bd620f0d796 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -87,7 +87,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
87 unsigned long size, total = 0; 87 unsigned long size, total = 0;
88 char *dst, *why; 88 char *dst, *why;
89 u64 id; 89 u64 id;
90 int hsize; 90 int hsize, ret;
91 unsigned int part = 1; 91 unsigned int part = 1;
92 unsigned long flags = 0; 92 unsigned long flags = 0;
93 int is_locked = 0; 93 int is_locked = 0;
@@ -122,9 +122,9 @@ static void pstore_dump(struct kmsg_dumper *dumper,
122 memcpy(dst, s1 + s1_start, l1_cpy); 122 memcpy(dst, s1 + s1_start, l1_cpy);
123 memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy); 123 memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy);
124 124
125 id = psinfo->write(PSTORE_TYPE_DMESG, part, 125 ret = psinfo->write(PSTORE_TYPE_DMESG, &id, part,
126 hsize + l1_cpy + l2_cpy, psinfo); 126 hsize + l1_cpy + l2_cpy, psinfo);
127 if (reason == KMSG_DUMP_OOPS && pstore_is_mounted()) 127 if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted())
128 pstore_new_entry = 1; 128 pstore_new_entry = 1;
129 l1 -= l1_cpy; 129 l1 -= l1_cpy;
130 l2 -= l2_cpy; 130 l2 -= l2_cpy;
@@ -247,6 +247,7 @@ static void pstore_timefunc(unsigned long dummy)
247int pstore_write(enum pstore_type_id type, char *buf, size_t size) 247int pstore_write(enum pstore_type_id type, char *buf, size_t size)
248{ 248{
249 u64 id; 249 u64 id;
250 int ret;
250 unsigned long flags; 251 unsigned long flags;
251 252
252 if (!psinfo) 253 if (!psinfo)
@@ -257,8 +258,8 @@ int pstore_write(enum pstore_type_id type, char *buf, size_t size)
257 258
258 spin_lock_irqsave(&psinfo->buf_lock, flags); 259 spin_lock_irqsave(&psinfo->buf_lock, flags);
259 memcpy(psinfo->buf, buf, size); 260 memcpy(psinfo->buf, buf, size);
260 id = psinfo->write(type, 0, size, psinfo); 261 ret = psinfo->write(type, &id, 0, size, psinfo);
261 if (pstore_is_mounted()) 262 if (ret == 0 && pstore_is_mounted())
262 pstore_mkfile(PSTORE_TYPE_DMESG, psinfo->name, id, psinfo->buf, 263 pstore_mkfile(PSTORE_TYPE_DMESG, psinfo->name, id, psinfo->buf,
263 size, CURRENT_TIME, psinfo); 264 size, CURRENT_TIME, psinfo);
264 spin_unlock_irqrestore(&psinfo->buf_lock, flags); 265 spin_unlock_irqrestore(&psinfo->buf_lock, flags);