2 * Copyright (C) 2014 Sergey Senozhatsky.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
14 /* compression/decompression buffer */
17 * The private data of the compression stream, only compression
18 * stream backend can touch this (e.g. compression algorithm
24 /* static compression backend */
25 struct zcomp_backend {
26 int (*compress)(const unsigned char *src, unsigned char *dst,
27 size_t *dst_len, void *private);
29 int (*decompress)(const unsigned char *src, size_t src_len,
32 void *(*create)(gfp_t flags);
33 void (*destroy)(void *private);
38 /* dynamic per-device compression frontend */
40 struct zcomp_strm * __percpu *stream;
41 struct zcomp_backend *backend;
42 struct notifier_block notifier;
45 ssize_t zcomp_available_show(const char *comp, char *buf);
46 bool zcomp_available_algorithm(const char *comp);
48 struct zcomp *zcomp_create(const char *comp);
49 void zcomp_destroy(struct zcomp *comp);
51 struct zcomp_strm *zcomp_strm_find(struct zcomp *comp);
52 void zcomp_strm_release(struct zcomp *comp, struct zcomp_strm *zstrm);
54 int zcomp_compress(struct zcomp *comp, struct zcomp_strm *zstrm,
55 const unsigned char *src, size_t *dst_len);
57 int zcomp_decompress(struct zcomp *comp, const unsigned char *src,
58 size_t src_len, unsigned char *dst);
60 bool zcomp_set_max_streams(struct zcomp *comp, int num_strm);
61 #endif /* _ZCOMP_H_ */