1#include "yaffs_packedtags1.h" 2#include "yportenv.h" 3 4void yaffs_PackTags1(yaffs_PackedTags1 * pt, const yaffs_ExtendedTags * t) 5{ 6 pt->chunkId = t->chunkId; 7 pt->serialNumber = t->serialNumber; 8 pt->byteCount = t->byteCount; 9 pt->objectId = t->objectId; 10 pt->ecc = 0; 11 pt->deleted = (t->chunkDeleted) ? 0 : 1; 12 pt->unusedStuff = 0; 13 pt->shouldBeFF = 0xFFFFFFFF; 14 15} 16 17void yaffs_UnpackTags1(yaffs_ExtendedTags * t, const yaffs_PackedTags1 * pt) 18{ 19 static const __u8 allFF[] = 20 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 210xff }; 22 23 if (memcmp(allFF, pt, sizeof(yaffs_PackedTags1))) { 24 t->blockBad = 0; 25 if (pt->shouldBeFF != 0xFFFFFFFF) { 26 t->blockBad = 1; 27 } 28 t->chunkUsed = 1; 29 t->objectId = pt->objectId; 30 t->chunkId = pt->chunkId; 31 t->byteCount = pt->byteCount; 32 t->eccResult = YAFFS_ECC_RESULT_NO_ERROR; 33 t->chunkDeleted = (pt->deleted) ? 0 : 1; 34 t->serialNumber = pt->serialNumber; 35 } else { 36 memset(t, 0, sizeof(yaffs_ExtendedTags)); 37 38 } 39} 40