Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
misc.c File Reference
#include "ubi.h"

Go to the source code of this file.

Functions

int ubi_calc_data_len (const struct ubi_device *ubi, const void *buf, int length)
 
int ubi_check_volume (struct ubi_device *ubi, int vol_id)
 
void ubi_update_reserved (struct ubi_device *ubi)
 
void ubi_calculate_reserved (struct ubi_device *ubi)
 
int ubi_check_pattern (const void *buf, uint8_t patt, int size)
 

Function Documentation

int ubi_calc_data_len ( const struct ubi_device ubi,
const void buf,
int  length 
)

calc_data_len - calculate how much real data is stored in a buffer. : UBI device description object : a buffer with the contents of the physical eraseblock : the buffer length

This function calculates how much "real data" is stored in and returnes the length. Continuous 0xFF bytes at the end of the buffer are not considered as "real data".

Definition at line 35 of file misc.c.

void ubi_calculate_reserved ( struct ubi_device ubi)

ubi_calculate_reserved - calculate how many PEBs must be reserved for bad eraseblock handling. : UBI device description object

Definition at line 122 of file misc.c.

int ubi_check_pattern ( const void buf,
uint8_t  patt,
int  size 
)

ubi_check_pattern - check if buffer contains only a certain byte pattern. : buffer to check : the pattern to check : buffer size in bytes

This function returns %1 in there are only bytes in , and %0 if something else was also found.

Definition at line 145 of file misc.c.

int ubi_check_volume ( struct ubi_device ubi,
int  vol_id 
)

ubi_check_volume - check the contents of a static volume. : UBI device description object : ID of the volume to check

This function checks if static volume is corrupted by fully reading it and checking data CRC. This function returns %0 if the volume is not corrupted, %1 if it is corrupted and a negative error code in case of failure. Dynamic volumes are not checked and zero is returned immediately.

Definition at line 61 of file misc.c.

void ubi_update_reserved ( struct ubi_device ubi)

ubi_update_reserved - update bad eraseblock handling accounting data. : UBI device description object

This function calculates the gap between current number of PEBs reserved for bad eraseblock handling and the required level of PEBs that must be reserved, and if necessary, reserves more PEBs to fill that gap, according to availability. Should be called with ubi->volumes_lock held.

Definition at line 103 of file misc.c.