is_block_bad()
PROTOTYPE
#include <bfs.h>
int is_block_bad(ui32 page, void *dev);
DESCRIPTION
is_block_bad() determines if the block whose first page number is page has the manufacturer’s initial bad block mark. Even new NAND devices can have bad blocks. These are marked by clearing bits in specified locations of the spare area, whereas good blocks are initially entirely erased. Consult the data sheet for your device’s initial bad block marking.
dev is a driver-specific data pointer. The value passed to TargetBFS by the bfsAddNandVol() call is passed back as the last parameter of each driver callback function. It can be used in any way that is convenient for the driver implementation.
is_block_bad() returns 1 if the initial bad block mark is present, 0 if it is not, or -1 if a fatal error occurs. A fatal error causes all subsequent accesses to fail with errno set to EIO. A fatal error should be reported if a permanent error condition exists, such as a removable device has been extracted.