From 76cc9580e3fbd323651d06e8184a5a54e0e1066e Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Fri, 3 Mar 2017 23:28:53 -0800 Subject: pstore: Replace arguments for write() API Similar to the pstore_info read() callback, there were too many arguments. This switches to the new struct pstore_record pointer instead. This adds "reason" and "part" to the record structure as well. Signed-off-by: Kees Cook --- include/linux/pstore.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'include/linux/pstore.h') diff --git a/include/linux/pstore.h b/include/linux/pstore.h index 22a46ebbe041..9335f75c3ddb 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h @@ -54,23 +54,32 @@ struct pstore_info; * @type: pstore record type * @id: per-type unique identifier for record * @time: timestamp of the record - * @count: for PSTORE_TYPE_DMESG, the Oops count. - * @compressed: for PSTORE_TYPE_DMESG, whether the buffer is compressed * @buf: pointer to record contents * @size: size of @buf * @ecc_notice_size: * ECC information for @buf + * + * Valid for PSTORE_TYPE_DMESG @type: + * + * @count: Oops count since boot + * @reason: kdump reason for notification + * @part: position in a multipart record + * @compressed: whether the buffer is compressed + * */ struct pstore_record { struct pstore_info *psi; enum pstore_type_id type; u64 id; struct timespec time; - int count; - bool compressed; char *buf; ssize_t size; ssize_t ecc_notice_size; + + int count; + enum kmsg_dump_reason reason; + unsigned int part; + bool compressed; }; /** @@ -125,16 +134,10 @@ struct pstore_record { * data to be stored has already been written to the registered @buf * of the @psi structure. * - * @type: in: pstore record type to write - * @reason: - * in: pstore write reason - * @id: out: unique identifier for the record - * @part: in: position in a multipart write - * @count: in: increasing from 0 since boot, the number of this Oops - * @compressed: - * in: if the record is compressed - * @size: in: size of the write - * @psi: in: pointer to the struct pstore_info for the backend + * @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. * * Returns 0 on success, and non-zero on error. * @@ -203,10 +206,7 @@ struct pstore_info { int (*open)(struct pstore_info *psi); int (*close)(struct pstore_info *psi); ssize_t (*read)(struct pstore_record *record); - int (*write)(enum pstore_type_id type, - enum kmsg_dump_reason reason, u64 *id, - unsigned int part, int count, bool compressed, - size_t size, struct pstore_info *psi); + int (*write)(struct pstore_record *record); int (*write_buf)(enum pstore_type_id type, enum kmsg_dump_reason reason, u64 *id, unsigned int part, const char *buf, bool compressed, -- cgit