int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_full_dnode *fd, unsignedchar *buf, int ofs, int len)
{ struct jffs2_raw_inode *ri;
size_t readlen;
uint32_t crc; unsignedchar *decomprbuf = NULL; unsignedchar *readbuf = NULL; int ret = 0;
ri = jffs2_alloc_raw_inode(); if (!ri) return -ENOMEM;
ret = jffs2_flash_read(c, ref_offset(fd->raw), sizeof(*ri), &readlen, (char *)ri); if (ret) {
jffs2_free_raw_inode(ri);
pr_warn("Error reading node from 0x%08x: %d\n",
ref_offset(fd->raw), ret); return ret;
} if (readlen != sizeof(*ri)) {
jffs2_free_raw_inode(ri);
pr_warn("Short read from 0x%08x: wanted 0x%zx bytes, got 0x%zx\n",
ref_offset(fd->raw), sizeof(*ri), readlen); return -EIO;
}
crc = crc32(0, ri, sizeof(*ri)-8);
jffs2_dbg(1, "Node read from %08x: node_crc %08x, calculated CRC %08x. dsize %x, csize %x, offset %x, buf %p\n",
ref_offset(fd->raw), je32_to_cpu(ri->node_crc),
crc, je32_to_cpu(ri->dsize), je32_to_cpu(ri->csize),
je32_to_cpu(ri->offset), buf); if (crc != je32_to_cpu(ri->node_crc)) {
pr_warn("Node CRC %08x != calculated CRC %08x for node at %08x\n",
je32_to_cpu(ri->node_crc), crc, ref_offset(fd->raw));
ret = -EIO; goto out_ri;
} /* There was a bug where we wrote hole nodes out with csize/dsize
swapped. Deal with it */ if (ri->compr == JFFS2_COMPR_ZERO && !je32_to_cpu(ri->dsize) &&
je32_to_cpu(ri->csize)) {
ri->dsize = ri->csize;
ri->csize = cpu_to_je32(0);
}
D1(if(ofs + len > je32_to_cpu(ri->dsize)) {
pr_warn("jffs2_read_dnode() asked for %d bytes at %d from %d-byte node\n",
len, ofs, je32_to_cpu(ri->dsize));
ret = -EINVAL; goto out_ri;
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.