提交 c2b71132 编写于 作者: A Anton Vorontsov 提交者: Greg Kroah-Hartman

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: NAnton Vorontsov <anton.vorontsov@linaro.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 21f67940
...@@ -170,11 +170,12 @@ static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz) ...@@ -170,11 +170,12 @@ static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz)
return len; return len;
} }
static int ramoops_pstore_write(enum pstore_type_id type,
enum kmsg_dump_reason reason, static int ramoops_pstore_write_buf(enum pstore_type_id type,
u64 *id, enum kmsg_dump_reason reason,
unsigned int part, u64 *id, unsigned int part,
size_t size, struct pstore_info *psi) const char *buf, size_t size,
struct pstore_info *psi)
{ {
struct ramoops_context *cxt = psi->data; struct ramoops_context *cxt = psi->data;
struct persistent_ram_zone *prz = cxt->przs[cxt->dump_write_cnt]; 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,7 +184,7 @@ static int ramoops_pstore_write(enum pstore_type_id type,
if (type == PSTORE_TYPE_CONSOLE) { if (type == PSTORE_TYPE_CONSOLE) {
if (!cxt->cprz) if (!cxt->cprz)
return -ENOMEM; return -ENOMEM;
persistent_ram_write(cxt->cprz, cxt->pstore.buf, size); persistent_ram_write(cxt->cprz, buf, size);
return 0; return 0;
} }
...@@ -212,7 +213,7 @@ static int ramoops_pstore_write(enum pstore_type_id type, ...@@ -212,7 +213,7 @@ static int ramoops_pstore_write(enum pstore_type_id type,
hlen = ramoops_write_kmsg_hdr(prz); hlen = ramoops_write_kmsg_hdr(prz);
if (size + hlen > prz->buffer_size) if (size + hlen > prz->buffer_size)
size = prz->buffer_size - hlen; size = prz->buffer_size - hlen;
persistent_ram_write(prz, cxt->pstore.buf, size); persistent_ram_write(prz, buf, size);
cxt->dump_write_cnt = (cxt->dump_write_cnt + 1) % cxt->max_dump_cnt; cxt->dump_write_cnt = (cxt->dump_write_cnt + 1) % cxt->max_dump_cnt;
...@@ -250,7 +251,7 @@ static struct ramoops_context oops_cxt = { ...@@ -250,7 +251,7 @@ static struct ramoops_context oops_cxt = {
.name = "ramoops", .name = "ramoops",
.open = ramoops_pstore_open, .open = ramoops_pstore_open,
.read = ramoops_pstore_read, .read = ramoops_pstore_read,
.write = ramoops_pstore_write, .write_buf = ramoops_pstore_write_buf,
.erase = ramoops_pstore_erase, .erase = ramoops_pstore_erase,
}, },
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册