#include <linux/err.h>
#include <linux/slab.h>
#include <linux/crc32.h>
#include <linux/math64.h>
#include <linux/random.h>
#include "ubi.h"
Go to the source code of this file.
|
int | ubi_compare_lebs (struct ubi_device *ubi, const struct ubi_ainf_peb *aeb, int pnum, const struct ubi_vid_hdr *vid_hdr) |
|
int | ubi_add_to_av (struct ubi_device *ubi, struct ubi_attach_info *ai, int pnum, int ec, const struct ubi_vid_hdr *vid_hdr, int bitflips) |
|
struct ubi_ainf_volume * | ubi_find_av (const struct ubi_attach_info *ai, int vol_id) |
|
void | ubi_remove_av (struct ubi_attach_info *ai, struct ubi_ainf_volume *av) |
|
struct ubi_ainf_peb * | ubi_early_get_peb (struct ubi_device *ubi, struct ubi_attach_info *ai) |
|
int | ubi_attach (struct ubi_device *ubi, int force_scan) |
|
ubi_add_to_av - add used physical eraseblock to the attaching information. : UBI device description object : attaching information : the physical eraseblock number : erase counter : the volume identifier header : if bit-flips were detected when this physical eraseblock was read
This function adds information about a used physical eraseblock to the 'used' tree of the corresponding volume. The function is rather complex because it has to handle cases when this is not the first physical eraseblock belonging to the same logical eraseblock, and the newer one has to be picked, while the older one has to be dropped. This function returns zero in case of success and a negative error code in case of failure.
Definition at line 452 of file attach.c.
ubi_attach - attach an MTD device. : UBI device descriptor : if set to non-zero attach by scanning
This function returns zero in case of success and a negative error code in case of failure.
Definition at line 1399 of file attach.c.
ubi_compare_lebs - find out which logical eraseblock is newer. : UBI device description object : first logical eraseblock to compare : physical eraseblock number of the second logical eraseblock to compare : volume identifier header of the second logical eraseblock
This function compares 2 copies of a LEB and informs which one is newer. In case of success this function returns a positive value, in case of failure, a negative error code is returned. The success return codes use the following bits: o bit 0 is cleared: the first PEB (described by ) is newer than the second PEB (described by and ); o bit 0 is set: the second PEB is newer; o bit 1 is cleared: no bit-flips were detected in the newer LEB; o bit 1 is set: bit-flips were detected in the newer LEB; o bit 2 is cleared: the older LEB is not corrupted; o bit 2 is set: the older LEB is corrupted.
Definition at line 322 of file attach.c.
ubi_early_get_peb - get a free physical eraseblock. : UBI device description object : attaching information
This function returns a free physical eraseblock. It is supposed to be called on the UBI initialization stages when the wear-leveling sub-system is not initialized yet. This function picks a physical eraseblocks from one of the lists, writes the EC header if it is needed, and removes it from the list.
This function returns a pointer to the "aeb" of the found free PEB in case of success and an error code in case of failure.
Definition at line 711 of file attach.c.
ubi_find_av - find volume in the attaching information. : attaching information : the requested volume ID
This function returns a pointer to the volume description or NULL if there are no data about this volume in the attaching information.
Definition at line 608 of file attach.c.
ubi_remove_av - delete attaching information about a volume. : attaching information : the volume attaching information to delete
Definition at line 634 of file attach.c.