1 #include "logfsos.h" 2 #include "logfs.h" 3 #include "nandfs.h" 4 #include "local.h" 5 6 /* 7 * update the tags in a page's auxiliary area 8 * only touch the fields if they contain some zeros, and compute the hamming codes 9 * as well 10 */ 11 12 char * 13 nandfswritepageauxiliary(Nandfs *nandfs, NandfsTags *tags, long absblock, int page) 14 { 15 NandfsAuxiliary hdr; 16 ulong tmp; 17 ushort htmp; 18 19 memset(&hdr, 0xff, sizeof(hdr)); 20 if (tags->path < NandfsPathMask) { 21 tmp = _nandfshamming31_26calc((tags->path << 6)) | (1 << 5); 22 putbig4(hdr.parth, tmp); 23 } 24 if (tags->nerase < NandfsNeraseMask || tags->magic != 0xff) { 25 tmp = _nandfshamming31_26calc((tags->magic << 24) | (tags->nerase << 6)) | (1 << 5); 26 htmp = tmp >> 16; 27 putbig2(hdr.nerasemagicmsw, htmp); 28 putbig2(hdr.nerasemagiclsw, tmp); 29 } 30 if (tags->tag != 0xff) 31 hdr.tag = tags->tag; 32 return (*nandfs->write)(nandfs->magic, &hdr, sizeof(hdr), nandfs->rawblocksize * absblock + page * NandfsFullSize + NandfsPageSize); 33 } 34