pstore: Use crypto compress API
authorGeliang Tang <geliangtang@gmail.com>
Fri, 9 Mar 2018 10:51:07 +0000 (18:51 +0800)
committerKees Cook <keescook@chromium.org>
Fri, 9 Mar 2018 22:16:29 +0000 (14:16 -0800)
commitcb3bee0369bc9316e47f4ad95a3c33f4e0d50a06
tree0862290858ff5a4214a719caa0e49db9f72486e6
parentf2531f1976d98a7a4328da7f3cbf31b7c1927738
pstore: Use crypto compress API

In the pstore compression part, we use zlib/lzo/lz4/lz4hc/842
compression algorithm API to implement pstore compression backends. But
there are many repeat codes in these implementations. This patch uses
crypto compress API to simplify these codes.

1) rewrite allocate_buf_for_compression, free_buf_for_compression,
pstore_compress, pstore_decompress functions using crypto compress API.
2) drop compress, decompress, allocate, free functions in pstore_zbackend,
and add zbufsize function to get each different compress buffer size.
3) use late_initcall to call ramoops_init later, to make sure the crypto
subsystem has already initialized.
4) use 'unsigned int' type instead of 'size_t' in pstore_compress,
pstore_decompress functions' length arguments.
5) rename 'zlib' to 'deflate' to follow the crypto API's name convention.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
[kees: tweaked error messages on allocation failures and Kconfig help]
Signed-off-by: Kees Cook <keescook@chromium.org>
fs/pstore/Kconfig
fs/pstore/platform.c
fs/pstore/ram.c