]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
pstore: Pass header size in the pstore write callback
authorAruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
Thu, 27 Jun 2013 08:32:56 +0000 (14:02 +0530)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 1 Jul 2013 08:10:48 +0000 (18:10 +1000)
Header size is needed to distinguish between header and the dump data.
Incorporate the addition of new argument (hsize) in the pstore write
callback.

Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/pseries/nvram.c
drivers/acpi/apei/erst.c
drivers/firmware/efi/efi-pstore.c
fs/pstore/platform.c
fs/pstore/ram.c
include/linux/pstore.h

index 14cc486709f6caea23497f0309eb70f1e90e0b6f..3f0e7d67d7478119ba40582fb1371af5e633ab39 100644 (file)
@@ -502,6 +502,7 @@ static int nvram_pstore_open(struct pstore_info *psi)
  * @part:               pstore writes data to registered buffer in parts,
  *                      part number will indicate the same.
  * @count:              Indicates oops count
+ * @hsize:              Size of header added by pstore
  * @size:               number of bytes written to the registered buffer
  * @psi:                registered pstore_info structure
  *
@@ -512,7 +513,8 @@ static int nvram_pstore_open(struct pstore_info *psi)
 static int nvram_pstore_write(enum pstore_type_id type,
                                enum kmsg_dump_reason reason,
                                u64 *id, unsigned int part, int count,
-                               size_t size, struct pstore_info *psi)
+                               size_t hsize, size_t size,
+                               struct pstore_info *psi)
 {
        int rc;
        struct oops_log_info *oops_hdr = (struct oops_log_info *) oops_buf;
index 6d894bfd8b8fe8d7aa8f22642a42aa26ce9a68eb..a9cf96085f85bc4523851b974ab09333a96fb407 100644 (file)
@@ -935,7 +935,7 @@ static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
                           struct timespec *time, char **buf,
                           struct pstore_info *psi);
 static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
-                      u64 *id, unsigned int part, int count,
+                      u64 *id, unsigned int part, int count, size_t hsize,
                       size_t size, struct pstore_info *psi);
 static int erst_clearer(enum pstore_type_id type, u64 id, int count,
                        struct timespec time, struct pstore_info *psi);
@@ -1055,7 +1055,7 @@ out:
 }
 
 static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
-                      u64 *id, unsigned int part, int count,
+                      u64 *id, unsigned int part, int count, size_t hsize,
                       size_t size, struct pstore_info *psi)
 {
        struct cper_pstore_record *rcd = (struct cper_pstore_record *)
index 202d2c85ba2e79e2db866e78a03dffa240967f25..452800e005b63d0f274a37bf20df6a762c81a7e4 100644 (file)
@@ -104,7 +104,7 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type,
 
 static int efi_pstore_write(enum pstore_type_id type,
                enum kmsg_dump_reason reason, u64 *id,
-               unsigned int part, int count, size_t size,
+               unsigned int part, int count, size_t hsize, size_t size,
                struct pstore_info *psi)
 {
        char name[DUMP_NAME_LEN];
index 86d1038b5a1292b464c561ba7086518cdd7eaf80..4637ec4169cda589d1c230bc09699ed96b97ad60 100644 (file)
@@ -159,7 +159,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
                        break;
 
                ret = psinfo->write(PSTORE_TYPE_DMESG, reason, &id, part,
-                                   oopscount, hsize + len, psinfo);
+                                   oopscount, hsize, hsize + len, psinfo);
                if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted())
                        pstore_new_entry = 1;
 
@@ -196,7 +196,7 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c)
                        spin_lock_irqsave(&psinfo->buf_lock, flags);
                }
                memcpy(psinfo->buf, s, c);
-               psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, 0, c, psinfo);
+               psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, 0, 0, c, psinfo);
                spin_unlock_irqrestore(&psinfo->buf_lock, flags);
                s += c;
                c = e - s;
@@ -221,9 +221,11 @@ static void pstore_register_console(void) {}
 static int pstore_write_compat(enum pstore_type_id type,
                               enum kmsg_dump_reason reason,
                               u64 *id, unsigned int part, int count,
-                              size_t size, struct pstore_info *psi)
+                              size_t hsize, size_t size,
+                              struct pstore_info *psi)
 {
-       return psi->write_buf(type, reason, id, part, psinfo->buf, size, psi);
+       return psi->write_buf(type, reason, id, part, psinfo->buf, hsize,
+                            size, psi);
 }
 
 /*
index 1376e5a8f0d6c6cfa430f87ed31d36cc9af5e007..c6bb77ca35b5b02b440c9b0617e7f6309b69190b 100644 (file)
@@ -195,7 +195,8 @@ static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz)
 static int notrace ramoops_pstore_write_buf(enum pstore_type_id type,
                                            enum kmsg_dump_reason reason,
                                            u64 *id, unsigned int part,
-                                           const char *buf, size_t size,
+                                           const char *buf,
+                                           size_t hsize, size_t size,
                                            struct pstore_info *psi)
 {
        struct ramoops_context *cxt = psi->data;
index 656699fcc7d7fca0e9c8641466c87f1f9d16cfc5..4aa80ba830a267d12ffef09ef2034d7a82dcbe7e 100644 (file)
@@ -58,12 +58,12 @@ struct pstore_info {
                        struct pstore_info *psi);
        int             (*write)(enum pstore_type_id type,
                        enum kmsg_dump_reason reason, u64 *id,
-                       unsigned int part, int count, size_t size,
-                       struct pstore_info *psi);
+                       unsigned int part, int count, size_t hsize,
+                       size_t size, struct pstore_info *psi);
        int             (*write_buf)(enum pstore_type_id type,
                        enum kmsg_dump_reason reason, u64 *id,
-                       unsigned int part, const char *buf, size_t size,
-                       struct pstore_info *psi);
+                       unsigned int part, const char *buf, size_t hsize,
+                       size_t size, struct pstore_info *psi);
        int             (*erase)(enum pstore_type_id type, u64 id,
                        int count, struct timespec time,
                        struct pstore_info *psi);