Root/target/linux/generic/patches-3.7/541-ubifs-xz-decompression-support.patch

1--- a/fs/ubifs/Kconfig
2+++ b/fs/ubifs/Kconfig
3@@ -5,8 +5,10 @@ config UBIFS_FS
4     select CRYPTO if UBIFS_FS_ADVANCED_COMPR
5     select CRYPTO if UBIFS_FS_LZO
6     select CRYPTO if UBIFS_FS_ZLIB
7+ select CRYPTO if UBIFS_FS_XZ
8     select CRYPTO_LZO if UBIFS_FS_LZO
9     select CRYPTO_DEFLATE if UBIFS_FS_ZLIB
10+ select CRYPTO_XZ if UBIFS_FS_XZ
11     depends on MTD_UBI
12     help
13       UBIFS is a file system for flash devices which works on top of UBI.
14@@ -35,3 +37,12 @@ config UBIFS_FS_ZLIB
15     default y
16     help
17       Zlib compresses better than LZO but it is slower. Say 'Y' if unsure.
18+
19+config UBIFS_FS_XZ
20+ bool "XZ decompression support" if UBIFS_FS_ADVANCED_COMPR
21+ depends on UBIFS_FS
22+ default y
23+ help
24+ XZ compresses better the ZLIB but it is slower..
25+ Say 'Y' if unsure.
26+
27--- a/fs/ubifs/compress.c
28+++ b/fs/ubifs/compress.c
29@@ -71,6 +71,24 @@ static struct ubifs_compressor zlib_comp
30 };
31 #endif
32 
33+#ifdef CONFIG_UBIFS_FS_XZ
34+static DEFINE_MUTEX(xz_enc_mutex);
35+static DEFINE_MUTEX(xz_dec_mutex);
36+
37+static struct ubifs_compressor xz_compr = {
38+ .compr_type = UBIFS_COMPR_XZ,
39+ .comp_mutex = &xz_enc_mutex,
40+ .decomp_mutex = &xz_dec_mutex,
41+ .name = "xz",
42+ .capi_name = "xz",
43+};
44+#else
45+static struct ubifs_compressor zlib_compr = {
46+ .compr_type = UBIFS_COMPR_XZ,
47+ .name = "xz",
48+};
49+#endif
50+
51 /* All UBIFS compressors */
52 struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
53 
54@@ -232,9 +250,15 @@ int __init ubifs_compressors_init(void)
55     if (err)
56         goto out_lzo;
57 
58+ err = compr_init(&xz_compr);
59+ if (err)
60+ goto out_zlib;
61+
62     ubifs_compressors[UBIFS_COMPR_NONE] = &none_compr;
63     return 0;
64 
65+out_zlib:
66+ compr_exit(&zlib_compr);
67 out_lzo:
68     compr_exit(&lzo_compr);
69     return err;
70@@ -247,4 +271,5 @@ void ubifs_compressors_exit(void)
71 {
72     compr_exit(&lzo_compr);
73     compr_exit(&zlib_compr);
74+ compr_exit(&xz_compr);
75 }
76--- a/fs/ubifs/ubifs-media.h
77+++ b/fs/ubifs/ubifs-media.h
78@@ -332,12 +332,14 @@ enum {
79  * UBIFS_COMPR_NONE: no compression
80  * UBIFS_COMPR_LZO: LZO compression
81  * UBIFS_COMPR_ZLIB: ZLIB compression
82+ * UBIFS_COMPR_XZ: XZ compression
83  * UBIFS_COMPR_TYPES_CNT: count of supported compression types
84  */
85 enum {
86     UBIFS_COMPR_NONE,
87     UBIFS_COMPR_LZO,
88     UBIFS_COMPR_ZLIB,
89+ UBIFS_COMPR_XZ,
90     UBIFS_COMPR_TYPES_CNT,
91 };
92 
93

Archive Download this file



interactive