pstore: Add new argument 'compressed' in pstore write callback
authorAruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
Fri, 16 Aug 2013 20:52:47 +0000 (13:52 -0700)
committerTony Luck <tony.luck@intel.com>
Mon, 19 Aug 2013 17:18:10 +0000 (10:18 -0700)
Addition of new argument 'compressed' in the write call back will
help the backend to know if the data passed from pstore is compressed
or not (In case where compression fails.). If compressed, the backend
can add a tag indicating the data is compressed while writing to
persistent store.

Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Tony Luck <tony.luck@intel.com>
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 b966458e9b219dbce57f1629e306f1da4b0cb396..dbe5dadb5fccf32d47b09ae94349997cf8bcdb65 100644 (file)
@@ -554,7 +554,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
+ * @compressed:         Flag to indicate the log is compressed
  * @size:               number of bytes written to the registered buffer
  * @psi:                registered pstore_info structure
  *
@@ -565,7 +565,7 @@ 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 hsize, size_t size,
+                               bool compressed, size_t size,
                                struct pstore_info *psi)
 {
        int rc;
index 6885809abcd8e283ed32425c7a508df3ac9c9d6f..bcdf8cefcb9e5190b36839ea0503d1a5b1d0b6c2 100644 (file)
@@ -937,7 +937,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, size_t hsize,
+                      u64 *id, unsigned int part, int count, bool compressed,
                       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);
@@ -1057,7 +1057,7 @@ out:
 }
 
 static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
-                      u64 *id, unsigned int part, int count, size_t hsize,
+                      u64 *id, unsigned int part, int count, bool compressed,
                       size_t size, struct pstore_info *psi)
 {
        struct cper_pstore_record *rcd = (struct cper_pstore_record *)
index 73de5a9c22473bc66890efc3cea2caf9c0c3e66f..fab6892f70533dd2f753943d4cd0f80964bae461 100644 (file)
@@ -103,7 +103,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 hsize, size_t size,
+               unsigned int part, int count, bool compressed, size_t size,
                struct pstore_info *psi)
 {
        char name[DUMP_NAME_LEN];
index 422962ae9fc241ed05bddddd2a313150d5853f0b..20fa686f80fa268e9620cb1d544d294203c147a2 100644 (file)
@@ -149,6 +149,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
                unsigned long size;
                int hsize;
                size_t len;
+               bool compressed = false;
 
                dst = psinfo->buf;
                hsize = sprintf(dst, "%s#%d Part%d\n", why, oopscount, part);
@@ -159,7 +160,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
                        break;
 
                ret = psinfo->write(PSTORE_TYPE_DMESG, reason, &id, part,
-                                   oopscount, hsize, hsize + len, psinfo);
+                                   oopscount, compressed, hsize + len, psinfo);
                if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted())
                        pstore_new_entry = 1;
 
@@ -221,10 +222,10 @@ 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 hsize, size_t size,
+                              bool compressed, size_t size,
                               struct pstore_info *psi)
 {
-       return psi->write_buf(type, reason, id, part, psinfo->buf, hsize,
+       return psi->write_buf(type, reason, id, part, psinfo->buf, compressed,
                             size, psi);
 }
 
index a6119f9469e20f26bbae18292d365100b63029d0..fe7188f742b7df62dc52d8a5102655dd8746662d 100644 (file)
@@ -196,7 +196,7 @@ 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 hsize, size_t size,
+                                           bool compressed, size_t size,
                                            struct pstore_info *psi)
 {
        struct ramoops_context *cxt = psi->data;
index 4aa80ba830a267d12ffef09ef2034d7a82dcbe7e..abfca4f594225b6813def393ce1daa7b699f023f 100644 (file)
@@ -58,11 +58,11 @@ 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 hsize,
+                       unsigned int part, int count, bool compressed,
                        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 hsize,
+                       unsigned int part, const char *buf, bool compressed,
                        size_t size, struct pstore_info *psi);
        int             (*erase)(enum pstore_type_id type, u64 id,
                        int count, struct timespec time,