aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAruna Balakrishnaiah <aruna@linux.vnet.ibm.com>2013-08-16 16:53:39 -0400
committerTony Luck <tony.luck@intel.com>2013-08-19 14:53:27 -0400
commit9ad2cbe0a9b88ee6ee895d03b2c63fa1252c8e52 (patch)
treed1fa9f66973963feb802ba28772f9a10e2db5205 /fs
parentadb42f5e105502aff2fc4518b16ba79c203fae4f (diff)
pstore: Add file extension to pstore file if compressed
In case decompression fails, add a ".enc.z" to indicate the file has compressed data. This will help user space utilities to figure out the file contents. 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>
Diffstat (limited to 'fs')
-rw-r--r--fs/pstore/inode.c7
-rw-r--r--fs/pstore/internal.h5
-rw-r--r--fs/pstore/platform.c4
3 files changed, 10 insertions, 6 deletions
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index 6a4123d1849c..12823845d324 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -275,8 +275,8 @@ int pstore_is_mounted(void)
275 * Set the mtime & ctime to the date that this record was originally stored. 275 * Set the mtime & ctime to the date that this record was originally stored.
276 */ 276 */
277int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count, 277int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
278 char *data, size_t size, struct timespec time, 278 char *data, bool compressed, size_t size,
279 struct pstore_info *psi) 279 struct timespec time, struct pstore_info *psi)
280{ 280{
281 struct dentry *root = pstore_sb->s_root; 281 struct dentry *root = pstore_sb->s_root;
282 struct dentry *dentry; 282 struct dentry *dentry;
@@ -315,7 +315,8 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
315 315
316 switch (type) { 316 switch (type) {
317 case PSTORE_TYPE_DMESG: 317 case PSTORE_TYPE_DMESG:
318 sprintf(name, "dmesg-%s-%lld", psname, id); 318 sprintf(name, "dmesg-%s-%lld%s", psname, id,
319 compressed ? ".enc.z" : "");
319 break; 320 break;
320 case PSTORE_TYPE_CONSOLE: 321 case PSTORE_TYPE_CONSOLE:
321 sprintf(name, "console-%s", psname); 322 sprintf(name, "console-%s", psname);
diff --git a/fs/pstore/internal.h b/fs/pstore/internal.h
index 937d820f273c..3b3d305277c4 100644
--- a/fs/pstore/internal.h
+++ b/fs/pstore/internal.h
@@ -50,8 +50,9 @@ extern struct pstore_info *psinfo;
50extern void pstore_set_kmsg_bytes(int); 50extern void pstore_set_kmsg_bytes(int);
51extern void pstore_get_records(int); 51extern void pstore_get_records(int);
52extern int pstore_mkfile(enum pstore_type_id, char *psname, u64 id, 52extern int pstore_mkfile(enum pstore_type_id, char *psname, u64 id,
53 int count, char *data, size_t size, 53 int count, char *data, bool compressed,
54 struct timespec time, struct pstore_info *psi); 54 size_t size, struct timespec time,
55 struct pstore_info *psi);
55extern int pstore_is_mounted(void); 56extern int pstore_is_mounted(void);
56 57
57#endif 58#endif
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 76bc5c12c0cf..4ffb7ab5e397 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -479,13 +479,15 @@ void pstore_get_records(int quiet)
479 if (unzipped_len > 0) { 479 if (unzipped_len > 0) {
480 buf = big_oops_buf; 480 buf = big_oops_buf;
481 size = unzipped_len; 481 size = unzipped_len;
482 compressed = false;
482 } else { 483 } else {
483 pr_err("pstore: decompression failed;" 484 pr_err("pstore: decompression failed;"
484 "returned %d\n", unzipped_len); 485 "returned %d\n", unzipped_len);
486 compressed = true;
485 } 487 }
486 } 488 }
487 rc = pstore_mkfile(type, psi->name, id, count, buf, 489 rc = pstore_mkfile(type, psi->name, id, count, buf,
488 (size_t)size, time, psi); 490 compressed, (size_t)size, time, psi);
489 if (unzipped_len < 0) { 491 if (unzipped_len < 0) {
490 /* Free buffer other than big oops */ 492 /* Free buffer other than big oops */
491 kfree(buf); 493 kfree(buf);