* [PATCH] pstore: add lz4hc and 842 compression support @ 2017-08-28 13:56 Geliang Tang 2017-11-02 2:38 ` [PATCH v2] " Geliang Tang 2017-11-29 1:44 ` [PATCH] " Kees Cook 0 siblings, 2 replies; 7+ messages in thread From: Geliang Tang @ 2017-08-28 13:56 UTC (permalink / raw) To: Kees Cook, Anton Vorontsov, Colin Cross, Tony Luck Cc: Geliang Tang, linux-kernel Currently, pstore has supported three compression algorithms: zlib, lzo and lz4. This patch added two more compression algorithms: lz4hc and 842. Signed-off-by: Geliang Tang <geliangtang@gmail.com> --- fs/pstore/Kconfig | 14 ++++++ fs/pstore/platform.c | 128 +++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 127 insertions(+), 15 deletions(-) diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig index b42e5bd..e288596 100644 --- a/fs/pstore/Kconfig +++ b/fs/pstore/Kconfig @@ -39,6 +39,20 @@ config PSTORE_LZ4_COMPRESS select LZ4_DECOMPRESS help This option enables LZ4 compression algorithm support. + +config PSTORE_LZ4HC_COMPRESS + bool "LZ4HC" + select LZ4HC_COMPRESS + select LZ4_DECOMPRESS + help + This option enables LZ4 high compression mode algorithm. + +config PSTORE_842_COMPRESS + bool "842" + select 842_COMPRESS + select 842_DECOMPRESS + help + This option enables 842 compression algorithm support. endchoice config PSTORE_CONSOLE diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 2b21d18..252c320 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -34,9 +34,12 @@ #ifdef CONFIG_PSTORE_LZO_COMPRESS #include <linux/lzo.h> #endif -#ifdef CONFIG_PSTORE_LZ4_COMPRESS +#if defined(CONFIG_PSTORE_LZ4_COMPRESS) || defined(CONFIG_PSTORE_LZ4HC_COMPRESS) #include <linux/lz4.h> #endif +#ifdef CONFIG_PSTORE_842_COMPRESS +#include <linux/sw842.h> +#endif #include <linux/string.h> #include <linux/timer.h> #include <linux/slab.h> @@ -337,20 +340,7 @@ static const struct pstore_zbackend backend_lzo = { }; #endif -#ifdef CONFIG_PSTORE_LZ4_COMPRESS -static int compress_lz4(const void *in, void *out, size_t inlen, size_t outlen) -{ - int ret; - - ret = LZ4_compress_default(in, out, inlen, outlen, workspace); - if (!ret) { - pr_err("LZ4_compress_default error; compression failed!\n"); - return -EIO; - } - - return ret; -} - +#if defined(CONFIG_PSTORE_LZ4_COMPRESS) || defined(CONFIG_PSTORE_LZ4HC_COMPRESS) static int decompress_lz4(void *in, void *out, size_t inlen, size_t outlen) { int ret; @@ -392,6 +382,21 @@ static void free_lz4(void) big_oops_buf = NULL; big_oops_buf_sz = 0; } +#endif + +#ifdef CONFIG_PSTORE_LZ4_COMPRESS +static int compress_lz4(const void *in, void *out, size_t inlen, size_t outlen) +{ + int ret; + + ret = LZ4_compress_default(in, out, inlen, outlen, workspace); + if (!ret) { + pr_err("LZ4_compress_default error; compression failed!\n"); + return -EIO; + } + + return ret; +} static const struct pstore_zbackend backend_lz4 = { .compress = compress_lz4, @@ -402,6 +407,95 @@ static const struct pstore_zbackend backend_lz4 = { }; #endif +#ifdef CONFIG_PSTORE_LZ4HC_COMPRESS +static int compress_lz4hc(const void *in, void *out, + size_t inlen, size_t outlen) +{ + int ret; + + ret = LZ4_compress_HC(in, out, inlen, outlen, + LZ4HC_DEFAULT_CLEVEL, workspace); + if (!ret) { + pr_err("LZ4_compress_HC error; compression failed!\n"); + return -EIO; + } + + return ret; +} + +static const struct pstore_zbackend backend_lz4hc = { + .compress = compress_lz4hc, + .decompress = decompress_lz4, + .allocate = allocate_lz4, + .free = free_lz4, + .name = "lz4hc", +}; +#endif + +#ifdef CONFIG_PSTORE_842_COMPRESS +static int compress_842(const void *in, void *out, size_t inlen, size_t outlen) +{ + int ret; + unsigned int len; + + ret = sw842_compress(in, inlen, out, &len, workspace); + if (!ret) { + pr_err("sw842_compress error; compression failed!\n"); + return -EIO; + } + outlen = len; + + return ret; +} + +static int decompress_842(void *in, void *out, size_t inlen, size_t outlen) +{ + int ret; + unsigned int len; + + ret = sw842_decompress(in, inlen, out, &len); + if (ret < 0) { + pr_err("sw842_decompress error, ret = %d!\n", ret); + return -EIO; + } + outlen = len; + + return ret; +} + +static void allocate_842(void) +{ + big_oops_buf_sz = psinfo->bufsize * 2; + big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); + if (big_oops_buf) { + workspace = kmalloc(SW842_MEM_COMPRESS, GFP_KERNEL); + if (!workspace) { + kfree(big_oops_buf); + big_oops_buf = NULL; + } + } else { + pr_err("No memory for uncompressed data; skipping compression\n"); + workspace = NULL; + } +} + +static void free_842(void) +{ + kfree(workspace); + kfree(big_oops_buf); + big_oops_buf = NULL; + big_oops_buf_sz = 0; +} + +static const struct pstore_zbackend backend_842 = { + .compress = compress_842, + .decompress = decompress_842, + .allocate = allocate_842, + .free = free_842, + .name = "842", +}; +#endif + static const struct pstore_zbackend *zbackend = #if defined(CONFIG_PSTORE_ZLIB_COMPRESS) &backend_zlib; @@ -409,6 +503,10 @@ static const struct pstore_zbackend *zbackend = &backend_lzo; #elif defined(CONFIG_PSTORE_LZ4_COMPRESS) &backend_lz4; +#elif defined(CONFIG_PSTORE_LZ4HC_COMPRESS) + &backend_lz4hc; +#elif defined(CONFIG_PSTORE_842_COMPRESS) + &backend_842; #else NULL; #endif -- 2.9.3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2] pstore: add lz4hc and 842 compression support 2017-08-28 13:56 [PATCH] pstore: add lz4hc and 842 compression support Geliang Tang @ 2017-11-02 2:38 ` Geliang Tang 2017-11-29 1:44 ` [PATCH] " Kees Cook 1 sibling, 0 replies; 7+ messages in thread From: Geliang Tang @ 2017-11-02 2:38 UTC (permalink / raw) To: Kees Cook, Anton Vorontsov, Colin Cross, Tony Luck Cc: Geliang Tang, linux-kernel From: Geliang Tang <geliangtang@gmail.com> Currently, pstore has supported three compression algorithms: zlib, lzo and lz4. This patch added two more compression algorithms: lz4hc and 842. Signed-off-by: Geliang Tang <geliangtang@gmail.com> --- Changes in v2: fix checkpatch.pl WARNING: please write a paragraph that describes the config symbol fully --- fs/pstore/Kconfig | 25 ++++++++++ fs/pstore/platform.c | 128 +++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 138 insertions(+), 15 deletions(-) diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig index b42e5bd..cf97a3e 100644 --- a/fs/pstore/Kconfig +++ b/fs/pstore/Kconfig @@ -39,6 +39,31 @@ config PSTORE_LZ4_COMPRESS select LZ4_DECOMPRESS help This option enables LZ4 compression algorithm support. + +config PSTORE_LZ4HC_COMPRESS + bool "LZ4HC" + select LZ4HC_COMPRESS + select LZ4_DECOMPRESS + help + This option enables LZ4 high compression mode algorithm. + + Currently, pstore has supported five compression algorithms: + zlib, lzo, lz4, lz4hc and 842. + + The default compression algorithm is zlib. + +config PSTORE_842_COMPRESS + bool "842" + select 842_COMPRESS + select 842_DECOMPRESS + help + This option enables 842 compression algorithm support. + + Currently, pstore has supported five compression algorithms: + zlib, lzo, lz4, lz4hc and 842. + + The default compression algorithm is zlib. + endchoice config PSTORE_CONSOLE diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index ec7199e..def0210 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -34,9 +34,12 @@ #ifdef CONFIG_PSTORE_LZO_COMPRESS #include <linux/lzo.h> #endif -#ifdef CONFIG_PSTORE_LZ4_COMPRESS +#if defined(CONFIG_PSTORE_LZ4_COMPRESS) || defined(CONFIG_PSTORE_LZ4HC_COMPRESS) #include <linux/lz4.h> #endif +#ifdef CONFIG_PSTORE_842_COMPRESS +#include <linux/sw842.h> +#endif #include <linux/string.h> #include <linux/timer.h> #include <linux/slab.h> @@ -337,20 +340,7 @@ static const struct pstore_zbackend backend_lzo = { }; #endif -#ifdef CONFIG_PSTORE_LZ4_COMPRESS -static int compress_lz4(const void *in, void *out, size_t inlen, size_t outlen) -{ - int ret; - - ret = LZ4_compress_default(in, out, inlen, outlen, workspace); - if (!ret) { - pr_err("LZ4_compress_default error; compression failed!\n"); - return -EIO; - } - - return ret; -} - +#if defined(CONFIG_PSTORE_LZ4_COMPRESS) || defined(CONFIG_PSTORE_LZ4HC_COMPRESS) static int decompress_lz4(void *in, void *out, size_t inlen, size_t outlen) { int ret; @@ -392,6 +382,21 @@ static void free_lz4(void) big_oops_buf = NULL; big_oops_buf_sz = 0; } +#endif + +#ifdef CONFIG_PSTORE_LZ4_COMPRESS +static int compress_lz4(const void *in, void *out, size_t inlen, size_t outlen) +{ + int ret; + + ret = LZ4_compress_default(in, out, inlen, outlen, workspace); + if (!ret) { + pr_err("LZ4_compress_default error; compression failed!\n"); + return -EIO; + } + + return ret; +} static const struct pstore_zbackend backend_lz4 = { .compress = compress_lz4, @@ -402,6 +407,95 @@ static const struct pstore_zbackend backend_lz4 = { }; #endif +#ifdef CONFIG_PSTORE_LZ4HC_COMPRESS +static int compress_lz4hc(const void *in, void *out, + size_t inlen, size_t outlen) +{ + int ret; + + ret = LZ4_compress_HC(in, out, inlen, outlen, + LZ4HC_DEFAULT_CLEVEL, workspace); + if (!ret) { + pr_err("LZ4_compress_HC error; compression failed!\n"); + return -EIO; + } + + return ret; +} + +static const struct pstore_zbackend backend_lz4hc = { + .compress = compress_lz4hc, + .decompress = decompress_lz4, + .allocate = allocate_lz4, + .free = free_lz4, + .name = "lz4hc", +}; +#endif + +#ifdef CONFIG_PSTORE_842_COMPRESS +static int compress_842(const void *in, void *out, size_t inlen, size_t outlen) +{ + int ret; + unsigned int len; + + ret = sw842_compress(in, inlen, out, &len, workspace); + if (!ret) { + pr_err("sw842_compress error; compression failed!\n"); + return -EIO; + } + outlen = len; + + return ret; +} + +static int decompress_842(void *in, void *out, size_t inlen, size_t outlen) +{ + int ret; + unsigned int len; + + ret = sw842_decompress(in, inlen, out, &len); + if (ret < 0) { + pr_err("sw842_decompress error, ret = %d!\n", ret); + return -EIO; + } + outlen = len; + + return ret; +} + +static void allocate_842(void) +{ + big_oops_buf_sz = psinfo->bufsize * 2; + big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); + if (big_oops_buf) { + workspace = kmalloc(SW842_MEM_COMPRESS, GFP_KERNEL); + if (!workspace) { + kfree(big_oops_buf); + big_oops_buf = NULL; + } + } else { + pr_err("No memory for uncompressed data; skipping compression\n"); + workspace = NULL; + } +} + +static void free_842(void) +{ + kfree(workspace); + kfree(big_oops_buf); + big_oops_buf = NULL; + big_oops_buf_sz = 0; +} + +static const struct pstore_zbackend backend_842 = { + .compress = compress_842, + .decompress = decompress_842, + .allocate = allocate_842, + .free = free_842, + .name = "842", +}; +#endif + static const struct pstore_zbackend *zbackend = #if defined(CONFIG_PSTORE_ZLIB_COMPRESS) &backend_zlib; @@ -409,6 +503,10 @@ static const struct pstore_zbackend *zbackend = &backend_lzo; #elif defined(CONFIG_PSTORE_LZ4_COMPRESS) &backend_lz4; +#elif defined(CONFIG_PSTORE_LZ4HC_COMPRESS) + &backend_lz4hc; +#elif defined(CONFIG_PSTORE_842_COMPRESS) + &backend_842; #else NULL; #endif -- 2.9.3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] pstore: add lz4hc and 842 compression support 2017-08-28 13:56 [PATCH] pstore: add lz4hc and 842 compression support Geliang Tang 2017-11-02 2:38 ` [PATCH v2] " Geliang Tang @ 2017-11-29 1:44 ` Kees Cook 2018-02-11 14:37 ` Geliang Tang 1 sibling, 1 reply; 7+ messages in thread From: Kees Cook @ 2017-11-29 1:44 UTC (permalink / raw) To: Geliang Tang; +Cc: Anton Vorontsov, Colin Cross, Tony Luck, LKML Sorry for the delay on this review! On Mon, Aug 28, 2017 at 6:56 AM, Geliang Tang <geliangtang@gmail.com> wrote: > Currently, pstore has supported three compression algorithms: zlib, > lzo and lz4. This patch added two more compression algorithms: lz4hc > and 842. > > Signed-off-by: Geliang Tang <geliangtang@gmail.com> > --- > fs/pstore/Kconfig | 14 ++++++ > fs/pstore/platform.c | 128 +++++++++++++++++++++++++++++++++++++++++++++------ > 2 files changed, 127 insertions(+), 15 deletions(-) > > diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig > index b42e5bd..e288596 100644 > --- a/fs/pstore/Kconfig > +++ b/fs/pstore/Kconfig > @@ -39,6 +39,20 @@ config PSTORE_LZ4_COMPRESS > select LZ4_DECOMPRESS > help > This option enables LZ4 compression algorithm support. > + > +config PSTORE_LZ4HC_COMPRESS > + bool "LZ4HC" > + select LZ4HC_COMPRESS > + select LZ4_DECOMPRESS > + help > + This option enables LZ4 high compression mode algorithm. > + > +config PSTORE_842_COMPRESS > + bool "842" > + select 842_COMPRESS > + select 842_DECOMPRESS > + help > + This option enables 842 compression algorithm support. > endchoice I'm fine with these short descriptions. checkpatch's warning for "choice" options doesn't always make sense. :) > > config PSTORE_CONSOLE > diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c > index 2b21d18..252c320 100644 > --- a/fs/pstore/platform.c > +++ b/fs/pstore/platform.c > @@ -34,9 +34,12 @@ > #ifdef CONFIG_PSTORE_LZO_COMPRESS > #include <linux/lzo.h> > #endif > -#ifdef CONFIG_PSTORE_LZ4_COMPRESS > +#if defined(CONFIG_PSTORE_LZ4_COMPRESS) || defined(CONFIG_PSTORE_LZ4HC_COMPRESS) > #include <linux/lz4.h> > #endif > +#ifdef CONFIG_PSTORE_842_COMPRESS > +#include <linux/sw842.h> > +#endif > #include <linux/string.h> > #include <linux/timer.h> > #include <linux/slab.h> > @@ -337,20 +340,7 @@ static const struct pstore_zbackend backend_lzo = { > }; > #endif > > -#ifdef CONFIG_PSTORE_LZ4_COMPRESS > -static int compress_lz4(const void *in, void *out, size_t inlen, size_t outlen) > -{ > - int ret; > - > - ret = LZ4_compress_default(in, out, inlen, outlen, workspace); > - if (!ret) { > - pr_err("LZ4_compress_default error; compression failed!\n"); > - return -EIO; > - } > - > - return ret; > -} > - > +#if defined(CONFIG_PSTORE_LZ4_COMPRESS) || defined(CONFIG_PSTORE_LZ4HC_COMPRESS) > static int decompress_lz4(void *in, void *out, size_t inlen, size_t outlen) > { > int ret; > @@ -392,6 +382,21 @@ static void free_lz4(void) > big_oops_buf = NULL; > big_oops_buf_sz = 0; > } > +#endif > + > +#ifdef CONFIG_PSTORE_LZ4_COMPRESS > +static int compress_lz4(const void *in, void *out, size_t inlen, size_t outlen) > +{ > + int ret; > + > + ret = LZ4_compress_default(in, out, inlen, outlen, workspace); > + if (!ret) { > + pr_err("LZ4_compress_default error; compression failed!\n"); > + return -EIO; > + } > + > + return ret; Other compress/decompress return outlen, rather than ret. Is "ret" the outlen here? > +} > > static const struct pstore_zbackend backend_lz4 = { > .compress = compress_lz4, > @@ -402,6 +407,95 @@ static const struct pstore_zbackend backend_lz4 = { > }; > #endif > > +#ifdef CONFIG_PSTORE_LZ4HC_COMPRESS > +static int compress_lz4hc(const void *in, void *out, > + size_t inlen, size_t outlen) > +{ > + int ret; > + > + ret = LZ4_compress_HC(in, out, inlen, outlen, > + LZ4HC_DEFAULT_CLEVEL, workspace); > + if (!ret) { > + pr_err("LZ4_compress_HC error; compression failed!\n"); > + return -EIO; > + } > + > + return ret; And here? > +} > + > +static const struct pstore_zbackend backend_lz4hc = { > + .compress = compress_lz4hc, > + .decompress = decompress_lz4, > + .allocate = allocate_lz4, > + .free = free_lz4, > + .name = "lz4hc", > +}; > +#endif > + > +#ifdef CONFIG_PSTORE_842_COMPRESS > +static int compress_842(const void *in, void *out, size_t inlen, size_t outlen) > +{ > + int ret; > + unsigned int len; > + > + ret = sw842_compress(in, inlen, out, &len, workspace); > + if (!ret) { > + pr_err("sw842_compress error; compression failed!\n"); > + return -EIO; > + } > + outlen = len; This has no effect. What was intended? > + > + return ret; > +} > + > +static int decompress_842(void *in, void *out, size_t inlen, size_t outlen) > +{ > + int ret; > + unsigned int len; > + > + ret = sw842_decompress(in, inlen, out, &len); > + if (ret < 0) { > + pr_err("sw842_decompress error, ret = %d!\n", ret); > + return -EIO; > + } > + outlen = len; Same. > + > + return ret; > +} > + > +static void allocate_842(void) > +{ > + big_oops_buf_sz = psinfo->bufsize * 2; > + big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); > + if (big_oops_buf) { > + workspace = kmalloc(SW842_MEM_COMPRESS, GFP_KERNEL); > + if (!workspace) { > + kfree(big_oops_buf); > + big_oops_buf = NULL; > + } > + } else { > + pr_err("No memory for uncompressed data; skipping compression\n"); > + workspace = NULL; > + } > +} > + > +static void free_842(void) > +{ > + kfree(workspace); > + kfree(big_oops_buf); > + big_oops_buf = NULL; > + big_oops_buf_sz = 0; > +} > + > +static const struct pstore_zbackend backend_842 = { > + .compress = compress_842, > + .decompress = decompress_842, > + .allocate = allocate_842, > + .free = free_842, > + .name = "842", > +}; > +#endif > + > static const struct pstore_zbackend *zbackend = > #if defined(CONFIG_PSTORE_ZLIB_COMPRESS) > &backend_zlib; > @@ -409,6 +503,10 @@ static const struct pstore_zbackend *zbackend = > &backend_lzo; > #elif defined(CONFIG_PSTORE_LZ4_COMPRESS) > &backend_lz4; > +#elif defined(CONFIG_PSTORE_LZ4HC_COMPRESS) > + &backend_lz4hc; > +#elif defined(CONFIG_PSTORE_842_COMPRESS) > + &backend_842; > #else > NULL; > #endif > -- > 2.9.3 > Otherwise this all looks good. Thanks! -Kees -- Kees Cook Pixel Security ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] pstore: add lz4hc and 842 compression support 2017-11-29 1:44 ` [PATCH] " Kees Cook @ 2018-02-11 14:37 ` Geliang Tang 2018-02-11 14:37 ` [PATCH v3] " Geliang Tang 0 siblings, 1 reply; 7+ messages in thread From: Geliang Tang @ 2018-02-11 14:37 UTC (permalink / raw) To: Kees Cook, Anton Vorontsov, Colin Cross, Tony Luck Cc: Geliang Tang, linux-kernel On Tue, Nov 28, 2017 at 05:44:52PM -0800, Kees Cook wrote: > > + > > + ret = LZ4_compress_default(in, out, inlen, outlen, workspace); > > + if (!ret) { > > + pr_err("LZ4_compress_default error; compression failed!\n"); > > + return -EIO; > > + } > > + > > + return ret; > > Other compress/decompress return outlen, rather than ret. Is "ret" the > outlen here? > > > + > > + ret = LZ4_compress_HC(in, out, inlen, outlen, > > + LZ4HC_DEFAULT_CLEVEL, workspace); > > + if (!ret) { > > + pr_err("LZ4_compress_HC error; compression failed!\n"); > > + return -EIO; > > + } > > + > > + return ret; > > And here? > Yes, ret is outlen in LZ4_compress_default and LZ4_compress_HC. > > + > > + ret = sw842_compress(in, inlen, out, &len, workspace); > > + if (!ret) { > > + pr_err("sw842_compress error; compression failed!\n"); > > + return -EIO; > > + } > > + outlen = len; > > This has no effect. What was intended? > > > + ret = sw842_decompress(in, inlen, out, &len); > > + if (ret < 0) { > > + pr_err("sw842_decompress error, ret = %d!\n", ret); > > + return -EIO; > > + } > > + outlen = len; > > Same. > I fixed them in patch v3. > > Otherwise this all looks good. Thanks! > > -Kees > > -- > Kees Cook > Pixel Security Geliang Tang (1): pstore: add lz4hc and 842 compression support fs/pstore/Kconfig | 25 +++++++++ fs/pstore/platform.c | 147 ++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 154 insertions(+), 18 deletions(-) -- 2.14.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3] pstore: add lz4hc and 842 compression support 2018-02-11 14:37 ` Geliang Tang @ 2018-02-11 14:37 ` Geliang Tang 2018-02-13 6:40 ` [PATCH v4] " Geliang Tang 0 siblings, 1 reply; 7+ messages in thread From: Geliang Tang @ 2018-02-11 14:37 UTC (permalink / raw) To: Kees Cook, Anton Vorontsov, Colin Cross, Tony Luck Cc: Geliang Tang, linux-kernel Currently, pstore has supported three compression algorithms: zlib, lzo and lz4. This patch added two more compression algorithms: lz4hc and 842. Signed-off-by: Geliang Tang <geliangtang@gmail.com> --- Changes in v3: -fix outlen in 842 Changes in v2: -fix checkpatch.pl WARNING: please write a paragraph that describes the config symbol fully --- fs/pstore/Kconfig | 25 +++++++++ fs/pstore/platform.c | 147 ++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 154 insertions(+), 18 deletions(-) diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig index b42e5bd6d8ff..cf97a3ecdce0 100644 --- a/fs/pstore/Kconfig +++ b/fs/pstore/Kconfig @@ -39,6 +39,31 @@ config PSTORE_LZ4_COMPRESS select LZ4_DECOMPRESS help This option enables LZ4 compression algorithm support. + +config PSTORE_LZ4HC_COMPRESS + bool "LZ4HC" + select LZ4HC_COMPRESS + select LZ4_DECOMPRESS + help + This option enables LZ4 high compression mode algorithm. + + Currently, pstore has supported five compression algorithms: + zlib, lzo, lz4, lz4hc and 842. + + The default compression algorithm is zlib. + +config PSTORE_842_COMPRESS + bool "842" + select 842_COMPRESS + select 842_DECOMPRESS + help + This option enables 842 compression algorithm support. + + Currently, pstore has supported five compression algorithms: + zlib, lzo, lz4, lz4hc and 842. + + The default compression algorithm is zlib. + endchoice config PSTORE_CONSOLE diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 2b21d180157c..a573708f74f8 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -34,9 +34,12 @@ #ifdef CONFIG_PSTORE_LZO_COMPRESS #include <linux/lzo.h> #endif -#ifdef CONFIG_PSTORE_LZ4_COMPRESS +#if defined(CONFIG_PSTORE_LZ4_COMPRESS) || defined(CONFIG_PSTORE_LZ4HC_COMPRESS) #include <linux/lz4.h> #endif +#ifdef CONFIG_PSTORE_842_COMPRESS +#include <linux/sw842.h> +#endif #include <linux/string.h> #include <linux/timer.h> #include <linux/slab.h> @@ -337,6 +340,33 @@ static const struct pstore_zbackend backend_lzo = { }; #endif +#if defined(CONFIG_PSTORE_LZ4_COMPRESS) || defined(CONFIG_PSTORE_LZ4HC_COMPRESS) +static int decompress_lz4(void *in, void *out, size_t inlen, size_t outlen) +{ + int ret; + + ret = LZ4_decompress_safe(in, out, inlen, outlen); + if (ret < 0) { + /* + * LZ4_decompress_safe will return an error code + * (< 0) if decompression failed + */ + pr_err("LZ4_decompress_safe error, ret = %d!\n", ret); + return -EIO; + } + + return ret; +} + +static void free_lz4(void) +{ + kfree(workspace); + kfree(big_oops_buf); + big_oops_buf = NULL; + big_oops_buf_sz = 0; +} +#endif + #ifdef CONFIG_PSTORE_LZ4_COMPRESS static int compress_lz4(const void *in, void *out, size_t inlen, size_t outlen) { @@ -351,29 +381,54 @@ static int compress_lz4(const void *in, void *out, size_t inlen, size_t outlen) return ret; } -static int decompress_lz4(void *in, void *out, size_t inlen, size_t outlen) +static void allocate_lz4(void) +{ + big_oops_buf_sz = LZ4_compressBound(psinfo->bufsize); + big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); + if (big_oops_buf) { + workspace = kmalloc(LZ4_MEM_COMPRESS, GFP_KERNEL); + if (!workspace) { + pr_err("No memory for compression workspace; skipping compression\n"); + kfree(big_oops_buf); + big_oops_buf = NULL; + } + } else { + pr_err("No memory for uncompressed data; skipping compression\n"); + workspace = NULL; + } +} + +static const struct pstore_zbackend backend_lz4 = { + .compress = compress_lz4, + .decompress = decompress_lz4, + .allocate = allocate_lz4, + .free = free_lz4, + .name = "lz4", +}; +#endif + +#ifdef CONFIG_PSTORE_LZ4HC_COMPRESS +static int compress_lz4hc(const void *in, void *out, + size_t inlen, size_t outlen) { int ret; - ret = LZ4_decompress_safe(in, out, inlen, outlen); - if (ret < 0) { - /* - * LZ4_decompress_safe will return an error code - * (< 0) if decompression failed - */ - pr_err("LZ4_decompress_safe error, ret = %d!\n", ret); + ret = LZ4_compress_HC(in, out, inlen, outlen, + LZ4HC_DEFAULT_CLEVEL, workspace); + if (!ret) { + pr_err("LZ4_compress_HC error; compression failed!\n"); return -EIO; } return ret; } -static void allocate_lz4(void) +static void allocate_lz4hc(void) { big_oops_buf_sz = LZ4_compressBound(psinfo->bufsize); big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); if (big_oops_buf) { - workspace = kmalloc(LZ4_MEM_COMPRESS, GFP_KERNEL); + workspace = kmalloc(LZ4HC_MEM_COMPRESS, GFP_KERNEL); if (!workspace) { pr_err("No memory for compression workspace; skipping compression\n"); kfree(big_oops_buf); @@ -385,7 +440,59 @@ static void allocate_lz4(void) } } -static void free_lz4(void) +static const struct pstore_zbackend backend_lz4hc = { + .compress = compress_lz4hc, + .decompress = decompress_lz4, + .allocate = allocate_lz4hc, + .free = free_lz4, + .name = "lz4hc", +}; +#endif + +#ifdef CONFIG_PSTORE_842_COMPRESS +static int compress_842(const void *in, void *out, size_t inlen, size_t outlen) +{ + int ret; + + ret = sw842_compress(in, inlen, out, (unsigned int *)&outlen, workspace); + if (ret) { + pr_err("sw842_compress error; compression failed!\n"); + return ret; + } + + return outlen; +} + +static int decompress_842(void *in, void *out, size_t inlen, size_t outlen) +{ + int ret; + + ret = sw842_decompress(in, inlen, out, (unsigned int *)&outlen); + if (ret) { + pr_err("sw842_decompress error, ret = %d!\n", ret); + return ret; + } + + return outlen; +} + +static void allocate_842(void) +{ + big_oops_buf_sz = psinfo->bufsize * 2; + big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); + if (big_oops_buf) { + workspace = kmalloc(SW842_MEM_COMPRESS, GFP_KERNEL); + if (!workspace) { + kfree(big_oops_buf); + big_oops_buf = NULL; + } + } else { + pr_err("No memory for uncompressed data; skipping compression\n"); + workspace = NULL; + } +} + +static void free_842(void) { kfree(workspace); kfree(big_oops_buf); @@ -393,12 +500,12 @@ static void free_lz4(void) big_oops_buf_sz = 0; } -static const struct pstore_zbackend backend_lz4 = { - .compress = compress_lz4, - .decompress = decompress_lz4, - .allocate = allocate_lz4, - .free = free_lz4, - .name = "lz4", +static const struct pstore_zbackend backend_842 = { + .compress = compress_842, + .decompress = decompress_842, + .allocate = allocate_842, + .free = free_842, + .name = "842", }; #endif @@ -409,6 +516,10 @@ static const struct pstore_zbackend *zbackend = &backend_lzo; #elif defined(CONFIG_PSTORE_LZ4_COMPRESS) &backend_lz4; +#elif defined(CONFIG_PSTORE_LZ4HC_COMPRESS) + &backend_lz4hc; +#elif defined(CONFIG_PSTORE_842_COMPRESS) + &backend_842; #else NULL; #endif -- 2.14.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v4] pstore: add lz4hc and 842 compression support 2018-02-11 14:37 ` [PATCH v3] " Geliang Tang @ 2018-02-13 6:40 ` Geliang Tang 2018-03-06 23:18 ` Kees Cook 0 siblings, 1 reply; 7+ messages in thread From: Geliang Tang @ 2018-02-13 6:40 UTC (permalink / raw) To: Kees Cook, Anton Vorontsov, Colin Cross, Tony Luck Cc: Geliang Tang, linux-kernel Currently, pstore has supported three compression algorithms: zlib, lzo and lz4. This patch added two more compression algorithms: lz4hc and 842. Signed-off-by: Geliang Tang <geliangtang@gmail.com> --- Changes in v4: -842 compress is not work in patch v3 since big_oops_buf_sz is too big. change big_oops_buf_sz from psinfo->bufsize * 2 to psinfo->bufsize. Changes in v3: -fix outlen in 842 Changes in v2: -fix checkpatch.pl WARNING: please write a paragraph that describes the config symbol fully --- fs/pstore/Kconfig | 25 +++++++++ fs/pstore/platform.c | 147 ++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 154 insertions(+), 18 deletions(-) diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig index b42e5bd6d8ff..cf97a3ecdce0 100644 --- a/fs/pstore/Kconfig +++ b/fs/pstore/Kconfig @@ -39,6 +39,31 @@ config PSTORE_LZ4_COMPRESS select LZ4_DECOMPRESS help This option enables LZ4 compression algorithm support. + +config PSTORE_LZ4HC_COMPRESS + bool "LZ4HC" + select LZ4HC_COMPRESS + select LZ4_DECOMPRESS + help + This option enables LZ4 high compression mode algorithm. + + Currently, pstore has supported five compression algorithms: + zlib, lzo, lz4, lz4hc and 842. + + The default compression algorithm is zlib. + +config PSTORE_842_COMPRESS + bool "842" + select 842_COMPRESS + select 842_DECOMPRESS + help + This option enables 842 compression algorithm support. + + Currently, pstore has supported five compression algorithms: + zlib, lzo, lz4, lz4hc and 842. + + The default compression algorithm is zlib. + endchoice config PSTORE_CONSOLE diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index c3129b131e4d..19aaefeb052f 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -34,9 +34,12 @@ #ifdef CONFIG_PSTORE_LZO_COMPRESS #include <linux/lzo.h> #endif -#ifdef CONFIG_PSTORE_LZ4_COMPRESS +#if defined(CONFIG_PSTORE_LZ4_COMPRESS) || defined(CONFIG_PSTORE_LZ4HC_COMPRESS) #include <linux/lz4.h> #endif +#ifdef CONFIG_PSTORE_842_COMPRESS +#include <linux/sw842.h> +#endif #include <linux/string.h> #include <linux/timer.h> #include <linux/slab.h> @@ -336,6 +339,33 @@ static const struct pstore_zbackend backend_lzo = { }; #endif +#if defined(CONFIG_PSTORE_LZ4_COMPRESS) || defined(CONFIG_PSTORE_LZ4HC_COMPRESS) +static int decompress_lz4(void *in, void *out, size_t inlen, size_t outlen) +{ + int ret; + + ret = LZ4_decompress_safe(in, out, inlen, outlen); + if (ret < 0) { + /* + * LZ4_decompress_safe will return an error code + * (< 0) if decompression failed + */ + pr_err("LZ4_decompress_safe error, ret = %d!\n", ret); + return -EIO; + } + + return ret; +} + +static void free_lz4(void) +{ + kfree(workspace); + kfree(big_oops_buf); + big_oops_buf = NULL; + big_oops_buf_sz = 0; +} +#endif + #ifdef CONFIG_PSTORE_LZ4_COMPRESS static int compress_lz4(const void *in, void *out, size_t inlen, size_t outlen) { @@ -350,29 +380,54 @@ static int compress_lz4(const void *in, void *out, size_t inlen, size_t outlen) return ret; } -static int decompress_lz4(void *in, void *out, size_t inlen, size_t outlen) +static void allocate_lz4(void) +{ + big_oops_buf_sz = LZ4_compressBound(psinfo->bufsize); + big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); + if (big_oops_buf) { + workspace = kmalloc(LZ4_MEM_COMPRESS, GFP_KERNEL); + if (!workspace) { + pr_err("No memory for compression workspace; skipping compression\n"); + kfree(big_oops_buf); + big_oops_buf = NULL; + } + } else { + pr_err("No memory for uncompressed data; skipping compression\n"); + workspace = NULL; + } +} + +static const struct pstore_zbackend backend_lz4 = { + .compress = compress_lz4, + .decompress = decompress_lz4, + .allocate = allocate_lz4, + .free = free_lz4, + .name = "lz4", +}; +#endif + +#ifdef CONFIG_PSTORE_LZ4HC_COMPRESS +static int compress_lz4hc(const void *in, void *out, + size_t inlen, size_t outlen) { int ret; - ret = LZ4_decompress_safe(in, out, inlen, outlen); - if (ret < 0) { - /* - * LZ4_decompress_safe will return an error code - * (< 0) if decompression failed - */ - pr_err("LZ4_decompress_safe error, ret = %d!\n", ret); + ret = LZ4_compress_HC(in, out, inlen, outlen, + LZ4HC_DEFAULT_CLEVEL, workspace); + if (!ret) { + pr_err("LZ4_compress_HC error; compression failed!\n"); return -EIO; } return ret; } -static void allocate_lz4(void) +static void allocate_lz4hc(void) { big_oops_buf_sz = LZ4_compressBound(psinfo->bufsize); big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); if (big_oops_buf) { - workspace = kmalloc(LZ4_MEM_COMPRESS, GFP_KERNEL); + workspace = kmalloc(LZ4HC_MEM_COMPRESS, GFP_KERNEL); if (!workspace) { pr_err("No memory for compression workspace; skipping compression\n"); kfree(big_oops_buf); @@ -384,7 +439,59 @@ static void allocate_lz4(void) } } -static void free_lz4(void) +static const struct pstore_zbackend backend_lz4hc = { + .compress = compress_lz4hc, + .decompress = decompress_lz4, + .allocate = allocate_lz4hc, + .free = free_lz4, + .name = "lz4hc", +}; +#endif + +#ifdef CONFIG_PSTORE_842_COMPRESS +static int compress_842(const void *in, void *out, size_t inlen, size_t outlen) +{ + int ret; + + ret = sw842_compress(in, inlen, out, (unsigned int *)&outlen, workspace); + if (ret) { + pr_err("sw842_compress error; compression failed!\n"); + return ret; + } + + return outlen; +} + +static int decompress_842(void *in, void *out, size_t inlen, size_t outlen) +{ + int ret; + + ret = sw842_decompress(in, inlen, out, (unsigned int *)&outlen); + if (ret) { + pr_err("sw842_decompress error, ret = %d!\n", ret); + return ret; + } + + return outlen; +} + +static void allocate_842(void) +{ + big_oops_buf_sz = psinfo->bufsize; + big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); + if (big_oops_buf) { + workspace = kmalloc(SW842_MEM_COMPRESS, GFP_KERNEL); + if (!workspace) { + kfree(big_oops_buf); + big_oops_buf = NULL; + } + } else { + pr_err("No memory for uncompressed data; skipping compression\n"); + workspace = NULL; + } +} + +static void free_842(void) { kfree(workspace); kfree(big_oops_buf); @@ -392,12 +499,12 @@ static void free_lz4(void) big_oops_buf_sz = 0; } -static const struct pstore_zbackend backend_lz4 = { - .compress = compress_lz4, - .decompress = decompress_lz4, - .allocate = allocate_lz4, - .free = free_lz4, - .name = "lz4", +static const struct pstore_zbackend backend_842 = { + .compress = compress_842, + .decompress = decompress_842, + .allocate = allocate_842, + .free = free_842, + .name = "842", }; #endif @@ -408,6 +515,10 @@ static const struct pstore_zbackend *zbackend = &backend_lzo; #elif defined(CONFIG_PSTORE_LZ4_COMPRESS) &backend_lz4; +#elif defined(CONFIG_PSTORE_LZ4HC_COMPRESS) + &backend_lz4hc; +#elif defined(CONFIG_PSTORE_842_COMPRESS) + &backend_842; #else NULL; #endif -- 2.14.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v4] pstore: add lz4hc and 842 compression support 2018-02-13 6:40 ` [PATCH v4] " Geliang Tang @ 2018-03-06 23:18 ` Kees Cook 0 siblings, 0 replies; 7+ messages in thread From: Kees Cook @ 2018-03-06 23:18 UTC (permalink / raw) To: Geliang Tang; +Cc: Anton Vorontsov, Colin Cross, Tony Luck, LKML On Mon, Feb 12, 2018 at 10:40 PM, Geliang Tang <geliangtang@gmail.com> wrote: > Currently, pstore has supported three compression algorithms: zlib, > lzo and lz4. This patch added two more compression algorithms: lz4hc > and 842. > > Signed-off-by: Geliang Tang <geliangtang@gmail.com> Thanks for the updates, I've applied this. I'll send a follow-up patch that I'm adding to avoid size_t cast to unsigned int. -Kees > --- > Changes in v4: > -842 compress is not work in patch v3 since big_oops_buf_sz is too big. > change big_oops_buf_sz from psinfo->bufsize * 2 to psinfo->bufsize. > Changes in v3: > -fix outlen in 842 > Changes in v2: > -fix checkpatch.pl WARNING: > please write a paragraph that describes the config symbol fully > --- > fs/pstore/Kconfig | 25 +++++++++ > fs/pstore/platform.c | 147 ++++++++++++++++++++++++++++++++++++++++++++------- > 2 files changed, 154 insertions(+), 18 deletions(-) > > diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig > index b42e5bd6d8ff..cf97a3ecdce0 100644 > --- a/fs/pstore/Kconfig > +++ b/fs/pstore/Kconfig > @@ -39,6 +39,31 @@ config PSTORE_LZ4_COMPRESS > select LZ4_DECOMPRESS > help > This option enables LZ4 compression algorithm support. > + > +config PSTORE_LZ4HC_COMPRESS > + bool "LZ4HC" > + select LZ4HC_COMPRESS > + select LZ4_DECOMPRESS > + help > + This option enables LZ4 high compression mode algorithm. > + > + Currently, pstore has supported five compression algorithms: > + zlib, lzo, lz4, lz4hc and 842. > + > + The default compression algorithm is zlib. > + > +config PSTORE_842_COMPRESS > + bool "842" > + select 842_COMPRESS > + select 842_DECOMPRESS > + help > + This option enables 842 compression algorithm support. > + > + Currently, pstore has supported five compression algorithms: > + zlib, lzo, lz4, lz4hc and 842. > + > + The default compression algorithm is zlib. > + > endchoice > > config PSTORE_CONSOLE > diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c > index c3129b131e4d..19aaefeb052f 100644 > --- a/fs/pstore/platform.c > +++ b/fs/pstore/platform.c > @@ -34,9 +34,12 @@ > #ifdef CONFIG_PSTORE_LZO_COMPRESS > #include <linux/lzo.h> > #endif > -#ifdef CONFIG_PSTORE_LZ4_COMPRESS > +#if defined(CONFIG_PSTORE_LZ4_COMPRESS) || defined(CONFIG_PSTORE_LZ4HC_COMPRESS) > #include <linux/lz4.h> > #endif > +#ifdef CONFIG_PSTORE_842_COMPRESS > +#include <linux/sw842.h> > +#endif > #include <linux/string.h> > #include <linux/timer.h> > #include <linux/slab.h> > @@ -336,6 +339,33 @@ static const struct pstore_zbackend backend_lzo = { > }; > #endif > > +#if defined(CONFIG_PSTORE_LZ4_COMPRESS) || defined(CONFIG_PSTORE_LZ4HC_COMPRESS) > +static int decompress_lz4(void *in, void *out, size_t inlen, size_t outlen) > +{ > + int ret; > + > + ret = LZ4_decompress_safe(in, out, inlen, outlen); > + if (ret < 0) { > + /* > + * LZ4_decompress_safe will return an error code > + * (< 0) if decompression failed > + */ > + pr_err("LZ4_decompress_safe error, ret = %d!\n", ret); > + return -EIO; > + } > + > + return ret; > +} > + > +static void free_lz4(void) > +{ > + kfree(workspace); > + kfree(big_oops_buf); > + big_oops_buf = NULL; > + big_oops_buf_sz = 0; > +} > +#endif > + > #ifdef CONFIG_PSTORE_LZ4_COMPRESS > static int compress_lz4(const void *in, void *out, size_t inlen, size_t outlen) > { > @@ -350,29 +380,54 @@ static int compress_lz4(const void *in, void *out, size_t inlen, size_t outlen) > return ret; > } > > -static int decompress_lz4(void *in, void *out, size_t inlen, size_t outlen) > +static void allocate_lz4(void) > +{ > + big_oops_buf_sz = LZ4_compressBound(psinfo->bufsize); > + big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); > + if (big_oops_buf) { > + workspace = kmalloc(LZ4_MEM_COMPRESS, GFP_KERNEL); > + if (!workspace) { > + pr_err("No memory for compression workspace; skipping compression\n"); > + kfree(big_oops_buf); > + big_oops_buf = NULL; > + } > + } else { > + pr_err("No memory for uncompressed data; skipping compression\n"); > + workspace = NULL; > + } > +} > + > +static const struct pstore_zbackend backend_lz4 = { > + .compress = compress_lz4, > + .decompress = decompress_lz4, > + .allocate = allocate_lz4, > + .free = free_lz4, > + .name = "lz4", > +}; > +#endif > + > +#ifdef CONFIG_PSTORE_LZ4HC_COMPRESS > +static int compress_lz4hc(const void *in, void *out, > + size_t inlen, size_t outlen) > { > int ret; > > - ret = LZ4_decompress_safe(in, out, inlen, outlen); > - if (ret < 0) { > - /* > - * LZ4_decompress_safe will return an error code > - * (< 0) if decompression failed > - */ > - pr_err("LZ4_decompress_safe error, ret = %d!\n", ret); > + ret = LZ4_compress_HC(in, out, inlen, outlen, > + LZ4HC_DEFAULT_CLEVEL, workspace); > + if (!ret) { > + pr_err("LZ4_compress_HC error; compression failed!\n"); > return -EIO; > } > > return ret; > } > > -static void allocate_lz4(void) > +static void allocate_lz4hc(void) > { > big_oops_buf_sz = LZ4_compressBound(psinfo->bufsize); > big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); > if (big_oops_buf) { > - workspace = kmalloc(LZ4_MEM_COMPRESS, GFP_KERNEL); > + workspace = kmalloc(LZ4HC_MEM_COMPRESS, GFP_KERNEL); > if (!workspace) { > pr_err("No memory for compression workspace; skipping compression\n"); > kfree(big_oops_buf); > @@ -384,7 +439,59 @@ static void allocate_lz4(void) > } > } > > -static void free_lz4(void) > +static const struct pstore_zbackend backend_lz4hc = { > + .compress = compress_lz4hc, > + .decompress = decompress_lz4, > + .allocate = allocate_lz4hc, > + .free = free_lz4, > + .name = "lz4hc", > +}; > +#endif > + > +#ifdef CONFIG_PSTORE_842_COMPRESS > +static int compress_842(const void *in, void *out, size_t inlen, size_t outlen) > +{ > + int ret; > + > + ret = sw842_compress(in, inlen, out, (unsigned int *)&outlen, workspace); > + if (ret) { > + pr_err("sw842_compress error; compression failed!\n"); > + return ret; > + } > + > + return outlen; > +} > + > +static int decompress_842(void *in, void *out, size_t inlen, size_t outlen) > +{ > + int ret; > + > + ret = sw842_decompress(in, inlen, out, (unsigned int *)&outlen); > + if (ret) { > + pr_err("sw842_decompress error, ret = %d!\n", ret); > + return ret; > + } > + > + return outlen; > +} > + > +static void allocate_842(void) > +{ > + big_oops_buf_sz = psinfo->bufsize; > + big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); > + if (big_oops_buf) { > + workspace = kmalloc(SW842_MEM_COMPRESS, GFP_KERNEL); > + if (!workspace) { > + kfree(big_oops_buf); > + big_oops_buf = NULL; > + } > + } else { > + pr_err("No memory for uncompressed data; skipping compression\n"); > + workspace = NULL; > + } > +} > + > +static void free_842(void) > { > kfree(workspace); > kfree(big_oops_buf); > @@ -392,12 +499,12 @@ static void free_lz4(void) > big_oops_buf_sz = 0; > } > > -static const struct pstore_zbackend backend_lz4 = { > - .compress = compress_lz4, > - .decompress = decompress_lz4, > - .allocate = allocate_lz4, > - .free = free_lz4, > - .name = "lz4", > +static const struct pstore_zbackend backend_842 = { > + .compress = compress_842, > + .decompress = decompress_842, > + .allocate = allocate_842, > + .free = free_842, > + .name = "842", > }; > #endif > > @@ -408,6 +515,10 @@ static const struct pstore_zbackend *zbackend = > &backend_lzo; > #elif defined(CONFIG_PSTORE_LZ4_COMPRESS) > &backend_lz4; > +#elif defined(CONFIG_PSTORE_LZ4HC_COMPRESS) > + &backend_lz4hc; > +#elif defined(CONFIG_PSTORE_842_COMPRESS) > + &backend_842; > #else > NULL; > #endif > -- > 2.14.1 > -- Kees Cook Pixel Security ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-03-06 23:18 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-08-28 13:56 [PATCH] pstore: add lz4hc and 842 compression support Geliang Tang 2017-11-02 2:38 ` [PATCH v2] " Geliang Tang 2017-11-29 1:44 ` [PATCH] " Kees Cook 2018-02-11 14:37 ` Geliang Tang 2018-02-11 14:37 ` [PATCH v3] " Geliang Tang 2018-02-13 6:40 ` [PATCH v4] " Geliang Tang 2018-03-06 23:18 ` Kees Cook
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).