aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAruna Balakrishnaiah <aruna@linux.vnet.ibm.com>2013-08-16 16:53:49 -0400
committerTony Luck <tony.luck@intel.com>2013-08-19 14:53:34 -0400
commit40594264bd622e0865a981f14b98d9e09bc50b14 (patch)
treec53857f703a551200c60a8bb00a137b6cdcb95ae
parent9ad2cbe0a9b88ee6ee895d03b2c63fa1252c8e52 (diff)
powerpc/pseries: Read and write to the 'compressed' flag of pstore
If data returned from pstore is compressed, nvram's write callback will add a flag ERR_TYPE_KERNEL_PANIC_GZ indicating the data is compressed while writing to nvram. If the data read from nvram is compressed, nvram's read callback will set the flag 'compressed'. The patch adds backward compatibilty with old format oops header when reading from pstore. 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.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 6c4dc52ac0b5..d276cd3edd8f 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -581,6 +581,9 @@ static int nvram_pstore_write(enum pstore_type_id type,
581 oops_hdr->report_length = (u16) size; 581 oops_hdr->report_length = (u16) size;
582 oops_hdr->timestamp = get_seconds(); 582 oops_hdr->timestamp = get_seconds();
583 583
584 if (compressed)
585 err_type = ERR_TYPE_KERNEL_PANIC_GZ;
586
584 rc = nvram_write_os_partition(&oops_log_partition, oops_buf, 587 rc = nvram_write_os_partition(&oops_log_partition, oops_buf,
585 (int) (sizeof(*oops_hdr) + size), err_type, count); 588 (int) (sizeof(*oops_hdr) + size), err_type, count);
586 589
@@ -687,6 +690,11 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
687 return -ENOMEM; 690 return -ENOMEM;
688 memcpy(*buf, buff + hdr_size, length); 691 memcpy(*buf, buff + hdr_size, length);
689 kfree(buff); 692 kfree(buff);
693
694 if (err_type == ERR_TYPE_KERNEL_PANIC_GZ)
695 *compressed = true;
696 else
697 *compressed = false;
690 return length; 698 return length;
691 } 699 }
692 700