فهرست منبع

Add crc of data to jffs2 (in jffs2_1pass_build_lists()).
Patch by Rick Bronson, 15 Jun 2005

Wolfgang Denk 19 سال پیش
والد
کامیت
74f92e6a3f
3فایلهای تغییر یافته به همراه17 افزوده شده و 1 حذف شده
  1. 3 0
      CHANGELOG
  2. 2 1
      fs/jffs2/jffs2_1pass.c
  3. 12 0
      fs/jffs2/jffs2_private.h

+ 3 - 0
CHANGELOG

@@ -2,6 +2,9 @@
 Changes since U-Boot 1.1.4:
 Changes since U-Boot 1.1.4:
 ======================================================================
 ======================================================================
 
 
+* Add crc of data to jffs2 (in jffs2_1pass_build_lists()).
+  Patch by Rick Bronson, 15 Jun 2005
+
 * Coding Style cleanup
 * Coding Style cleanup
 
 
 * Avoid dereferencing NULL in find_cmd() if no valid commands were found
 * Avoid dereferencing NULL in find_cmd() if no valid commands were found

+ 2 - 1
fs/jffs2/jffs2_1pass.c

@@ -1171,7 +1171,8 @@ jffs2_1pass_build_lists(struct part_info * part)
 		if (node->magic == JFFS2_MAGIC_BITMASK && hdr_crc(node)) {
 		if (node->magic == JFFS2_MAGIC_BITMASK && hdr_crc(node)) {
 			/* if its a fragment add it */
 			/* if its a fragment add it */
 			if (node->nodetype == JFFS2_NODETYPE_INODE &&
 			if (node->nodetype == JFFS2_NODETYPE_INODE &&
-				    inode_crc((struct jffs2_raw_inode *) node)) {
+				    inode_crc((struct jffs2_raw_inode *) node) &&
+				    data_crc((struct jffs2_raw_inode *) node)) {
 				if (insert_node(&pL->frag, (u32) part->offset +
 				if (insert_node(&pL->frag, (u32) part->offset +
 						offset) == NULL) {
 						offset) == NULL) {
 					put_fl_mem(node);
 					put_fl_mem(node);

+ 12 - 0
fs/jffs2/jffs2_private.h

@@ -85,4 +85,16 @@ inode_crc(struct jffs2_raw_inode *node)
 	}
 	}
 }
 }
 
 
+static inline int
+data_crc(struct jffs2_raw_inode *node)
+{
+	if (node->data_crc != crc32_no_comp(0, (unsigned char *)
+                                            ((int) &node->node_crc + sizeof (node->node_crc)),
+                                             node->csize)) {
+		return 0;
+	} else {
+		return 1;
+	}
+}
+
 #endif /* jffs2_private.h */
 #endif /* jffs2_private.h */