Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
eba.c File Reference
#include <linux/slab.h>
#include <linux/crc32.h>
#include <linux/err.h>
#include "ubi.h"

Go to the source code of this file.

Macros

#define EBA_RESERVED_PEBS   1
 

Functions

unsigned long long ubi_next_sqnum (struct ubi_device *ubi)
 
int ubi_eba_unmap_leb (struct ubi_device *ubi, struct ubi_volume *vol, int lnum)
 
int ubi_eba_read_leb (struct ubi_device *ubi, struct ubi_volume *vol, int lnum, void *buf, int offset, int len, int check)
 
int ubi_eba_write_leb (struct ubi_device *ubi, struct ubi_volume *vol, int lnum, const void *buf, int offset, int len)
 
int ubi_eba_write_leb_st (struct ubi_device *ubi, struct ubi_volume *vol, int lnum, const void *buf, int len, int used_ebs)
 
int ubi_eba_atomic_leb_change (struct ubi_device *ubi, struct ubi_volume *vol, int lnum, const void *buf, int len)
 
int ubi_eba_copy_leb (struct ubi_device *ubi, int from, int to, struct ubi_vid_hdr *vid_hdr)
 
int self_check_eba (struct ubi_device *ubi, struct ubi_attach_info *ai_fastmap, struct ubi_attach_info *ai_scan)
 
int ubi_eba_init (struct ubi_device *ubi, struct ubi_attach_info *ai)
 

Macro Definition Documentation

#define EBA_RESERVED_PEBS   1

Definition at line 50 of file eba.c.

Function Documentation

int self_check_eba ( struct ubi_device ubi,
struct ubi_attach_info ai_fastmap,
struct ubi_attach_info ai_scan 
)

self_check_eba - run a self check on the EBA table constructed by fastmap. : UBI device description object : UBI attach info object created by fastmap : UBI attach info object created by scanning

Returns < 0 in case of an internal error, 0 otherwise. If a bad EBA table entry was found it will be printed out and ubi_assert() triggers.

Definition at line 1226 of file eba.c.

int ubi_eba_atomic_leb_change ( struct ubi_device ubi,
struct ubi_volume vol,
int  lnum,
const void buf,
int  len 
)

Definition at line 843 of file eba.c.

int ubi_eba_copy_leb ( struct ubi_device ubi,
int  from,
int  to,
struct ubi_vid_hdr vid_hdr 
)

ubi_eba_copy_leb - copy logical eraseblock. : UBI device description object : physical eraseblock number from where to copy : physical eraseblock number where to copy : VID header of the physical eraseblock

This function copies logical eraseblock from physical eraseblock to physical eraseblock . The buffer may be changed by this function. Returns: o %0 in case of success; o MOVE_CANCEL_RACE, MOVE_TARGET_WR_ERR, MOVE_TARGET_BITFLIPS, etc; o a negative error code in case of failure.

Definition at line 989 of file eba.c.

int ubi_eba_init ( struct ubi_device ubi,
struct ubi_attach_info ai 
)

ubi_eba_init - initialize the EBA sub-system using attaching information. : UBI device description object : attaching information

This function returns zero in case of success and a negative error code in case of failure.

Definition at line 1320 of file eba.c.

int ubi_eba_read_leb ( struct ubi_device ubi,
struct ubi_volume vol,
int  lnum,
void buf,
int  offset,
int  len,
int  check 
)

ubi_eba_read_leb - read data. : UBI device description object : volume description object : logical eraseblock number : buffer to store the read data : offset from where to read : how many bytes to read : data CRC check flag

If the logical eraseblock is unmapped, is filled with 0xFF bytes. The flag only makes sense for static volumes and forces eraseblock data CRC checking.

In case of success this function returns zero. In case of a static volume, if data CRC mismatches - %-EBADMSG is returned. %-EBADMSG may also be returned for any volume type if an ECC error was detected by the MTD device driver. Other negative error cored may be returned in case of other errors.

Definition at line 372 of file eba.c.

int ubi_eba_unmap_leb ( struct ubi_device ubi,
struct ubi_volume vol,
int  lnum 
)

ubi_eba_unmap_leb - un-map logical eraseblock. : UBI device description object : volume description object : logical eraseblock number

This function un-maps logical eraseblock and schedules corresponding physical eraseblock for erasure. Returns zero in case of success and a negative error code in case of failure.

Definition at line 324 of file eba.c.

int ubi_eba_write_leb ( struct ubi_device ubi,
struct ubi_volume vol,
int  lnum,
const void buf,
int  offset,
int  len 
)

ubi_eba_write_leb - write data to dynamic volume. : UBI device description object : volume description object : logical eraseblock number : the data to write : offset within the logical eraseblock where to write : how many bytes to write

This function writes data to logical eraseblock of a dynamic volume . Returns zero in case of success and a negative error code in case of failure. In case of error, it is possible that something was still written to the flash media, but may be some garbage.

Definition at line 597 of file eba.c.

int ubi_eba_write_leb_st ( struct ubi_device ubi,
struct ubi_volume vol,
int  lnum,
const void buf,
int  len,
int  used_ebs 
)

ubi_eba_write_leb_st - write data to static volume. : UBI device description object : volume description object : logical eraseblock number : data to write : how many bytes to write : how many logical eraseblocks will this volume contain

This function writes data to logical eraseblock of static volume . The argument should contain total number of logical eraseblock in this static volume.

When writing to the last logical eraseblock, the argument doesn't have to be aligned to the minimal I/O unit size. Instead, it has to be equivalent to the real data size, although the buffer has to contain the alignment. In all other cases, has to be aligned.

It is prohibited to write more than once to logical eraseblocks of static volumes. This function returns zero in case of success and a negative error code in case of failure.

Definition at line 728 of file eba.c.

unsigned long long ubi_next_sqnum ( struct ubi_device ubi)

next_sqnum - get next sequence number. : UBI device description object

This function returns next sequence number to use, which is just the current global sequence counter value. It also increases the global sequence counter.

Definition at line 60 of file eba.c.