aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAruna Balakrishnaiah <aruna@linux.vnet.ibm.com>2013-08-16 16:52:47 -0400
committerTony Luck <tony.luck@intel.com>2013-08-19 13:18:10 -0400
commitb3b515bbd689ba3937cac2dd3fc55057f8c50329 (patch)
tree19cca07f50fb439d6e7d678516db2a9568b3e7ef
parenta3a5e94131d96ecdee7b1873a9d6215dc0ea7fff (diff)
pstore: Add new argument 'compressed' in pstore write callback
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>
-rw-r--r--arch/powerpc/platforms/pseries/nvram.c4
-rw-r--r--drivers/acpi/apei/erst.c4
-rw-r--r--drivers/firmware/efi/efi-pstore.c2
-rw-r--r--fs/pstore/platform.c7
-rw-r--r--fs/pstore/ram.c2
-rw-r--r--include/linux/pstore.h4
6 files changed, 12 insertions, 11 deletions
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index b966458e9b21..dbe5dadb5fcc 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -554,7 +554,7 @@ static int nvram_pstore_open(struct pstore_info *psi)
554 * @part: pstore writes data to registered buffer in parts, 554 * @part: pstore writes data to registered buffer in parts,
555 * part number will indicate the same. 555 * part number will indicate the same.
556 * @count: Indicates oops count 556 * @count: Indicates oops count
557 * @hsize: Size of header added by pstore 557 * @compressed: Flag to indicate the log is compressed
558 * @size: number of bytes written to the registered buffer 558 * @size: number of bytes written to the registered buffer
559 * @psi: registered pstore_info structure 559 * @psi: registered pstore_info structure
560 * 560 *
@@ -565,7 +565,7 @@ static int nvram_pstore_open(struct pstore_info *psi)
565static int nvram_pstore_write(enum pstore_type_id type, 565static int nvram_pstore_write(enum pstore_type_id type,
566 enum kmsg_dump_reason reason, 566 enum kmsg_dump_reason reason,
567 u64 *id, unsigned int part, int count, 567 u64 *id, unsigned int part, int count,
568 size_t hsize, size_t size, 568 bool compressed, size_t size,
569 struct pstore_info *psi) 569 struct pstore_info *psi)
570{ 570{
571 int rc; 571 int rc;
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 6885809abcd8..bcdf8cefcb9e 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -937,7 +937,7 @@ static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
937 struct timespec *time, char **buf, 937 struct timespec *time, char **buf,
938 struct pstore_info *psi); 938 struct pstore_info *psi);
939static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason, 939static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
940 u64 *id, unsigned int part, int count, size_t hsize, 940 u64 *id, unsigned int part, int count, bool compressed,
941 size_t size, struct pstore_info *psi); 941 size_t size, struct pstore_info *psi);
942static int erst_clearer(enum pstore_type_id type, u64 id, int count, 942static int erst_clearer(enum pstore_type_id type, u64 id, int count,
943 struct timespec time, struct pstore_info *psi); 943 struct timespec time, struct pstore_info *psi);
@@ -1057,7 +1057,7 @@ out:
1057} 1057}
1058 1058
1059static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason, 1059static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
1060 u64 *id, unsigned int part, int count, size_t hsize, 1060 u64 *id, unsigned int part, int count, bool compressed,
1061 size_t size, struct pstore_info *psi) 1061 size_t size, struct pstore_info *psi)
1062{ 1062{
1063 struct cper_pstore_record *rcd = (struct cper_pstore_record *) 1063 struct cper_pstore_record *rcd = (struct cper_pstore_record *)
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c
index 73de5a9c2247..fab6892f7053 100644
--- a/drivers/firmware/efi/efi-pstore.c
+++ b/drivers/firmware/efi/efi-pstore.c
@@ -103,7 +103,7 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type,
103 103
104static int efi_pstore_write(enum pstore_type_id type, 104static int efi_pstore_write(enum pstore_type_id type,
105 enum kmsg_dump_reason reason, u64 *id, 105 enum kmsg_dump_reason reason, u64 *id,
106 unsigned int part, int count, size_t hsize, size_t size, 106 unsigned int part, int count, bool compressed, size_t size,
107 struct pstore_info *psi) 107 struct pstore_info *psi)
108{ 108{
109 char name[DUMP_NAME_LEN]; 109 char name[DUMP_NAME_LEN];
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 422962ae9fc2..20fa686f80fa 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -149,6 +149,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
149 unsigned long size; 149 unsigned long size;
150 int hsize; 150 int hsize;
151 size_t len; 151 size_t len;
152 bool compressed = false;
152 153
153 dst = psinfo->buf; 154 dst = psinfo->buf;
154 hsize = sprintf(dst, "%s#%d Part%d\n", why, oopscount, part); 155 hsize = sprintf(dst, "%s#%d Part%d\n", why, oopscount, part);
@@ -159,7 +160,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
159 break; 160 break;
160 161
161 ret = psinfo->write(PSTORE_TYPE_DMESG, reason, &id, part, 162 ret = psinfo->write(PSTORE_TYPE_DMESG, reason, &id, part,
162 oopscount, hsize, hsize + len, psinfo); 163 oopscount, compressed, hsize + len, psinfo);
163 if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted()) 164 if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted())
164 pstore_new_entry = 1; 165 pstore_new_entry = 1;
165 166
@@ -221,10 +222,10 @@ static void pstore_register_console(void) {}
221static int pstore_write_compat(enum pstore_type_id type, 222static int pstore_write_compat(enum pstore_type_id type,
222 enum kmsg_dump_reason reason, 223 enum kmsg_dump_reason reason,
223 u64 *id, unsigned int part, int count, 224 u64 *id, unsigned int part, int count,
224 size_t hsize, size_t size, 225 bool compressed, size_t size,
225 struct pstore_info *psi) 226 struct pstore_info *psi)
226{ 227{
227 return psi->write_buf(type, reason, id, part, psinfo->buf, hsize, 228 return psi->write_buf(type, reason, id, part, psinfo->buf, compressed,
228 size, psi); 229 size, psi);
229} 230}
230 231
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index a6119f9469e2..fe7188f742b7 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -196,7 +196,7 @@ static int notrace ramoops_pstore_write_buf(enum pstore_type_id type,
196 enum kmsg_dump_reason reason, 196 enum kmsg_dump_reason reason,
197 u64 *id, unsigned int part, 197 u64 *id, unsigned int part,
198 const char *buf, 198 const char *buf,
199 size_t hsize, size_t size, 199 bool compressed, size_t size,
200 struct pstore_info *psi) 200 struct pstore_info *psi)
201{ 201{
202 struct ramoops_context *cxt = psi->data; 202 struct ramoops_context *cxt = psi->data;
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 4aa80ba830a2..abfca4f59422 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -58,11 +58,11 @@ struct pstore_info {
58 struct pstore_info *psi); 58 struct pstore_info *psi);
59 int (*write)(enum pstore_type_id type, 59 int (*write)(enum pstore_type_id type,
60 enum kmsg_dump_reason reason, u64 *id, 60 enum kmsg_dump_reason reason, u64 *id,
61 unsigned int part, int count, size_t hsize, 61 unsigned int part, int count, bool compressed,
62 size_t size, struct pstore_info *psi); 62 size_t size, struct pstore_info *psi);
63 int (*write_buf)(enum pstore_type_id type, 63 int (*write_buf)(enum pstore_type_id type,
64 enum kmsg_dump_reason reason, u64 *id, 64 enum kmsg_dump_reason reason, u64 *id,
65 unsigned int part, const char *buf, size_t hsize, 65 unsigned int part, const char *buf, bool compressed,
66 size_t size, struct pstore_info *psi); 66 size_t size, struct pstore_info *psi);
67 int (*erase)(enum pstore_type_id type, u64 id, 67 int (*erase)(enum pstore_type_id type, u64 id,
68 int count, struct timespec time, 68 int count, struct timespec time,