diff options
author | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-07-09 20:10:40 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-17 12:51:38 -0400 |
commit | 897dba027445be93f40e5caf550556ca38c48c51 (patch) | |
tree | 22b28b1681dd32d9ff9686009c16a5540ce5bc90 /fs/pstore | |
parent | b2ad368bebc0f772613668e893fa176396e9094c (diff) |
pstore: Introduce write_buf backend callback
For function tracing we need to stop using pstore.buf directly, since
in a tracing callback we can't use spinlocks, and thus we can't safely
use the global buffer.
With write_buf callback, backends no longer need to access pstore.buf
directly, and thus we can pass any buffers (e.g. allocated on stack).
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/pstore')
-rw-r--r-- | fs/pstore/platform.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 6b3ff045fe6e..ef5ca8a0255c 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c | |||
@@ -188,6 +188,14 @@ static void pstore_register_console(void) | |||
188 | static void pstore_register_console(void) {} | 188 | static void pstore_register_console(void) {} |
189 | #endif | 189 | #endif |
190 | 190 | ||
191 | static int pstore_write_compat(enum pstore_type_id type, | ||
192 | enum kmsg_dump_reason reason, | ||
193 | u64 *id, unsigned int part, | ||
194 | size_t size, struct pstore_info *psi) | ||
195 | { | ||
196 | return psi->write_buf(type, reason, id, part, psinfo->buf, size, psi); | ||
197 | } | ||
198 | |||
191 | /* | 199 | /* |
192 | * platform specific persistent storage driver registers with | 200 | * platform specific persistent storage driver registers with |
193 | * us here. If pstore is already mounted, call the platform | 201 | * us here. If pstore is already mounted, call the platform |
@@ -212,6 +220,8 @@ int pstore_register(struct pstore_info *psi) | |||
212 | return -EINVAL; | 220 | return -EINVAL; |
213 | } | 221 | } |
214 | 222 | ||
223 | if (!psi->write) | ||
224 | psi->write = pstore_write_compat; | ||
215 | psinfo = psi; | 225 | psinfo = psi; |
216 | mutex_init(&psinfo->read_mutex); | 226 | mutex_init(&psinfo->read_mutex); |
217 | spin_unlock(&pstore_lock); | 227 | spin_unlock(&pstore_lock); |