aboutsummaryrefslogtreecommitdiffstats
path: root/fs/pstore
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2011-11-17 16:13:29 -0500
committerTony Luck <tony.luck@intel.com>2011-11-17 16:13:29 -0500
commit3d6d8d20ec4fd3b256632edb373a9c504724b8a9 (patch)
tree6bb1a530bb50fcdb24a2db48d095480e741ae371 /fs/pstore
parentf6f8285132907757ef84ef8dae0a1244b8cde6ac (diff)
pstore: pass reason to backend write callback
This allows a backend to filter on the dmesg reason as well as the pstore reason. When ramoops is switched to pstore, this is needed since it has no interest in storing non-crash dmesg details. Drop pstore_write() as it has no users, and handling the "reason" here has no obviously correct value. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'fs/pstore')
-rw-r--r--fs/pstore/platform.c30
1 files changed, 1 insertions, 29 deletions
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 57bbf9078ac8..f146d89179bf 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -122,7 +122,7 @@ 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 ret = psinfo->write(PSTORE_TYPE_DMESG, &id, part, 125 ret = psinfo->write(PSTORE_TYPE_DMESG, reason, &id, part,
126 hsize + l1_cpy + l2_cpy, psinfo); 126 hsize + l1_cpy + l2_cpy, psinfo);
127 if (ret == 0 && 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;
@@ -243,33 +243,5 @@ static void pstore_timefunc(unsigned long dummy)
243 mod_timer(&pstore_timer, jiffies + PSTORE_INTERVAL); 243 mod_timer(&pstore_timer, jiffies + PSTORE_INTERVAL);
244} 244}
245 245
246/*
247 * Call platform driver to write a record to the
248 * persistent store.
249 */
250int pstore_write(enum pstore_type_id type, char *buf, size_t size)
251{
252 u64 id;
253 int ret;
254 unsigned long flags;
255
256 if (!psinfo)
257 return -ENODEV;
258
259 if (size > psinfo->bufsize)
260 return -EFBIG;
261
262 spin_lock_irqsave(&psinfo->buf_lock, flags);
263 memcpy(psinfo->buf, buf, size);
264 ret = psinfo->write(type, &id, 0, size, psinfo);
265 if (ret == 0 && pstore_is_mounted())
266 pstore_mkfile(PSTORE_TYPE_DMESG, psinfo->name, id, psinfo->buf,
267 size, CURRENT_TIME, psinfo);
268 spin_unlock_irqrestore(&psinfo->buf_lock, flags);
269
270 return 0;
271}
272EXPORT_SYMBOL_GPL(pstore_write);
273
274module_param(backend, charp, 0444); 246module_param(backend, charp, 0444);
275MODULE_PARM_DESC(backend, "Pstore backend to use"); 247MODULE_PARM_DESC(backend, "Pstore backend to use");