pstore: add zstd compression support
This patch added the 6th compression algorithm support for pstore: zstd. Signed-off-by: Geliang Tang <geliangtang@gmail.com> Signed-off-by: Kees Cook <keescook@chromium.org>
This commit is contained in:
@@ -34,6 +34,9 @@
|
||||
#if IS_ENABLED(CONFIG_PSTORE_LZ4_COMPRESS) || IS_ENABLED(CONFIG_PSTORE_LZ4HC_COMPRESS)
|
||||
#include <linux/lz4.h>
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_PSTORE_ZSTD_COMPRESS)
|
||||
#include <linux/zstd.h>
|
||||
#endif
|
||||
#include <linux/crypto.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/timer.h>
|
||||
@@ -192,6 +195,13 @@ static int zbufsize_842(size_t size)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_PSTORE_ZSTD_COMPRESS)
|
||||
static int zbufsize_zstd(size_t size)
|
||||
{
|
||||
return ZSTD_compressBound(size);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const struct pstore_zbackend *zbackend __ro_after_init;
|
||||
|
||||
static const struct pstore_zbackend zbackends[] = {
|
||||
@@ -224,6 +234,12 @@ static const struct pstore_zbackend zbackends[] = {
|
||||
.zbufsize = zbufsize_842,
|
||||
.name = "842",
|
||||
},
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_PSTORE_ZSTD_COMPRESS)
|
||||
{
|
||||
.zbufsize = zbufsize_zstd,
|
||||
.name = "zstd",
|
||||
},
|
||||
#endif
|
||||
{ }
|
||||
};
|
||||
|
Reference in New Issue
Block a user