Add missing default value for some Kconfig's entries.
[yaffs2.git] / yaffs_packedtags2.c
index 01e23a7..f4de18d 100644 (file)
@@ -29,7 +29,8 @@
 
 #define EXTRA_HEADER_INFO_FLAG 0x80000000
 #define EXTRA_SHRINK_FLAG      0x40000000
-#define EXTRA_SPARE_FLAGS      0x30000000
+#define EXTRA_SHADOWS_FLAG     0x20000000
+#define EXTRA_SPARE_FLAGS      0x10000000
 
 #define ALL_EXTRA_FLAGS                0xF0000000
 
@@ -68,6 +69,10 @@ void yaffs_PackTags2(yaffs_PackedTags2 *pt, const yaffs_ExtendedTags *t)
                {
                    pt->t.chunkId |= EXTRA_SHRINK_FLAG;
                }
+               if(t->extraShadows) 
+               {
+                   pt->t.chunkId |= EXTRA_SHADOWS_FLAG;
+               }
                
                pt->t.objectId &= ~EXTRA_OBJECT_TYPE_MASK;
                pt->t.objectId |= (t->extraObjectType << EXTRA_OBJECT_TYPE_SHIFT);
@@ -89,8 +94,11 @@ void yaffs_PackTags2(yaffs_PackedTags2 *pt, const yaffs_ExtendedTags *t)
        yaffs_DumpPackedTags2(pt);
        yaffs_DumpTags2(t);
        
-       yaffs_ECCCalculateOther((unsigned char *)&pt->t,sizeof(yaffs_PackedTags2TagsPart),&pt->ecc);
-       
+#ifndef YAFFS_IGNORE_TAGS_ECC
+       { 
+         yaffs_ECCCalculateOther((unsigned char *)&pt->t,sizeof(yaffs_PackedTags2TagsPart),&pt->ecc);
+       }
+#endif
 }
 
 void yaffs_UnpackTags2(yaffs_ExtendedTags *t, yaffs_PackedTags2 *pt)
@@ -104,9 +112,17 @@ void yaffs_UnpackTags2(yaffs_ExtendedTags *t, yaffs_PackedTags2 *pt)
        if(pt->t.sequenceNumber != 0xFFFFFFFF)
        {
                // Page is in use
-               yaffs_ECCOther ecc;
-               yaffs_ECCCalculateOther((unsigned char *)&pt->t,sizeof(yaffs_PackedTags2TagsPart),&ecc);
-               t->eccResult = yaffs_ECCCorrectOther((unsigned char *)&pt->t,sizeof(yaffs_PackedTags2TagsPart),&pt->ecc,&ecc);
+#ifdef YAFFS_IGNORE_TAGS_ECC
+               {
+                       t->eccResult = 0;
+               }
+#else
+               {
+                       yaffs_ECCOther ecc;
+                       yaffs_ECCCalculateOther((unsigned char *)&pt->t,sizeof(yaffs_PackedTags2TagsPart),&ecc);
+                       t->eccResult = yaffs_ECCCorrectOther((unsigned char *)&pt->t,sizeof(yaffs_PackedTags2TagsPart),&pt->ecc,&ecc);
+               }
+#endif
                t->blockBad = 0;
                t->chunkUsed = 1;
                t->objectId = pt->t.objectId;
@@ -126,6 +142,7 @@ void yaffs_UnpackTags2(yaffs_ExtendedTags *t, yaffs_PackedTags2 *pt)
                        t->extraHeaderInfoAvailable = 1;
                        t->extraParentObjectId = pt->t.chunkId & (~(ALL_EXTRA_FLAGS));
                        t->extraIsShrinkHeader =  (pt->t.chunkId & EXTRA_SHRINK_FLAG) ? 1 : 0;
+                       t->extraShadows =  (pt->t.chunkId & EXTRA_SHADOWS_FLAG) ? 1 : 0;
                        t->extraObjectType = pt->t.objectId >> EXTRA_OBJECT_TYPE_SHIFT;
                        t->objectId &= ~EXTRA_OBJECT_TYPE_MASK;