annotate yaffs_packedtags2.c @ 424:d21d6fd33e63

yaffs Fix incorrect handling of deletion flag Move the reading of the deleted flag so that it picks up any changes. Notw we need a value on the stack because the object might get freed and we don't want to access a hanging pointer. Signed-off-by: Charles Manning <cdhmanning@gmail.com>
author Charles Manning <cdhmanning@gmail.com>
date Thu, 13 May 2010 14:29:16 +1200
parents b5309c9b6d7f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
1 /*
168
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 142
diff changeset
2 * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
14
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
3 *
409
b5309c9b6d7f yaffs Some cleanups.
Charles Manning <cdhmanning@gmail.com>
parents: 343
diff changeset
4 * Copyright (C) 2002-2010 Aleph One Ltd.
168
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 142
diff changeset
5 * for Toby Churchill Ltd and Brightstar Engineering
14
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
6 *
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
7 * Created by Charles Manning <charles@aleph1.co.uk>
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
8 *
168
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 142
diff changeset
9 * This program is free software; you can redistribute it and/or modify
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 142
diff changeset
10 * it under the terms of the GNU General Public License version 2 as
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 142
diff changeset
11 * published by the Free Software Foundation.
14
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
12 */
77
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
13
6
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
14 #include "yaffs_packedtags2.h"
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
15 #include "yportenv.h"
342
ce702882929d Move tracing out of yportenv.h
charles <charles>
parents: 300
diff changeset
16 #include "yaffs_trace.h"
14
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
17 #include "yaffs_tagsvalidity.h"
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
18
77
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
19 /* This code packs a set of extended tags into a binary structure for
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
20 * NAND storage
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
21 */
14
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
22
77
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
23 /* Some of the information is "extra" struff which can be packed in to
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
24 * speed scanning
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
25 * This is defined by having the EXTRA_HEADER_INFO_FLAG set.
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
26 */
14
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
27
77
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
28 /* Extra flags applied to chunkId */
14
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
29
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
30 #define EXTRA_HEADER_INFO_FLAG 0x80000000
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
31 #define EXTRA_SHRINK_FLAG 0x40000000
48
9ca91a18bea2 Add flag for object shadowing
charles <charles>
parents: 22
diff changeset
32 #define EXTRA_SHADOWS_FLAG 0x20000000
9ca91a18bea2 Add flag for object shadowing
charles <charles>
parents: 22
diff changeset
33 #define EXTRA_SPARE_FLAGS 0x10000000
14
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
34
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
35 #define ALL_EXTRA_FLAGS 0xF0000000
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
36
77
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
37 /* Also, the top 4 bits of the object Id are set to the object type. */
14
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
38 #define EXTRA_OBJECT_TYPE_SHIFT (28)
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
39 #define EXTRA_OBJECT_TYPE_MASK ((0x0F) << EXTRA_OBJECT_TYPE_SHIFT)
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
40
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
41
271
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
42 static void yaffs_DumpPackedTags2TagsPart(const yaffs_PackedTags2TagsPart *ptt)
7
9fd733a84a74 *** empty log message ***
charles <charles>
parents: 6
diff changeset
43 {
77
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
44 T(YAFFS_TRACE_MTD,
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
45 (TSTR("packed tags obj %d chunk %d byte %d seq %d" TENDSTR),
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
46 ptt->objectId, ptt->chunkId, ptt->byteCount,
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
47 ptt->sequenceNumber));
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
48 }
271
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
49 static void yaffs_DumpPackedTags2(const yaffs_PackedTags2 *pt)
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
50 {
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
51 yaffs_DumpPackedTags2TagsPart(&pt->t);
7
9fd733a84a74 *** empty log message ***
charles <charles>
parents: 6
diff changeset
52 }
6
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
53
271
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
54 static void yaffs_DumpTags2(const yaffs_ExtendedTags *t)
7
9fd733a84a74 *** empty log message ***
charles <charles>
parents: 6
diff changeset
55 {
77
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
56 T(YAFFS_TRACE_MTD,
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
57 (TSTR
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
58 ("ext.tags eccres %d blkbad %d chused %d obj %d chunk%d byte %d del %d ser %d seq %d"
77
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
59 TENDSTR), t->eccResult, t->blockBad, t->chunkUsed, t->objectId,
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
60 t->chunkId, t->byteCount, t->chunkDeleted, t->serialNumber,
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
61 t->sequenceNumber));
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
62
7
9fd733a84a74 *** empty log message ***
charles <charles>
parents: 6
diff changeset
63 }
9fd733a84a74 *** empty log message ***
charles <charles>
parents: 6
diff changeset
64
271
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
65 void yaffs_PackTags2TagsPart(yaffs_PackedTags2TagsPart *ptt,
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
66 const yaffs_ExtendedTags *t)
6
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
67 {
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
68 ptt->chunkId = t->chunkId;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
69 ptt->sequenceNumber = t->sequenceNumber;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
70 ptt->byteCount = t->byteCount;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
71 ptt->objectId = t->objectId;
77
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
72
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
73 if (t->chunkId == 0 && t->extraHeaderInfoAvailable) {
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
74 /* Store the extra header info instead */
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
75 /* We save the parent object in the chunkId */
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
76 ptt->chunkId = EXTRA_HEADER_INFO_FLAG
77
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
77 | t->extraParentObjectId;
274
4c1611b9a4d7 More formatting
charles <charles>
parents: 271
diff changeset
78 if (t->extraIsShrinkHeader)
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
79 ptt->chunkId |= EXTRA_SHRINK_FLAG;
274
4c1611b9a4d7 More formatting
charles <charles>
parents: 271
diff changeset
80 if (t->extraShadows)
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
81 ptt->chunkId |= EXTRA_SHADOWS_FLAG;
77
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
82
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
83 ptt->objectId &= ~EXTRA_OBJECT_TYPE_MASK;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
84 ptt->objectId |=
77
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
85 (t->extraObjectType << EXTRA_OBJECT_TYPE_SHIFT);
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
86
274
4c1611b9a4d7 More formatting
charles <charles>
parents: 271
diff changeset
87 if (t->extraObjectType == YAFFS_OBJECT_TYPE_HARDLINK)
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
88 ptt->byteCount = t->extraEquivalentObjectId;
274
4c1611b9a4d7 More formatting
charles <charles>
parents: 271
diff changeset
89 else if (t->extraObjectType == YAFFS_OBJECT_TYPE_FILE)
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
90 ptt->byteCount = t->extraFileLength;
274
4c1611b9a4d7 More formatting
charles <charles>
parents: 271
diff changeset
91 else
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
92 ptt->byteCount = 0;
14
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
93 }
77
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
94
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
95 yaffs_DumpPackedTags2TagsPart(ptt);
7
9fd733a84a74 *** empty log message ***
charles <charles>
parents: 6
diff changeset
96 yaffs_DumpTags2(t);
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
97 }
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
98
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
99
343
1d1b453d8b57 Change parameters to packing/unpacking to fix mkyaffs2image compilation issue
charles <charles>
parents: 342
diff changeset
100 void yaffs_PackTags2(yaffs_PackedTags2 *pt, const yaffs_ExtendedTags *t, int tagsECC)
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
101 {
271
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
102 yaffs_PackTags2TagsPart(&pt->t, t);
77
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
103
343
1d1b453d8b57 Change parameters to packing/unpacking to fix mkyaffs2image compilation issue
charles <charles>
parents: 342
diff changeset
104 if(tagsECC)
77
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
105 yaffs_ECCCalculateOther((unsigned char *)&pt->t,
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
106 sizeof(yaffs_PackedTags2TagsPart),
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
107 &pt->ecc);
6
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
108 }
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
109
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
110
271
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
111 void yaffs_UnpackTags2TagsPart(yaffs_ExtendedTags *t,
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
112 yaffs_PackedTags2TagsPart *ptt)
6
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
113 {
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
114
77
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
115 memset(t, 0, sizeof(yaffs_ExtendedTags));
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
116
14
b2bfca6c227e Add scanning speedups
charles <charles>
parents: 7
diff changeset
117 yaffs_InitialiseTags(t);
77
794fd064bd36 lindent
marty <marty>
parents: 48
diff changeset
118
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
119 if (ptt->sequenceNumber != 0xFFFFFFFF) {
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
120 t->blockBad = 0;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
121 t->chunkUsed = 1;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
122 t->objectId = ptt->objectId;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
123 t->chunkId = ptt->chunkId;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
124 t->byteCount = ptt->byteCount;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
125 t->chunkDeleted = 0;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
126 t->serialNumber = 0;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
127 t->sequenceNumber = ptt->sequenceNumber;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
128
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
129 /* Do extra header info stuff */
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
130
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
131 if (ptt->chunkId & EXTRA_HEADER_INFO_FLAG) {
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
132 t->chunkId = 0;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
133 t->byteCount = 0;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
134
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
135 t->extraHeaderInfoAvailable = 1;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
136 t->extraParentObjectId =
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
137 ptt->chunkId & (~(ALL_EXTRA_FLAGS));
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
138 t->extraIsShrinkHeader =
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
139 (ptt->chunkId & EXTRA_SHRINK_FLAG) ? 1 : 0;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
140 t->extraShadows =
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
141 (ptt->chunkId & EXTRA_SHADOWS_FLAG) ? 1 : 0;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
142 t->extraObjectType =
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
143 ptt->objectId >> EXTRA_OBJECT_TYPE_SHIFT;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
144 t->objectId &= ~EXTRA_OBJECT_TYPE_MASK;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
145
274
4c1611b9a4d7 More formatting
charles <charles>
parents: 271
diff changeset
146 if (t->extraObjectType == YAFFS_OBJECT_TYPE_HARDLINK)
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
147 t->extraEquivalentObjectId = ptt->byteCount;
274
4c1611b9a4d7 More formatting
charles <charles>
parents: 271
diff changeset
148 else
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
149 t->extraFileLength = ptt->byteCount;
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
150 }
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
151 }
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
152
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
153 yaffs_DumpPackedTags2TagsPart(ptt);
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
154 yaffs_DumpTags2(t);
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
155
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
156 }
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
157
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
158
343
1d1b453d8b57 Change parameters to packing/unpacking to fix mkyaffs2image compilation issue
charles <charles>
parents: 342
diff changeset
159 void yaffs_UnpackTags2(yaffs_ExtendedTags *t, yaffs_PackedTags2 *pt, int tagsECC)
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
160 {
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
161
244
0aa06e859ccc Improve handling of ecc on tags
charles <charles>
parents: 204
diff changeset
162 yaffs_ECCResult eccResult = YAFFS_ECC_RESULT_NO_ERROR;
271
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
163
300
4d9d442da93f Allow the disabling of tags ECC
charles <charles>
parents: 274
diff changeset
164 if (pt->t.sequenceNumber != 0xFFFFFFFF &&
343
1d1b453d8b57 Change parameters to packing/unpacking to fix mkyaffs2image compilation issue
charles <charles>
parents: 342
diff changeset
165 tagsECC){
300
4d9d442da93f Allow the disabling of tags ECC
charles <charles>
parents: 274
diff changeset
166 /* Chunk is in use and we need to do ECC */
4d9d442da93f Allow the disabling of tags ECC
charles <charles>
parents: 274
diff changeset
167
4d9d442da93f Allow the disabling of tags ECC
charles <charles>
parents: 274
diff changeset
168 yaffs_ECCOther ecc;
4d9d442da93f Allow the disabling of tags ECC
charles <charles>
parents: 274
diff changeset
169 int result;
4d9d442da93f Allow the disabling of tags ECC
charles <charles>
parents: 274
diff changeset
170 yaffs_ECCCalculateOther((unsigned char *)&pt->t,
4d9d442da93f Allow the disabling of tags ECC
charles <charles>
parents: 274
diff changeset
171 sizeof(yaffs_PackedTags2TagsPart),
4d9d442da93f Allow the disabling of tags ECC
charles <charles>
parents: 274
diff changeset
172 &ecc);
4d9d442da93f Allow the disabling of tags ECC
charles <charles>
parents: 274
diff changeset
173 result = yaffs_ECCCorrectOther((unsigned char *)&pt->t,
4d9d442da93f Allow the disabling of tags ECC
charles <charles>
parents: 274
diff changeset
174 sizeof(yaffs_PackedTags2TagsPart),
4d9d442da93f Allow the disabling of tags ECC
charles <charles>
parents: 274
diff changeset
175 &pt->ecc, &ecc);
4d9d442da93f Allow the disabling of tags ECC
charles <charles>
parents: 274
diff changeset
176 switch (result) {
271
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
177 case 0:
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
178 eccResult = YAFFS_ECC_RESULT_NO_ERROR;
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
179 break;
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
180 case 1:
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
181 eccResult = YAFFS_ECC_RESULT_FIXED;
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
182 break;
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
183 case -1:
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
184 eccResult = YAFFS_ECC_RESULT_UNFIXED;
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
185 break;
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
186 default:
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
187 eccResult = YAFFS_ECC_RESULT_UNKNOWN;
22
0b57027b96fe Some improvements to garbage collection and st_xxx to yst_xxx changes
charles <charles>
parents: 14
diff changeset
188 }
6
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
189 }
7
9fd733a84a74 *** empty log message ***
charles <charles>
parents: 6
diff changeset
190
271
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
191 yaffs_UnpackTags2TagsPart(t, &pt->t);
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 244
diff changeset
192
244
0aa06e859ccc Improve handling of ecc on tags
charles <charles>
parents: 204
diff changeset
193 t->eccResult = eccResult;
0aa06e859ccc Improve handling of ecc on tags
charles <charles>
parents: 204
diff changeset
194
7
9fd733a84a74 *** empty log message ***
charles <charles>
parents: 6
diff changeset
195 yaffs_DumpPackedTags2(pt);
9fd733a84a74 *** empty log message ***
charles <charles>
parents: 6
diff changeset
196 yaffs_DumpTags2(t);
6
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
197 }
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
198