diff options
author | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-07-09 20:10:43 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-17 13:07:09 -0400 |
commit | c2b7113261c5bb49031a15b833e59ea2d8ec4074 (patch) | |
tree | 88e1f754156739a337791ff4d445a6de7d7d4641 /fs/pstore | |
parent | 21f679404a0c28bd5b1b3aff2a7218bbff4cb43d (diff) |
pstore/ram: Convert to write_buf callback
Don't use pstore.buf directly, instead convert the code to write_buf callback
which passes a pointer to a buffer as an argument.
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/ram.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index b39aebbaeb89..74f4111bd0da 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c | |||
@@ -170,11 +170,12 @@ static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz) | |||
170 | return len; | 170 | return len; |
171 | } | 171 | } |
172 | 172 | ||
173 | static int ramoops_pstore_write(enum pstore_type_id type, | 173 | |
174 | enum kmsg_dump_reason reason, | 174 | static int ramoops_pstore_write_buf(enum pstore_type_id type, |
175 | u64 *id, | 175 | enum kmsg_dump_reason reason, |
176 | unsigned int part, | 176 | u64 *id, unsigned int part, |
177 | size_t size, struct pstore_info *psi) | 177 | const char *buf, size_t size, |
178 | struct pstore_info *psi) | ||
178 | { | 179 | { |
179 | struct ramoops_context *cxt = psi->data; | 180 | struct ramoops_context *cxt = psi->data; |
180 | struct persistent_ram_zone *prz = cxt->przs[cxt->dump_write_cnt]; | 181 | struct persistent_ram_zone *prz = cxt->przs[cxt->dump_write_cnt]; |
@@ -183,7 +184,7 @@ static int ramoops_pstore_write(enum pstore_type_id type, | |||
183 | if (type == PSTORE_TYPE_CONSOLE) { | 184 | if (type == PSTORE_TYPE_CONSOLE) { |
184 | if (!cxt->cprz) | 185 | if (!cxt->cprz) |
185 | return -ENOMEM; | 186 | return -ENOMEM; |
186 | persistent_ram_write(cxt->cprz, cxt->pstore.buf, size); | 187 | persistent_ram_write(cxt->cprz, buf, size); |
187 | return 0; | 188 | return 0; |
188 | } | 189 | } |
189 | 190 | ||
@@ -212,7 +213,7 @@ static int ramoops_pstore_write(enum pstore_type_id type, | |||
212 | hlen = ramoops_write_kmsg_hdr(prz); | 213 | hlen = ramoops_write_kmsg_hdr(prz); |
213 | if (size + hlen > prz->buffer_size) | 214 | if (size + hlen > prz->buffer_size) |
214 | size = prz->buffer_size - hlen; | 215 | size = prz->buffer_size - hlen; |
215 | persistent_ram_write(prz, cxt->pstore.buf, size); | 216 | persistent_ram_write(prz, buf, size); |
216 | 217 | ||
217 | cxt->dump_write_cnt = (cxt->dump_write_cnt + 1) % cxt->max_dump_cnt; | 218 | cxt->dump_write_cnt = (cxt->dump_write_cnt + 1) % cxt->max_dump_cnt; |
218 | 219 | ||
@@ -250,7 +251,7 @@ static struct ramoops_context oops_cxt = { | |||
250 | .name = "ramoops", | 251 | .name = "ramoops", |
251 | .open = ramoops_pstore_open, | 252 | .open = ramoops_pstore_open, |
252 | .read = ramoops_pstore_read, | 253 | .read = ramoops_pstore_read, |
253 | .write = ramoops_pstore_write, | 254 | .write_buf = ramoops_pstore_write_buf, |
254 | .erase = ramoops_pstore_erase, | 255 | .erase = ramoops_pstore_erase, |
255 | }, | 256 | }, |
256 | }; | 257 | }; |