decompressor.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef DECOMPRESSOR_H
  2. #define DECOMPRESSOR_H
  3. /*
  4. * Squashfs - a compressed read only filesystem for Linux
  5. *
  6. * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
  7. * Phillip Lougher <phillip@squashfs.org.uk>
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2,
  12. * or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  22. *
  23. * decompressor.h
  24. */
  25. struct squashfs_decompressor {
  26. void *(*init)(struct squashfs_sb_info *, void *, int);
  27. void (*free)(void *);
  28. int (*decompress)(struct squashfs_sb_info *, void **,
  29. struct buffer_head **, int, int, int, int, int);
  30. int id;
  31. char *name;
  32. int supported;
  33. };
  34. static inline void squashfs_decompressor_free(struct squashfs_sb_info *msblk,
  35. void *s)
  36. {
  37. if (msblk->decompressor)
  38. msblk->decompressor->free(s);
  39. }
  40. static inline int squashfs_decompress(struct squashfs_sb_info *msblk,
  41. void **buffer, struct buffer_head **bh, int b, int offset, int length,
  42. int srclength, int pages)
  43. {
  44. return msblk->decompressor->decompress(msblk, buffer, bh, b, offset,
  45. length, srclength, pages);
  46. }
  47. #ifdef CONFIG_SQUASHFS_XZ
  48. extern const struct squashfs_decompressor squashfs_xz_comp_ops;
  49. #endif
  50. #ifdef CONFIG_SQUASHFS_LZO
  51. extern const struct squashfs_decompressor squashfs_lzo_comp_ops;
  52. #endif
  53. #endif