Linux Kernel
3.7.1
|
Go to the source code of this file.
Functions | |
int | ubi_io_read (const struct ubi_device *ubi, void *buf, int pnum, int offset, int len) |
int | ubi_io_write (struct ubi_device *ubi, const void *buf, int pnum, int offset, int len) |
int | ubi_io_sync_erase (struct ubi_device *ubi, int pnum, int torture) |
int | ubi_io_is_bad (const struct ubi_device *ubi, int pnum) |
int | ubi_io_mark_bad (const struct ubi_device *ubi, int pnum) |
int | ubi_io_read_ec_hdr (struct ubi_device *ubi, int pnum, struct ubi_ec_hdr *ec_hdr, int verbose) |
int | ubi_io_write_ec_hdr (struct ubi_device *ubi, int pnum, struct ubi_ec_hdr *ec_hdr) |
int | ubi_io_read_vid_hdr (struct ubi_device *ubi, int pnum, struct ubi_vid_hdr *vid_hdr, int verbose) |
int | ubi_io_write_vid_hdr (struct ubi_device *ubi, int pnum, struct ubi_vid_hdr *vid_hdr) |
int | ubi_self_check_all_ff (struct ubi_device *ubi, int pnum, int offset, int len) |
int ubi_io_is_bad | ( | const struct ubi_device * | ubi, |
int | pnum | ||
) |
int ubi_io_mark_bad | ( | const struct ubi_device * | ubi, |
int | pnum | ||
) |
ubi_io_read - read data from a physical eraseblock. : UBI device description object : buffer where to store the read data : physical eraseblock number to read from : offset within the physical eraseblock from where to read : how many bytes to read
This function reads data from offset of physical eraseblock and stores the read data in the buffer. The following return codes are possible:
o %0 if all the requested data were successfully read; o UBI_IO_BITFLIPS if all the requested data were successfully read, but correctable bit-flips were detected; this is harmless but may indicate that this eraseblock may become bad soon (but do not have to); o %-EBADMSG if the MTD subsystem reported about data integrity problems, for example it can be an ECC error in case of NAND; this most probably means that the data is corrupted; o %-EIO if some I/O error occurred; o other negative error codes in case of other errors.
int ubi_io_read_ec_hdr | ( | struct ubi_device * | ubi, |
int | pnum, | ||
struct ubi_ec_hdr * | ec_hdr, | ||
int | verbose | ||
) |
ubi_io_read_ec_hdr - read and check an erase counter header. : UBI device description object : physical eraseblock to read from : a &struct ubi_ec_hdr object where to store the read erase counter header : be verbose if the header is corrupted or was not found
This function reads erase counter header from physical eraseblock and stores it in . This function also checks CRC checksum of the read erase counter header. The following codes may be returned:
o %0 if the CRC checksum is correct and the header was successfully read; o UBI_IO_BITFLIPS if the CRC is correct, but bit-flips were detected and corrected by the flash driver; this is harmless but may indicate that this eraseblock may become bad soon (but may be not); o UBI_IO_BAD_HDR if the erase counter header is corrupted (a CRC error); o UBI_IO_BAD_HDR_EBADMSG is the same as UBI_IO_BAD_HDR, but there also was a data integrity error (uncorrectable ECC error in case of NAND); o UBI_IO_FF if only 0xFF bytes were read (the PEB is supposedly empty) o a negative error code in case of failure.
int ubi_io_read_vid_hdr | ( | struct ubi_device * | ubi, |
int | pnum, | ||
struct ubi_vid_hdr * | vid_hdr, | ||
int | verbose | ||
) |
ubi_io_read_vid_hdr - read and check a volume identifier header. : UBI device description object : physical eraseblock number to read from : &struct ubi_vid_hdr object where to store the read volume identifier header : be verbose if the header is corrupted or wasn't found
This function reads the volume identifier header from physical eraseblock and stores it in . It also checks CRC checksum of the read volume identifier header. The error codes are the same as in 'ubi_io_read_ec_hdr()'.
Note, the implementation of this function is also very similar to 'ubi_io_read_ec_hdr()', so refer commentaries in 'ubi_io_read_ec_hdr()'.
int ubi_io_sync_erase | ( | struct ubi_device * | ubi, |
int | pnum, | ||
int | torture | ||
) |
ubi_io_sync_erase - synchronously erase a physical eraseblock. : UBI device description object : physical eraseblock number to erase : if this physical eraseblock has to be tortured
This function synchronously erases physical eraseblock . If flag is not zero, the physical eraseblock is checked by means of writing different patterns to it and reading them back. If the torturing is enabled, the physical eraseblock is erased more than once.
This function returns the number of erasures made in case of success, %-EIO if the erasure failed or the torturing test failed, and other negative error codes in case of other errors. Note, %-EIO means that the physical eraseblock is bad.
ubi_io_write - write data to a physical eraseblock. : UBI device description object : buffer with the data to write : physical eraseblock number to write to : offset within the physical eraseblock where to write : how many bytes to write
This function writes bytes of data from buffer to offset of physical eraseblock . If all the data were successfully written, zero is returned. If an error occurred, this function returns a negative error code. If %-EIO is returned, the physical eraseblock most probably went bad.
Note, in case of an error, it is possible that something was still written to the flash media, but may be some garbage.
int ubi_io_write_ec_hdr | ( | struct ubi_device * | ubi, |
int | pnum, | ||
struct ubi_ec_hdr * | ec_hdr | ||
) |
ubi_io_write_ec_hdr - write an erase counter header. : UBI device description object : physical eraseblock to write to : the erase counter header to write
This function writes erase counter header described by to physical eraseblock . It also fills most fields of before writing, so the caller do not have to fill them. Callers must only fill the ->ec field.
This function returns zero in case of success and a negative error code in case of failure. If %-EIO is returned, the physical eraseblock most probably went bad.
int ubi_io_write_vid_hdr | ( | struct ubi_device * | ubi, |
int | pnum, | ||
struct ubi_vid_hdr * | vid_hdr | ||
) |
ubi_io_write_vid_hdr - write a volume identifier header. : UBI device description object : the physical eraseblock number to write to : the volume identifier header to write
This function writes the volume identifier header described by to physical eraseblock . This function automatically fills the ->magic and the ->version fields, as well as calculates header CRC checksum and stores it at vid_hdr->hdr_crc.
This function returns zero in case of success and a negative error code in case of failure. If %-EIO is returned, the physical eraseblock probably went bad.
ubi_self_check_all_ff - check that a region of flash is empty. : UBI device description object : the physical eraseblock number to check : the starting offset within the physical eraseblock to check : the length of the region to check
This function returns zero if only 0xFF bytes are present at offset of the physical eraseblock , and a negative error code if not or if an error occurred.