summaryrefslogtreecommitdiff
path: root/drivers/block/zram/zcomp.h
diff options
context:
space:
mode:
authorSergey Senozhatsky <senozhatsky@chromium.org>2024-09-02 19:56:01 +0900
committerAndrew Morton <akpm@linux-foundation.org>2024-09-09 16:39:09 -0700
commitf2bac7ad187d77e2a053d3cd04b158a06b683d26 (patch)
tree5239c4e793ff631fd64be9cb18e433f32724d1d6 /drivers/block/zram/zcomp.h
parent1a78390d8760c20c188f27feae74ddb44ae6f0bb (diff)
downloadlwn-f2bac7ad187d77e2a053d3cd04b158a06b683d26.tar.gz
lwn-f2bac7ad187d77e2a053d3cd04b158a06b683d26.zip
zram: introduce zcomp_params structure
We will store a per-algorithm parameters there (compression level, dictionary, dictionary size, etc.). Link: https://lkml.kernel.org/r/20240902105656.1383858-14-senozhatsky@chromium.org Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org> Cc: Minchan Kim <minchan@kernel.org> Cc: Nick Terrell <terrelln@fb.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'drivers/block/zram/zcomp.h')
-rw-r--r--drivers/block/zram/zcomp.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/block/zram/zcomp.h b/drivers/block/zram/zcomp.h
index e5eb5ec4c645..217a750fa908 100644
--- a/drivers/block/zram/zcomp.h
+++ b/drivers/block/zram/zcomp.h
@@ -2,8 +2,17 @@
#ifndef _ZCOMP_H_
#define _ZCOMP_H_
+
#include <linux/local_lock.h>
+#define ZCOMP_PARAM_NO_LEVEL INT_MIN
+
+struct zcomp_params {
+ void *dict;
+ size_t dict_sz;
+ s32 level;
+};
+
struct zcomp_strm {
/* The members ->buffer and ->tfm are protected by ->lock. */
local_lock_t lock;
@@ -19,7 +28,7 @@ struct zcomp_ops {
int (*decompress)(void *ctx, const unsigned char *src, size_t src_len,
unsigned char *dst, size_t dst_len);
- void *(*create_ctx)(void);
+ void *(*create_ctx)(struct zcomp_params *params);
void (*destroy_ctx)(void *ctx);
const char *name;
@@ -29,6 +38,7 @@ struct zcomp_ops {
struct zcomp {
struct zcomp_strm __percpu *stream;
const struct zcomp_ops *ops;
+ struct zcomp_params *params;
struct hlist_node node;
};
@@ -37,7 +47,7 @@ int zcomp_cpu_dead(unsigned int cpu, struct hlist_node *node);
ssize_t zcomp_available_show(const char *comp, char *buf);
bool zcomp_available_algorithm(const char *comp);
-struct zcomp *zcomp_create(const char *alg);
+struct zcomp *zcomp_create(const char *alg, struct zcomp_params *params);
void zcomp_destroy(struct zcomp *comp);
struct zcomp_strm *zcomp_stream_get(struct zcomp *comp);