summaryrefslogtreecommitdiff
path: root/include/linux/pstore.h
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-03-06 09:41:10 +0300
committerKees Cook <keescook@chromium.org>2017-03-08 01:01:02 +0300
commit4c9ec219766a217468fb94a281c416455a884dda (patch)
tree9a005a21de1dc1ff39e8033d303149dbebd92705 /include/linux/pstore.h
parentfdd0311863b32b42bb2c54e60c987bbbabc0c430 (diff)
downloadlinux-4c9ec219766a217468fb94a281c416455a884dda.tar.xz
pstore: Remove write_buf() callback
Now that write() and write_buf() are functionally identical, this removes write_buf(), and renames write_buf_user() to write_user(). Additionally adds sanity-checks for pstore_info's declared functions and flags at registration time. Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'include/linux/pstore.h')
-rw-r--r--include/linux/pstore.h29
1 files changed, 10 insertions, 19 deletions
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 9b85d3eeca83..e2233f50f428 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -130,27 +130,19 @@ struct pstore_record {
* available, or negative on error.
*
* @write:
- * Perform a frontend notification of a write to a backend record. The
- * data to be stored has already been written to the registered @buf
- * of the @psi structure.
+ * A newly generated record needs to be written to backend storage.
*
* @record:
- * pointer to record metadata. Note that @buf is NULL, since
- * the @buf registered with @psi is what has been written. The
- * backend is expected to update @id.
+ * pointer to record metadata. When @type is PSTORE_TYPE_DMESG,
+ * @buf will be pointing to the preallocated @psi.buf, since
+ * memory allocation may be broken during an Oops. Regardless,
+ * @buf must be proccesed or copied before returning. The
+ * backend is also expected to write @id with something that
+ 8 can help identify this record to a future @erase callback.
*
* Returns 0 on success, and non-zero on error.
*
- * @write_buf:
- * Perform a frontend write to a backend record. The record contains
- * all metadata and the buffer to write to backend storage. (Unlike
- * @write, this does not use the @psi @buf.)
- *
- * @record: pointer to record metadata.
- *
- * Returns 0 on success, and non-zero on error.
- *
- * @write_buf_user:
+ * @write_user:
* Perform a frontend write to a backend record, using a specified
* buffer that is coming directly from userspace, instead of the
* @record @buf.
@@ -188,9 +180,8 @@ struct pstore_info {
int (*close)(struct pstore_info *psi);
ssize_t (*read)(struct pstore_record *record);
int (*write)(struct pstore_record *record);
- int (*write_buf)(struct pstore_record *record);
- int (*write_buf_user)(struct pstore_record *record,
- const char __user *buf);
+ int (*write_user)(struct pstore_record *record,
+ const char __user *buf);
int (*erase)(struct pstore_record *record);
};