Linux Audio

Check our new training course

Loading...
Note: File does not exist in v3.1.
 1/* SPDX-License-Identifier: GPL-2.0-or-later */
 2/*
 3 * Copyright (C) 2014 Sergey Senozhatsky.
 4 */
 5
 6#ifndef _ZCOMP_H_
 7#define _ZCOMP_H_
 8#include <linux/local_lock.h>
 9
10struct zcomp_strm {
11	/* The members ->buffer and ->tfm are protected by ->lock. */
12	local_lock_t lock;
13	/* compression/decompression buffer */
14	void *buffer;
15	struct crypto_comp *tfm;
16};
17
18/* dynamic per-device compression frontend */
19struct zcomp {
20	struct zcomp_strm __percpu *stream;
21	const char *name;
22	struct hlist_node node;
23};
24
25int zcomp_cpu_up_prepare(unsigned int cpu, struct hlist_node *node);
26int zcomp_cpu_dead(unsigned int cpu, struct hlist_node *node);
27ssize_t zcomp_available_show(const char *comp, char *buf);
28bool zcomp_available_algorithm(const char *comp);
29
30struct zcomp *zcomp_create(const char *alg);
31void zcomp_destroy(struct zcomp *comp);
32
33struct zcomp_strm *zcomp_stream_get(struct zcomp *comp);
34void zcomp_stream_put(struct zcomp *comp);
35
36int zcomp_compress(struct zcomp_strm *zstrm,
37		const void *src, unsigned int *dst_len);
38
39int zcomp_decompress(struct zcomp_strm *zstrm,
40		const void *src, unsigned int src_len, void *dst);
41
42#endif /* _ZCOMP_H_ */