zcomp.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (C) 2014 Sergey Senozhatsky.
  3. *
  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.
  8. */
  9. #ifndef _ZCOMP_H_
  10. #define _ZCOMP_H_
  11. struct zcomp_strm {
  12. /* compression/decompression buffer */
  13. void *buffer;
  14. struct crypto_comp *tfm;
  15. };
  16. /* dynamic per-device compression frontend */
  17. struct zcomp {
  18. struct zcomp_strm * __percpu *stream;
  19. const char *name;
  20. struct hlist_node node;
  21. };
  22. int zcomp_cpu_up_prepare(unsigned int cpu, struct hlist_node *node);
  23. int zcomp_cpu_dead(unsigned int cpu, struct hlist_node *node);
  24. ssize_t zcomp_available_show(const char *comp, char *buf);
  25. bool zcomp_available_algorithm(const char *comp);
  26. struct zcomp *zcomp_create(const char *comp);
  27. void zcomp_destroy(struct zcomp *comp);
  28. struct zcomp_strm *zcomp_stream_get(struct zcomp *comp);
  29. void zcomp_stream_put(struct zcomp *comp);
  30. int zcomp_compress(struct zcomp_strm *zstrm,
  31. const void *src, unsigned int *dst_len);
  32. int zcomp_decompress(struct zcomp_strm *zstrm,
  33. const void *src, unsigned int src_len, void *dst);
  34. bool zcomp_set_max_streams(struct zcomp *comp, int num_strm);
  35. #endif /* _ZCOMP_H_ */