uffs_badblock.c File Reference

bad block checking and recovering More...

#include "uffs/uffs_fs.h"
#include "uffs/uffs_config.h"
#include "uffs/uffs_ecc.h"
#include <string.h>

Go to the source code of this file.

Defines

#define PFX   "badblock:"

Functions

URET uffs_CheckBadBlock (uffs_Device *dev, uffs_Buf *buf, int block)
 check ECC in buf, if the data is corrupt, try ECC correction.
void uffs_InitBadBlock (uffs_Device *dev)
void uffs_RecoverBadBlock (uffs_Device *dev)
 recover bad block


Detailed Description

bad block checking and recovering

Author:
Ricky Zheng, created in 13th Jun, 2005

Definition in file uffs_badblock.c.


Define Documentation

#define PFX   "badblock:"

Definition at line 12 of file uffs_badblock.c.


Function Documentation

URET uffs_CheckBadBlock ( uffs_Device dev,
uffs_Buf buf,
int  block 
)

check ECC in buf, if the data is corrupt, try ECC correction.

Parameters:
[in] dev uffs device
[in] buf data in buf
[in] block num of this buf
Returns:
return U_SUCC if data is valid or collected by ECC successful, return U_FAIL if ECC fail.
Note:
if a bad block is found, it will then be add to dev->bad, so that we can deal with it later by calling uffs_RecoverBadBlock.

mark this block as a new discovered bad block, so that we can deal with this bad block later.(by calling uffs_RecoverBadBlock)

Don't know how can we do, but set treat it as a new discovered bad block anyway.

Definition at line 29 of file uffs_badblock.c.

References uffs_DeviceSt::bad, uffs_newBadBlockSt::block, uffs_BufSt::data, uffs_BufSt::ecc, uffs_FlashOpsSt::EccCollect, uffs_DeviceSt::flash, uffs_FlashOpsSt::MakeEcc, MAX_ECC_LENGTH, PFX, U_FAIL, U_SUCC, UFFS_ERR_NOISY, UFFS_ERR_NORMAL, UFFS_ERR_SERIOUS, UFFS_INVALID_BLOCK, and uffs_Perror().

Referenced by uffs_LoadPhiDataToBuf(), and uffs_LoadPhiDataToBufEccUnCare().

void uffs_InitBadBlock ( uffs_Device dev  ) 

Definition at line 14 of file uffs_badblock.c.

References uffs_DeviceSt::bad, uffs_newBadBlockSt::block, and UFFS_INVALID_BLOCK.

Referenced by uffs_InitDevice().

void uffs_RecoverBadBlock ( uffs_Device dev  ) 

recover bad block

Parameters:
[in] dev uffs device

Definition at line 81 of file uffs_badblock.c.

References uffs_DeviceSt::attr, uffs_DeviceSt::bad, fdataSt::block, filehSt::block, dirhSt::block, blocklistSt::block, uffs_newBadBlockSt::block, uffs_blockInfoSt::blockNum, uffs_TagsSt::blockTimeStamp, uffs_DeviceSt::com, uffs_treeNodeSt::data, uffs_BufSt::dataLen, uffs_TagsSt::dataLength, uffs_treeNodeSt::dir, uffs_DeviceOpsSt::EraseBlock, uffs_TagsSt::father, uffs_BufSt::father, uffs_treeNodeSt::file, uffs_DeviceSt::flash, uffs_treeNodeSt::list, uffs_FlashOpsSt::MakeBadBlockMark, NULL, uffs_DeviceSt::ops, uffs_TagsSt::pageID, uffs_BufSt::pageID, uffs_storageAttrSt::pages_per_block, PFX, uffs_commInfoSt::pgDataSize, SEARCH_REGION_DATA, SEARCH_REGION_DIR, SEARCH_REGION_FILE, uffs_TagsSt::serial, uffs_BufSt::serial, uffs_blockInfoSt::spares, uffs_pageSpareSt::tag, uffs_TagsSt::type, uffs_BufSt::type, uffs_treeNodeSt::u, U_FAIL, U_FALSE, U_SUCC, U_TRUE, UFFS_ALL_PAGES, uffs_BufClone(), uffs_BufFreeClone(), UFFS_ERR_NOISY, UFFS_ERR_NORMAL, UFFS_ERR_SERIOUS, uffs_ExpireBlockInfo(), uffs_FindBestPageInBlock(), uffs_FindNodeByBlock(), uffs_FindPageInBlockWithPageId(), uffs_GetBlockInfo(), uffs_GetErased(), uffs_GetNextBlockTimeStamp(), uffs_InsertToBadBlockList(), uffs_InsertToErasedListTail(), UFFS_INVALID_BLOCK, UFFS_INVALID_PAGE, uffs_LoadPhiDataToBufEccUnCare(), uffs_Perror(), uffs_PutBlockInfo(), UFFS_TYPE_DATA, UFFS_TYPE_DIR, UFFS_TYPE_FILE, and uffs_WriteDataToNewPage().

Referenced by uffs_DeleteObject(), uffs_ReadObject(), uffs_TruncateObject(), and uffs_WriteObject().


Generated on Sat Mar 17 15:45:45 2007 for uffs-doc by  doxygen 1.5.0