1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) 2014 Sergey Senozhatsky.
8 #include <linux/local_lock.h>
11 /* The members ->buffer and ->tfm are protected by ->lock. */
13 /* compression/decompression buffer */
15 struct crypto_comp *tfm;
18 /* dynamic per-device compression frontend */
20 struct zcomp_strm __percpu *stream;
22 struct hlist_node node;
25 int zcomp_cpu_up_prepare(unsigned int cpu, struct hlist_node *node);
26 int zcomp_cpu_dead(unsigned int cpu, struct hlist_node *node);
27 ssize_t zcomp_available_show(const char *comp, char *buf);
28 bool zcomp_available_algorithm(const char *comp);
30 struct zcomp *zcomp_create(const char *comp);
31 void zcomp_destroy(struct zcomp *comp);
33 struct zcomp_strm *zcomp_stream_get(struct zcomp *comp);
34 void zcomp_stream_put(struct zcomp *comp);
36 int zcomp_compress(struct zcomp_strm *zstrm,
37 const void *src, unsigned int *dst_len);
39 int zcomp_decompress(struct zcomp_strm *zstrm,
40 const void *src, unsigned int src_len, void *dst);
42 bool zcomp_set_max_streams(struct zcomp *comp, int num_strm);
43 #endif /* _ZCOMP_H_ */