12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
14 #include <linux/kernel.h>
15 #include <linux/slab.h>
19 #include <linux/compiler.h>
30 unsigned char *decomprbuf =
NULL;
31 unsigned char *readbuf =
NULL;
41 pr_warn(
"Error reading node from 0x%08x: %d\n",
45 if (readlen !=
sizeof(*ri)) {
47 pr_warn(
"Short read from 0x%08x: wanted 0x%zx bytes, got 0x%zx\n",
51 crc =
crc32(0, ri,
sizeof(*ri)-8);
53 jffs2_dbg(1,
"Node read from %08x: node_crc %08x, calculated CRC %08x. dsize %x, csize %x, offset %x, buf %p\n",
58 pr_warn(
"Node CRC %08x != calculated CRC %08x for node at %08x\n",
72 pr_warn(
"jffs2_read_dnode() asked for %d bytes at %d from %d-byte node\n",
110 decomprbuf = readbuf;
125 pr_warn(
"Data CRC %08x != calculated CRC %08x for node at %08x\n",
130 jffs2_dbg(2,
"Data CRC matches calculated CRC %08x\n",
crc);
132 jffs2_dbg(2,
"Decompress %d bytes from %p to %d bytes at %p\n",
137 pr_warn(
"Error: jffs2_decompress returned %d\n",
ret);
146 if(decomprbuf !=
buf && decomprbuf != readbuf)
164 jffs2_dbg(1,
"%s(): ino #%u, range 0x%08x-0x%08x\n",
165 __func__, f->
inocache->ino, offset, offset + len);
174 while(offset < end) {
175 jffs2_dbg(2,
"%s(): offset %d, end %d\n",
176 __func__, offset, end);
178 frag->
ofs + frag->
size <= offset)) {
180 if (frag && frag->
ofs > offset) {
181 jffs2_dbg(1,
"Eep. Hole in ino #%u fraglist. frag->ofs = 0x%08x, offset = 0x%08x\n",
183 holesize =
min(holesize, frag->
ofs - offset);
185 jffs2_dbg(1,
"Filling non-frag hole from %d-%d\n",
186 offset, offset + holesize);
193 jffs2_dbg(1,
"Filling frag hole from %d-%d (frag 0x%x 0x%x)\n",
194 offset, holeend, frag->
ofs,
196 memset(buf, 0, holeend - offset);
205 fragofs = offset - frag->
ofs;
206 readlen =
min(frag->
size - fragofs, end - offset);
207 jffs2_dbg(1,
"Reading %d-%d from node at 0x%08x (%d)\n",
209 frag->
ofs + fragofs+readlen,
223 jffs2_dbg(2,
"node read was OK. Looping\n");