add optimization to Freescale targets
[openwrt.git] / target / linux / generic / patches-2.6.37 / 007-squashfs_make_lzma_available.patch
1 From fdf23ed283bc6ef5c25076ce2065f892120ff556 Mon Sep 17 00:00:00 2001
2 From: Phillip Lougher <phillip@lougher.demon.co.uk>
3 Date: Thu, 22 Oct 2009 04:57:38 +0100
4 Subject: [PATCH] Squashfs: Make unlzma available to non initramfs/initrd code
5
6 Add a config option DECOMPRESS_LZMA_NEEDED which allows subsystems to
7 specify they need the unlzma code. Normally decompress_unlzma.c is
8 compiled with __init and unlzma is not exported to modules.
9
10 Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
11 ---
12 fs/squashfs/Kconfig | 1 +
13 include/linux/decompress/bunzip2_mm.h | 12 ++++++++++++
14 include/linux/decompress/inflate_mm.h | 12 ++++++++++++
15 include/linux/decompress/mm.h | 3 ---
16 include/linux/decompress/unlzma_mm.h | 20 ++++++++++++++++++++
17 lib/Kconfig | 3 +++
18 lib/decompress_bunzip2.c | 1 +
19 lib/decompress_inflate.c | 1 +
20 lib/decompress_unlzma.c | 5 ++++-
21 9 files changed, 54 insertions(+), 4 deletions(-)
22 create mode 100644 include/linux/decompress/bunzip2_mm.h
23 create mode 100644 include/linux/decompress/inflate_mm.h
24 create mode 100644 include/linux/decompress/unlzma_mm.h
25
26 --- a/fs/squashfs/Kconfig
27 +++ b/fs/squashfs/Kconfig
28 @@ -41,6 +41,7 @@ config SQUASHFS_LZMA
29 bool "Include support for LZMA compressed file systems"
30 depends on SQUASHFS
31 select DECOMPRESS_LZMA
32 + select DECOMPRESS_LZMA_NEEDED
33
34 config SQUASHFS_EMBEDDED
35
36 --- /dev/null
37 +++ b/include/linux/decompress/bunzip2_mm.h
38 @@ -0,0 +1,12 @@
39 +#ifndef BUNZIP2_MM_H
40 +#define BUNZIP2_MM_H
41 +
42 +#ifdef STATIC
43 +/* Code active when included from pre-boot environment: */
44 +#define INIT
45 +#else
46 +/* Compile for initramfs/initrd code only */
47 +#define INIT __init
48 +#endif
49 +
50 +#endif
51 --- /dev/null
52 +++ b/include/linux/decompress/inflate_mm.h
53 @@ -0,0 +1,12 @@
54 +#ifndef INFLATE_MM_H
55 +#define INFLATE_MM_H
56 +
57 +#ifdef STATIC
58 +/* Code active when included from pre-boot environment: */
59 +#define INIT
60 +#else
61 +/* Compile for initramfs/initrd code only */
62 +#define INIT __init
63 +#endif
64 +
65 +#endif
66 --- a/include/linux/decompress/mm.h
67 +++ b/include/linux/decompress/mm.h
68 @@ -63,8 +63,6 @@ static void free(void *where)
69
70 #define set_error_fn(x)
71
72 -#define INIT
73 -
74 #else /* STATIC */
75
76 /* Code active when compiled standalone for use when loading ramdisk: */
77 @@ -87,7 +85,6 @@ static void free(void *where)
78 static void(*error)(char *m);
79 #define set_error_fn(x) error = x;
80
81 -#define INIT __init
82 #define STATIC
83
84 #include <linux/init.h>
85 --- /dev/null
86 +++ b/include/linux/decompress/unlzma_mm.h
87 @@ -0,0 +1,20 @@
88 +#ifndef UNLZMA_MM_H
89 +#define UNLZMA_MM_H
90 +
91 +#ifdef STATIC
92 +
93 +/* Code active when included from pre-boot environment: */
94 +#define INIT
95 +
96 +#elif defined(CONFIG_DECOMPRESS_LZMA_NEEDED)
97 +
98 +/* Make it available to non initramfs/initrd code */
99 +#define INIT
100 +#include <linux/module.h>
101 +#else
102 +
103 +/* Compile for initramfs/initrd code only */
104 +#define INIT __init
105 +#endif
106 +
107 +#endif
108 --- a/lib/Kconfig
109 +++ b/lib/Kconfig
110 @@ -124,6 +124,9 @@ config DECOMPRESS_LZO
111 select LZO_DECOMPRESS
112 tristate
113
114 +config DECOMPRESS_LZMA_NEEDED
115 + boolean
116 +
117 #
118 # Generic allocator support is selected if needed
119 #
120 --- a/lib/decompress_bunzip2.c
121 +++ b/lib/decompress_bunzip2.c
122 @@ -52,6 +52,7 @@
123 #include <linux/slab.h>
124 #endif /* STATIC */
125
126 +#include <linux/decompress/bunzip2_mm.h>
127 #include <linux/decompress/mm.h>
128
129 #ifndef INT_MAX
130 --- a/lib/decompress_inflate.c
131 +++ b/lib/decompress_inflate.c
132 @@ -23,6 +23,7 @@
133
134 #endif /* STATIC */
135
136 +#include <linux/decompress/inflate_mm.h>
137 #include <linux/decompress/mm.h>
138
139 #define GZIP_IOBUF_SIZE (16*1024)
140 --- a/lib/decompress_unlzma.c
141 +++ b/lib/decompress_unlzma.c
142 @@ -36,6 +36,7 @@
143 #include <linux/slab.h>
144 #endif /* STATIC */
145
146 +#include <linux/decompress/unlzma_mm.h>
147 #include <linux/decompress/mm.h>
148
149 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
150 @@ -531,7 +532,7 @@ static inline void INIT process_bit1(str
151
152
153
154 -STATIC inline int INIT unlzma(unsigned char *buf, int in_len,
155 +STATIC int INIT unlzma(unsigned char *buf, int in_len,
156 int(*fill)(void*, unsigned int),
157 int(*flush)(void*, unsigned int),
158 unsigned char *output,
159 @@ -664,4 +665,6 @@ STATIC int INIT decompress(unsigned char
160 {
161 return unlzma(buf, in_len - 4, fill, flush, output, posp, error_fn);
162 }
163 +#elif defined(CONFIG_DECOMPRESS_LZMA_NEEDED)
164 +EXPORT_SYMBOL(unlzma);
165 #endif
This page took 0.050197 seconds and 5 git commands to generate.