kernel: Move CONFIG_CRYPTO_HW to crypto-core
[openwrt/openwrt.git] / tools / mtd-utils / patches / 132-revert-zlib-cleanup.patch
1 diff -Nrup a/compr_zlib.c b/compr_zlib.c
2 --- a/compr_zlib.c
3 +++ b/compr_zlib.c
4 @@ -35,9 +35,7 @@
5 #define PROGRAM_NAME "compr_zlib"
6
7 #include <stdint.h>
8 -#define crc32 __zlib_crc32
9 #include <zlib.h>
10 -#undef crc32
11 #include <stdio.h>
12 #include <linux/jffs2.h>
13 #include "common.h"
14 diff -Nrup a/jffs2reader.c b/jffs2reader.c
15 --- a/jffs2reader.c
16 +++ b/jffs2reader.c
17 @@ -76,6 +76,7 @@ BUGS:
18 #include <sys/stat.h>
19 #include <sys/param.h>
20 #include <dirent.h>
21 +#include <zlib.h>
22 #include <linux/jffs2.h>
23
24 #define SCRATCH_SIZE (5*1024*1024)
25 diff -Nrup a/mkfs.jffs2.c b/mkfs.jffs2.c
26 --- a/mkfs.jffs2.c
27 +++ b/mkfs.jffs2.c
28 @@ -71,6 +71,9 @@
29 #include <sys/acl.h>
30 #endif
31 #include <byteswap.h>
32 +#define crc32 __zlib_crc32
33 +#include <zlib.h>
34 +#undef crc32
35 #include <crc32.h>
36 #include "rbtree.h"
37
38 @@ -725,7 +728,7 @@ static void write_dirent(struct filesyst
39 rd.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
40 rd.nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT);
41 rd.totlen = cpu_to_je32(sizeof(rd) + strlen(name));
42 - rd.hdr_crc = cpu_to_je32(mtd_crc32(0, &rd,
43 + rd.hdr_crc = cpu_to_je32(crc32(0, &rd,
44 sizeof(struct jffs2_unknown_node) - 4));
45 rd.pino = cpu_to_je32((e->parent) ? e->parent->ino : 1);
46 rd.version = cpu_to_je32(version++);
47 @@ -735,8 +738,8 @@ static void write_dirent(struct filesyst
48 rd.type = IFTODT(statbuf->st_mode);
49 //rd.unused[0] = 0;
50 //rd.unused[1] = 0;
51 - rd.node_crc = cpu_to_je32(mtd_crc32(0, &rd, sizeof(rd) - 8));
52 - rd.name_crc = cpu_to_je32(mtd_crc32(0, name, strlen(name)));
53 + rd.node_crc = cpu_to_je32(crc32(0, &rd, sizeof(rd) - 8));
54 + rd.name_crc = cpu_to_je32(crc32(0, name, strlen(name)));
55
56 pad_block_if_less_than(sizeof(rd) + rd.nsize);
57 full_write(out_fd, &rd, sizeof(rd));
58 @@ -822,15 +825,15 @@ static unsigned int write_regular_file(s
59 }
60
61 ri.totlen = cpu_to_je32(sizeof(ri) + space);
62 - ri.hdr_crc = cpu_to_je32(mtd_crc32(0,
63 + ri.hdr_crc = cpu_to_je32(crc32(0,
64 &ri, sizeof(struct jffs2_unknown_node) - 4));
65
66 ri.version = cpu_to_je32(++ver);
67 ri.offset = cpu_to_je32(offset);
68 ri.csize = cpu_to_je32(space);
69 ri.dsize = cpu_to_je32(dsize);
70 - ri.node_crc = cpu_to_je32(mtd_crc32(0, &ri, sizeof(ri) - 8));
71 - ri.data_crc = cpu_to_je32(mtd_crc32(0, wbuf, space));
72 + ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri) - 8));
73 + ri.data_crc = cpu_to_je32(crc32(0, wbuf, space));
74
75 full_write(out_fd, &ri, sizeof(ri));
76 totcomp += sizeof(ri);
77 @@ -855,11 +858,11 @@ static unsigned int write_regular_file(s
78
79 ri.version = cpu_to_je32(++ver);
80 ri.totlen = cpu_to_je32(sizeof(ri));
81 - ri.hdr_crc = cpu_to_je32(mtd_crc32(0,
82 + ri.hdr_crc = cpu_to_je32(crc32(0,
83 &ri, sizeof(struct jffs2_unknown_node) - 4));
84 ri.csize = cpu_to_je32(0);
85 ri.dsize = cpu_to_je32(0);
86 - ri.node_crc = cpu_to_je32(mtd_crc32(0, &ri, sizeof(ri) - 8));
87 + ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri) - 8));
88
89 full_write(out_fd, &ri, sizeof(ri));
90 padword();
91 @@ -894,7 +897,7 @@ static void write_symlink(struct filesys
92 ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
93 ri.nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
94 ri.totlen = cpu_to_je32(sizeof(ri) + len);
95 - ri.hdr_crc = cpu_to_je32(mtd_crc32(0,
96 + ri.hdr_crc = cpu_to_je32(crc32(0,
97 &ri, sizeof(struct jffs2_unknown_node) - 4));
98
99 ri.ino = cpu_to_je32(e->ino);
100 @@ -908,8 +911,8 @@ static void write_symlink(struct filesys
101 ri.version = cpu_to_je32(1);
102 ri.csize = cpu_to_je32(len);
103 ri.dsize = cpu_to_je32(len);
104 - ri.node_crc = cpu_to_je32(mtd_crc32(0, &ri, sizeof(ri) - 8));
105 - ri.data_crc = cpu_to_je32(mtd_crc32(0, e->link, len));
106 + ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri) - 8));
107 + ri.data_crc = cpu_to_je32(crc32(0, e->link, len));
108
109 pad_block_if_less_than(sizeof(ri) + len);
110 full_write(out_fd, &ri, sizeof(ri));
111 @@ -936,7 +939,7 @@ static void write_pipe(struct filesystem
112 ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
113 ri.nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
114 ri.totlen = cpu_to_je32(sizeof(ri));
115 - ri.hdr_crc = cpu_to_je32(mtd_crc32(0,
116 + ri.hdr_crc = cpu_to_je32(crc32(0,
117 &ri, sizeof(struct jffs2_unknown_node) - 4));
118
119 ri.ino = cpu_to_je32(e->ino);
120 @@ -950,7 +953,7 @@ static void write_pipe(struct filesystem
121 ri.version = cpu_to_je32(1);
122 ri.csize = cpu_to_je32(0);
123 ri.dsize = cpu_to_je32(0);
124 - ri.node_crc = cpu_to_je32(mtd_crc32(0, &ri, sizeof(ri) - 8));
125 + ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri) - 8));
126 ri.data_crc = cpu_to_je32(0);
127
128 pad_block_if_less_than(sizeof(ri));
129 @@ -976,7 +979,7 @@ static void write_special_file(struct fi
130 ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
131 ri.nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
132 ri.totlen = cpu_to_je32(sizeof(ri) + sizeof(kdev));
133 - ri.hdr_crc = cpu_to_je32(mtd_crc32(0,
134 + ri.hdr_crc = cpu_to_je32(crc32(0,
135 &ri, sizeof(struct jffs2_unknown_node) - 4));
136
137 ri.ino = cpu_to_je32(e->ino);
138 @@ -990,8 +993,8 @@ static void write_special_file(struct fi
139 ri.version = cpu_to_je32(1);
140 ri.csize = cpu_to_je32(sizeof(kdev));
141 ri.dsize = cpu_to_je32(sizeof(kdev));
142 - ri.node_crc = cpu_to_je32(mtd_crc32(0, &ri, sizeof(ri) - 8));
143 - ri.data_crc = cpu_to_je32(mtd_crc32(0, &kdev, sizeof(kdev)));
144 + ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri) - 8));
145 + ri.data_crc = cpu_to_je32(crc32(0, &kdev, sizeof(kdev)));
146
147 pad_block_if_less_than(sizeof(ri) + sizeof(kdev));
148 full_write(out_fd, &ri, sizeof(ri));
149 @@ -1104,15 +1107,15 @@ static xattr_entry_t *create_xattr_entry
150 rx.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
151 rx.nodetype = cpu_to_je16(JFFS2_NODETYPE_XATTR);
152 rx.totlen = cpu_to_je32(PAD(sizeof(rx) + xe->name_len + 1 + xe->value_len));
153 - rx.hdr_crc = cpu_to_je32(mtd_crc32(0, &rx, sizeof(struct jffs2_unknown_node) - 4));
154 + rx.hdr_crc = cpu_to_je32(crc32(0, &rx, sizeof(struct jffs2_unknown_node) - 4));
155
156 rx.xid = cpu_to_je32(xe->xid);
157 rx.version = cpu_to_je32(1); /* initial version */
158 rx.xprefix = xprefix;
159 rx.name_len = xe->name_len;
160 rx.value_len = cpu_to_je16(xe->value_len);
161 - rx.data_crc = cpu_to_je32(mtd_crc32(0, xe->xname, xe->name_len + 1 + xe->value_len));
162 - rx.node_crc = cpu_to_je32(mtd_crc32(0, &rx, sizeof(rx) - 4));
163 + rx.data_crc = cpu_to_je32(crc32(0, xe->xname, xe->name_len + 1 + xe->value_len));
164 + rx.node_crc = cpu_to_je32(crc32(0, &rx, sizeof(rx) - 4));
165
166 pad_block_if_less_than(sizeof(rx) + xe->name_len + 1 + xe->value_len);
167 full_write(out_fd, &rx, sizeof(rx));
168 @@ -1138,7 +1141,7 @@ static xattr_entry_t *find_xattr_entry(i
169 formalize_posix_acl(xvalue, &value_len);
170
171 name_len = strlen(xname);
172 - index = (mtd_crc32(0, xname, name_len) ^ mtd_crc32(0, xvalue, value_len)) % XATTRENTRY_HASHSIZE;
173 + index = (crc32(0, xname, name_len) ^ crc32(0, xvalue, value_len)) % XATTRENTRY_HASHSIZE;
174 for (xe = xentry_hash[index]; xe; xe = xe->next) {
175 if (xe->xprefix == xprefix
176 && xe->value_len == value_len
177 @@ -1218,11 +1221,11 @@ static void write_xattr_entry(struct fil
178 ref.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
179 ref.nodetype = cpu_to_je16(JFFS2_NODETYPE_XREF);
180 ref.totlen = cpu_to_je32(sizeof(ref));
181 - ref.hdr_crc = cpu_to_je32(mtd_crc32(0, &ref, sizeof(struct jffs2_unknown_node) - 4));
182 + ref.hdr_crc = cpu_to_je32(crc32(0, &ref, sizeof(struct jffs2_unknown_node) - 4));
183 ref.ino = cpu_to_je32(e->ino);
184 ref.xid = cpu_to_je32(xe->xid);
185 ref.xseqno = cpu_to_je32(highest_xseqno += 2);
186 - ref.node_crc = cpu_to_je32(mtd_crc32(0, &ref, sizeof(ref) - 4));
187 + ref.node_crc = cpu_to_je32(crc32(0, &ref, sizeof(ref) - 4));
188
189 pad_block_if_less_than(sizeof(ref));
190 full_write(out_fd, &ref, sizeof(ref));
191 @@ -1350,7 +1353,7 @@ static void create_target_filesystem(str
192 cleanmarker.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
193 cleanmarker.nodetype = cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER);
194 cleanmarker.totlen = cpu_to_je32(cleanmarker_size);
195 - cleanmarker.hdr_crc = cpu_to_je32(mtd_crc32(0, &cleanmarker, sizeof(struct jffs2_unknown_node)-4));
196 + cleanmarker.hdr_crc = cpu_to_je32(crc32(0, &cleanmarker, sizeof(struct jffs2_unknown_node)-4));
197
198 if (ino == 0)
199 ino = 1;
200 diff -Nrup a/mkfs.ubifs/compr.c b/mkfs.ubifs/compr.c
201 --- a/mkfs.ubifs/compr.c
202 +++ b/mkfs.ubifs/compr.c
203 @@ -31,7 +31,6 @@
204
205 #define crc32 __zlib_crc32
206 #include <zlib.h>
207 -#undef crc32
208
209 #include "compr.h"
210 #include "ubifs-media.h"