summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jffs2dump.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/jffs2dump.c b/jffs2dump.c
index edac2b2..f8b8ac7 100644
--- a/jffs2dump.c
+++ b/jffs2dump.c
@@ -585,6 +585,39 @@ void do_endianconvert (void)
p += PAD(je32_to_cpu (node->d.totlen));
break;
+ case JFFS2_NODETYPE_XATTR:
+ newnode.x.magic = cnv_e16 (node->x.magic);
+ newnode.x.nodetype = cnv_e16 (node->x.nodetype);
+ newnode.x.totlen = cnv_e32 (node->x.totlen);
+ newnode.x.hdr_crc = cpu_to_e32 (mtd_crc32 (0, &newnode, sizeof (struct jffs2_unknown_node) - 4));
+ newnode.x.xid = cnv_e32 (node->x.xid);
+ newnode.x.version = cnv_e32 (node->x.version);
+ newnode.x.xprefix = node->x.xprefix;
+ newnode.x.name_len = node->x.name_len;
+ newnode.x.value_len = cnv_e16 (node->x.value_len);
+ if (recalccrc)
+ newnode.x.data_crc = cpu_to_e32 (mtd_crc32 (0, p + sizeof (struct jffs2_raw_xattr), node->x.name_len + je16_to_cpu (node->x.value_len) + 1));
+ else
+ newnode.x.data_crc = cnv_e32 (node->x.data_crc);
+ newnode.x.node_crc = cpu_to_e32 (mtd_crc32 (0, &newnode, sizeof (struct jffs2_raw_xattr) - sizeof (newnode.x.node_crc)));
+
+ write (fd, &newnode, sizeof (struct jffs2_raw_xattr));
+ write (fd, p + sizeof (struct jffs2_raw_xattr), PAD (je32_to_cpu (node->d.totlen) - sizeof (struct jffs2_raw_xattr)));
+ p += PAD(je32_to_cpu (node->x.totlen));
+ break;
+
+ case JFFS2_NODETYPE_XREF:
+ newnode.r.magic = cnv_e16 (node->r.magic);
+ newnode.r.nodetype = cnv_e16 (node->r.nodetype);
+ newnode.r.totlen = cnv_e32 (node->r.totlen);
+ newnode.r.hdr_crc = cpu_to_e32 (mtd_crc32 (0, &newnode, sizeof (struct jffs2_unknown_node) - sizeof (newnode.r.hdr_crc)));
+ newnode.r.ino = cnv_e32 (node->r.ino);
+ newnode.r.xid = cnv_e32 (node->r.xid);
+ newnode.r.xseqno = cnv_e32 (node->r.xseqno);
+ newnode.r.node_crc = cpu_to_e32 (mtd_crc32 (0, &newnode, sizeof (struct jffs2_raw_xref) - sizeof (newnode.r.node_crc)));
+ p += PAD(je32_to_cpu (node->x.totlen));
+ break;
+
case JFFS2_NODETYPE_CLEANMARKER:
case JFFS2_NODETYPE_PADDING:
newnode.u.magic = cnv_e16 (node->u.magic);
@@ -649,6 +682,23 @@ void do_endianconvert (void)
counter += sizeof (struct jffs2_sum_dirent_flash) + fl_ptr->d.nsize;
break;
+ case JFFS2_NODETYPE_XATTR:
+ fl_ptr->x.nodetype = cnv_e16 (fl_ptr->x.nodetype);
+ fl_ptr->x.xid = cnv_e32 (fl_ptr->x.xid);
+ fl_ptr->x.version = cnv_e32 (fl_ptr->x.version);
+ fl_ptr->x.offset = cnv_e32 (fl_ptr->x.offset);
+ fl_ptr->x.totlen = cnv_e32 (fl_ptr->x.totlen);
+ p += sizeof (struct jffs2_sum_xattr_flash);
+ counter += sizeof (struct jffs2_sum_xattr_flash);
+ break;
+
+ case JFFS2_NODETYPE_XREF:
+ fl_ptr->r.nodetype = cnv_e16 (fl_ptr->r.nodetype);
+ fl_ptr->r.offset = cnv_e32 (fl_ptr->r.offset);
+ p += sizeof (struct jffs2_sum_xref_flash);
+ counter += sizeof (struct jffs2_sum_xref_flash);
+ break;
+
default :
printf("Unknown node in summary information!!! nodetype(%x)\n", je16_to_cpu (fl_ptr->u.nodetype));
exit(EXIT_FAILURE);