Squashfs: Add LZ4 compression configuration option
authorPhillip Lougher <phillip@squashfs.org.uk>
Thu, 27 Nov 2014 18:48:44 +0000 (18:48 +0000)
committerMohamad Ayyash <mkayyash@google.com>
Wed, 4 Mar 2015 19:27:29 +0000 (11:27 -0800)
Add the glue code, and also update the documentation.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
Documentation/filesystems/squashfs.txt
fs/squashfs/Kconfig
fs/squashfs/Makefile
fs/squashfs/decompressor.c
fs/squashfs/decompressor.h

index 403c090aca39954d378809b55b0585f74085422c..e5274f84dc5666b7e8e7d981fa4935d7cdc90b92 100644 (file)
@@ -2,10 +2,10 @@ SQUASHFS 4.0 FILESYSTEM
 =======================
 
 Squashfs is a compressed read-only filesystem for Linux.
-It uses zlib/lzo/xz compression to compress files, inodes and directories.
-Inodes in the system are very small and all blocks are packed to minimise
-data overhead. Block sizes greater than 4K are supported up to a maximum
-of 1Mbytes (default block size 128K).
+It uses zlib, lz4, lzo, or xz compression to compress files, inodes and
+directories.  Inodes in the system are very small and all blocks are packed to
+minimise data overhead. Block sizes greater than 4K are supported up to a
+maximum of 1Mbytes (default block size 128K).
 
 Squashfs is intended for general read-only filesystem use, for archival
 use (i.e. in cases where a .tar.gz file may be used), and in constrained
index b6fa8657dcbc51dcb904a7e5b018d474c94d9d83..ffb093e72b6ca89a0f8d339dfad3f04da0c97e8e 100644 (file)
@@ -120,6 +120,21 @@ config SQUASHFS_ZLIB
 
          If unsure, say Y.
 
+config SQUASHFS_LZ4
+       bool "Include support for LZ4 compressed file systems"
+       depends on SQUASHFS
+       select LZ4_DECOMPRESS
+       help
+         Saying Y here includes support for reading Squashfs file systems
+         compressed with LZ4 compression.  LZ4 compression is mainly
+         aimed at embedded systems with slower CPUs where the overheads
+         of zlib are too high.
+
+         LZ4 is not the standard compression used in Squashfs and so most
+         file systems will be readable without selecting this option.
+
+         If unsure, say N.
+
 config SQUASHFS_LZO
        bool "Include support for LZO compressed file systems"
        depends on SQUASHFS
index 4132520b4ff2cfbec2e49b5c0ebe67f8661dd748..246a6f329d8957df4b3bf48129b3f0e415be2611 100644 (file)
@@ -11,6 +11,7 @@ squashfs-$(CONFIG_SQUASHFS_DECOMP_SINGLE) += decompressor_single.o
 squashfs-$(CONFIG_SQUASHFS_DECOMP_MULTI) += decompressor_multi.o
 squashfs-$(CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU) += decompressor_multi_percpu.o
 squashfs-$(CONFIG_SQUASHFS_XATTR) += xattr.o xattr_id.o
+squashfs-$(CONFIG_SQUASHFS_LZ4) += lz4_wrapper.o
 squashfs-$(CONFIG_SQUASHFS_LZO) += lzo_wrapper.o
 squashfs-$(CONFIG_SQUASHFS_XZ) += xz_wrapper.o
 squashfs-$(CONFIG_SQUASHFS_ZLIB) += zlib_wrapper.o
index ac22fe73b0adc241449c35e58faf535d510bb3ec..e9034bf6e5ae27bb3e2379e0816e2b11d5ed41b1 100644 (file)
@@ -41,6 +41,12 @@ static const struct squashfs_decompressor squashfs_lzma_unsupported_comp_ops = {
        NULL, NULL, NULL, NULL, LZMA_COMPRESSION, "lzma", 0
 };
 
+#ifndef CONFIG_SQUASHFS_LZ4
+static const struct squashfs_decompressor squashfs_lz4_comp_ops = {
+       NULL, NULL, NULL, NULL, LZ4_COMPRESSION, "lz4", 0
+};
+#endif
+
 #ifndef CONFIG_SQUASHFS_LZO
 static const struct squashfs_decompressor squashfs_lzo_comp_ops = {
        NULL, NULL, NULL, NULL, LZO_COMPRESSION, "lzo", 0
@@ -65,6 +71,7 @@ static const struct squashfs_decompressor squashfs_unknown_comp_ops = {
 
 static const struct squashfs_decompressor *decompressor[] = {
        &squashfs_zlib_comp_ops,
+       &squashfs_lz4_comp_ops,
        &squashfs_lzo_comp_ops,
        &squashfs_xz_comp_ops,
        &squashfs_lzma_unsupported_comp_ops,
index af0985321808e6e92b771b7d3ea63442e5fc8581..a25713c031a51213edc9dd5a32de73f64f75c44f 100644 (file)
@@ -46,6 +46,10 @@ static inline void *squashfs_comp_opts(struct squashfs_sb_info *msblk,
 extern const struct squashfs_decompressor squashfs_xz_comp_ops;
 #endif
 
+#ifdef CONFIG_SQUASHFS_LZ4
+extern const struct squashfs_decompressor squashfs_lz4_comp_ops;
+#endif
+
 #ifdef CONFIG_SQUASHFS_LZO
 extern const struct squashfs_decompressor squashfs_lzo_comp_ops;
 #endif