summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/apei
diff options
context:
space:
mode:
authorGeliang Tang <geliangtang@163.com>2016-02-18 09:04:22 -0500
committerKees Cook <keescook@chromium.org>2016-06-02 13:59:31 -0400
commit8cfc8ddc99df9509a46043b14af81f5c6a223eab (patch)
treefd5bb1b71a1c8418b672ccfa039babf84251b95a /drivers/acpi/apei
parent235f6d157d43a761052e643b8799f86fdc87b47f (diff)
pstore: add lzo/lz4 compression support
Like zlib compression in pstore, this patch added lzo and lz4 compression support so that users can have more options and better compression ratio. The original code treats the compressed data together with the uncompressed ECC correction notice by using zlib decompress. The ECC correction notice is missing in the decompression process. The treatment also makes lzo and lz4 not working. So I treat them separately by using pstore_decompress() to treat the compressed data, and memcpy() to treat the uncompressed ECC correction notice. Signed-off-by: Geliang Tang <geliangtang@163.com> Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'drivers/acpi/apei')
-rw-r--r--drivers/acpi/apei/erst.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 006c3894c6ea..f096ab3cb54d 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -927,7 +927,8 @@ static int erst_open_pstore(struct pstore_info *psi);
927static int erst_close_pstore(struct pstore_info *psi); 927static int erst_close_pstore(struct pstore_info *psi);
928static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count, 928static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
929 struct timespec *time, char **buf, 929 struct timespec *time, char **buf,
930 bool *compressed, struct pstore_info *psi); 930 bool *compressed, ssize_t *ecc_notice_size,
931 struct pstore_info *psi);
931static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason, 932static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
932 u64 *id, unsigned int part, int count, bool compressed, 933 u64 *id, unsigned int part, int count, bool compressed,
933 size_t size, struct pstore_info *psi); 934 size_t size, struct pstore_info *psi);
@@ -987,7 +988,8 @@ static int erst_close_pstore(struct pstore_info *psi)
987 988
988static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count, 989static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
989 struct timespec *time, char **buf, 990 struct timespec *time, char **buf,
990 bool *compressed, struct pstore_info *psi) 991 bool *compressed, ssize_t *ecc_notice_size,
992 struct pstore_info *psi)
991{ 993{
992 int rc; 994 int rc;
993 ssize_t len = 0; 995 ssize_t len = 0;
@@ -1033,6 +1035,7 @@ skip:
1033 memcpy(*buf, rcd->data, len - sizeof(*rcd)); 1035 memcpy(*buf, rcd->data, len - sizeof(*rcd));
1034 *id = record_id; 1036 *id = record_id;
1035 *compressed = false; 1037 *compressed = false;
1038 *ecc_notice_size = 0;
1036 if (uuid_le_cmp(rcd->sec_hdr.section_type, 1039 if (uuid_le_cmp(rcd->sec_hdr.section_type,
1037 CPER_SECTION_TYPE_DMESG_Z) == 0) { 1040 CPER_SECTION_TYPE_DMESG_Z) == 0) {
1038 *type = PSTORE_TYPE_DMESG; 1041 *type = PSTORE_TYPE_DMESG;