diff options
author | Kees Cook <keescook@chromium.org> | 2017-03-05 00:27:54 -0800 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2017-03-07 14:01:01 -0800 |
commit | b10b471145f28c219d9ddcc309a67e053776865a (patch) | |
tree | 9c59af1b2a6ef23b7fd36dbdc1a99b56d47d45f2 /fs/pstore/platform.c | |
parent | a61072aae693ba08390f92eed1dd0573fa5c3cd9 (diff) | |
download | linux-b10b471145f28c219d9ddcc309a67e053776865a.tar.gz linux-b10b471145f28c219d9ddcc309a67e053776865a.tar.bz2 linux-b10b471145f28c219d9ddcc309a67e053776865a.zip |
pstore: Replace arguments for write_buf() API
As with the other API updates, this removes the long argument list in favor
of passing a single pstore recaord.
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'fs/pstore/platform.c')
-rw-r--r-- | fs/pstore/platform.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index aa3d6e572ede..5eecf9012459 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -587,8 +587,11 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c) const char *e = s + c; while (s < e) { + struct pstore_record record = { + .type = PSTORE_TYPE_CONSOLE, + .psi = psinfo, + }; unsigned long flags; - u64 id; if (c > psinfo->bufsize) c = psinfo->bufsize; @@ -599,8 +602,9 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c) } else { spin_lock_irqsave(&psinfo->buf_lock, flags); } - psinfo->write_buf(PSTORE_TYPE_CONSOLE, 0, &id, 0, - s, 0, c, psinfo); + record.buf = (char *)s; + record.size = c; + psinfo->write_buf(&record); spin_unlock_irqrestore(&psinfo->buf_lock, flags); s += c; c = e - s; @@ -630,10 +634,9 @@ static void pstore_unregister_console(void) {} static int pstore_write_compat(struct pstore_record *record) { - return record->psi->write_buf(record->type, record->reason, - &record->id, record->part, - psinfo->buf, record->compressed, - record->size, record->psi); + record->buf = psinfo->buf; + + return record->psi->write_buf(record); } static int pstore_write_buf_user_compat(enum pstore_type_id type, @@ -653,6 +656,15 @@ static int pstore_write_buf_user_compat(enum pstore_type_id type, bufsize = psinfo->bufsize; spin_lock_irqsave(&psinfo->buf_lock, flags); for (i = 0; i < size; ) { + struct pstore_record record = { + .type = type, + .reason = reason, + .id = id, + .part = part, + .buf = psinfo->buf, + .compressed = compressed, + .psi = psi, + }; size_t c = min(size - i, bufsize); ret = __copy_from_user(psinfo->buf, buf + i, c); @@ -660,8 +672,8 @@ static int pstore_write_buf_user_compat(enum pstore_type_id type, ret = -EFAULT; break; } - ret = psi->write_buf(type, reason, id, part, psinfo->buf, - compressed, c, psi); + record.size = c; + ret = psi->write_buf(&record); if (unlikely(ret < 0)) break; i += c; |