Skip to content

Commit cc6d349

Browse files
committed
Squashfs: Make ZLIB compression support optional
Squashfs now supports XZ and LZO compression in addition to ZLIB. As such it no longer makes sense to always include ZLIB support. In particular embedded systems may only use LZO or XZ compression, and the ability to exclude ZLIB support will reduce kernel size. Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
1 parent 812753d commit cc6d349

5 files changed

Lines changed: 25 additions & 5 deletions

File tree

‎fs/squashfs/Kconfig‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
config SQUASHFS
22
tristate "SquashFS 4.0 - Squashed file system support"
33
depends on BLOCK
4-
select ZLIB_INFLATE
54
help
65
Saying Y here includes support for SquashFS 4.0 (a Compressed
76
Read-Only File System). Squashfs is a highly compressed read-only
@@ -36,6 +35,19 @@ config SQUASHFS_XATTR
3635

3736
If unsure, say N.
3837

38+
config SQUASHFS_ZLIB
39+
bool "Include support for ZLIB compressed file systems"
40+
depends on SQUASHFS
41+
select ZLIB_INFLATE
42+
default y
43+
help
44+
ZLIB compression is the standard compression used by Squashfs
45+
file systems. It offers a good trade-off between compression
46+
achieved and the amount of CPU time and memory necessary to
47+
compress and decompress.
48+
49+
If unsure, say Y.
50+
3951
config SQUASHFS_LZO
4052
bool "Include support for LZO compressed file systems"
4153
depends on SQUASHFS

‎fs/squashfs/Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
obj-$(CONFIG_SQUASHFS) += squashfs.o
66
squashfs-y += block.o cache.o dir.o export.o file.o fragment.o id.o inode.o
7-
squashfs-y += namei.o super.o symlink.o zlib_wrapper.o decompressor.o
7+
squashfs-y += namei.o super.o symlink.o decompressor.o
88
squashfs-$(CONFIG_SQUASHFS_XATTR) += xattr.o xattr_id.o
99
squashfs-$(CONFIG_SQUASHFS_LZO) += lzo_wrapper.o
1010
squashfs-$(CONFIG_SQUASHFS_XZ) += xz_wrapper.o
11+
squashfs-$(CONFIG_SQUASHFS_ZLIB) += zlib_wrapper.o

‎fs/squashfs/decompressor.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ static const struct squashfs_decompressor squashfs_xz_comp_ops = {
5252
};
5353
#endif
5454

55+
#ifndef CONFIG_SQUASHFS_ZLIB
56+
static const struct squashfs_decompressor squashfs_zlib_comp_ops = {
57+
NULL, NULL, NULL, ZLIB_COMPRESSION, "zlib", 0
58+
};
59+
#endif
60+
5561
static const struct squashfs_decompressor squashfs_unknown_comp_ops = {
5662
NULL, NULL, NULL, 0, "unknown", 0
5763
};

‎fs/squashfs/decompressor.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,8 @@ extern const struct squashfs_decompressor squashfs_xz_comp_ops;
5656
extern const struct squashfs_decompressor squashfs_lzo_comp_ops;
5757
#endif
5858

59+
#ifdef CONFIG_SQUASHFS_ZLIB
60+
extern const struct squashfs_decompressor squashfs_zlib_comp_ops;
61+
#endif
62+
5963
#endif

‎fs/squashfs/squashfs.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,3 @@ extern const struct inode_operations squashfs_symlink_inode_ops;
9797

9898
/* xattr.c */
9999
extern const struct xattr_handler *squashfs_xattr_handlers[];
100-
101-
/* zlib_wrapper.c */
102-
extern const struct squashfs_decompressor squashfs_zlib_comp_ops;

0 commit comments

Comments
 (0)