Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions | Variables
debug.c File Reference
#include <linux/module.h>
#include <linux/debugfs.h>
#include <linux/math64.h>
#include <linux/uaccess.h>
#include <linux/random.h>
#include "ubifs.h"

Go to the source code of this file.

Data Structures

struct  fsck_inode
 
struct  fsck_data
 

Functions

const chardbg_snprintf_key (const struct ubifs_info *c, const union ubifs_key *key, char *buffer, int len)
 
const chardbg_ntype (int type)
 
const chardbg_cstate (int cmt_state)
 
const chardbg_jhead (int jhead)
 
void ubifs_dump_inode (struct ubifs_info *c, const struct inode *inode)
 
void ubifs_dump_node (const struct ubifs_info *c, const void *node)
 
void ubifs_dump_budget_req (const struct ubifs_budget_req *req)
 
void ubifs_dump_lstats (const struct ubifs_lp_stats *lst)
 
void ubifs_dump_budg (struct ubifs_info *c, const struct ubifs_budg_info *bi)
 
void ubifs_dump_lprop (const struct ubifs_info *c, const struct ubifs_lprops *lp)
 
void ubifs_dump_lprops (struct ubifs_info *c)
 
void ubifs_dump_lpt_info (struct ubifs_info *c)
 
void ubifs_dump_sleb (const struct ubifs_info *c, const struct ubifs_scan_leb *sleb, int offs)
 
void ubifs_dump_leb (const struct ubifs_info *c, int lnum)
 
void ubifs_dump_znode (const struct ubifs_info *c, const struct ubifs_znode *znode)
 
void ubifs_dump_heap (struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat)
 
void ubifs_dump_pnode (struct ubifs_info *c, struct ubifs_pnode *pnode, struct ubifs_nnode *parent, int iip)
 
void ubifs_dump_tnc (struct ubifs_info *c)
 
void ubifs_dump_index (struct ubifs_info *c)
 
void dbg_save_space_info (struct ubifs_info *c)
 
int dbg_check_space_info (struct ubifs_info *c)
 
int dbg_check_synced_i_size (const struct ubifs_info *c, struct inode *inode)
 
int dbg_check_dir (struct ubifs_info *c, const struct inode *dir)
 
int dbg_check_tnc (struct ubifs_info *c, int extra)
 
int dbg_walk_index (struct ubifs_info *c, dbg_leaf_callback leaf_cb, dbg_znode_callback znode_cb, void *priv)
 
int dbg_check_idx_size (struct ubifs_info *c, long long idx_size)
 
int dbg_check_filesystem (struct ubifs_info *c)
 
int dbg_check_data_nodes_order (struct ubifs_info *c, struct list_head *head)
 
int dbg_check_nondata_nodes_order (struct ubifs_info *c, struct list_head *head)
 
int dbg_leb_write (struct ubifs_info *c, int lnum, const void *buf, int offs, int len)
 
int dbg_leb_change (struct ubifs_info *c, int lnum, const void *buf, int len)
 
int dbg_leb_unmap (struct ubifs_info *c, int lnum)
 
int dbg_leb_map (struct ubifs_info *c, int lnum)
 
int dbg_debugfs_init_fs (struct ubifs_info *c)
 
void dbg_debugfs_exit_fs (struct ubifs_info *c)
 
int dbg_debugfs_init (void)
 
void dbg_debugfs_exit (void)
 
int ubifs_debugging_init (struct ubifs_info *c)
 
void ubifs_debugging_exit (struct ubifs_info *c)
 

Variables

struct ubifs_global_debug_info ubifs_dbg
 

Function Documentation

int dbg_check_data_nodes_order ( struct ubifs_info c,
struct list_head head 
)

dbg_check_data_nodes_order - check that list of data nodes is sorted. : UBIFS file-system description object : the list of nodes ('struct ubifs_scan_node' objects)

This function returns zero if the list of data nodes is sorted correctly, and %-EINVAL if not.

Definition at line 2311 of file debug.c.

int dbg_check_dir ( struct ubifs_info c,
const struct inode dir 
)

Definition at line 1103 of file debug.c.

int dbg_check_filesystem ( struct ubifs_info c)

dbg_check_filesystem - check the file-system. : UBIFS file-system description object

This function checks the file system, namely: o makes sure that all leaf nodes exist and their CRCs are correct; o makes sure inode nlink, size, xattr size/count are correct (for all inodes).

The function reads whole indexing tree and all nodes, so it is pretty heavy-weight. Returns zero if the file-system is consistent, %-EINVAL if not, and a negative error code in case of failure.

Definition at line 2276 of file debug.c.

int dbg_check_idx_size ( struct ubifs_info c,
long long  idx_size 
)

dbg_check_idx_size - check index size. : UBIFS file-system description object : size to check

This function walks the UBIFS index, calculates its size and checks that the size is equivalent to . Returns zero in case of success and a negative error code in case of failure.

Definition at line 1713 of file debug.c.

int dbg_check_nondata_nodes_order ( struct ubifs_info c,
struct list_head head 
)

dbg_check_nondata_nodes_order - check that list of data nodes is sorted. : UBIFS file-system description object : the list of nodes ('struct ubifs_scan_node' objects)

This function returns zero if the list of non-data nodes is sorted correctly, and %-EINVAL if not.

Definition at line 2378 of file debug.c.

int dbg_check_space_info ( struct ubifs_info c)

dbg_check_space_info - check flash space information. : UBIFS file-system description object

This function compares current flash space information with the information which was saved when the 'dbg_save_space_info()' function was called. Returns zero if the information has not changed, and %-EINVAL it it has changed.

Definition at line 1018 of file debug.c.

int dbg_check_synced_i_size ( const struct ubifs_info c,
struct inode inode 
)

dbg_check_synced_i_size - check synchronized inode size. : UBIFS file-system description object : inode to check

If inode is clean, synchronized inode size has to be equivalent to current inode size. This function has to be called only for locked inodes ( has to be locked). Returns %0 if synchronized inode size if correct, and %-EINVAL if not.

Definition at line 1065 of file debug.c.

int dbg_check_tnc ( struct ubifs_info c,
int  extra 
)

dbg_check_tnc - check TNC tree. : UBIFS file-system description object : do extra checks that are possible at start commit

This function traverses whole TNC tree and checks every znode. Returns zero if everything is all right and %-EINVAL if something is wrong with TNC.

Definition at line 1467 of file debug.c.

const char* dbg_cstate ( int  cmt_state)

Definition at line 186 of file debug.c.

void dbg_debugfs_exit ( void  )

dbg_debugfs_exit - remove the "ubifs" directory from debugfs file-system.

Definition at line 3085 of file debug.c.

void dbg_debugfs_exit_fs ( struct ubifs_info c)

dbg_debugfs_exit_fs - remove all debugfs files. : UBIFS file-system description object

Definition at line 2932 of file debug.c.

int dbg_debugfs_init ( void  )

dbg_debugfs_init - initialize debugfs file-system.

UBIFS uses debugfs file-system to expose various debugging knobs to user-space. This function creates "ubifs" directory in the debugfs file-system. Returns zero in case of success and a negative error code in case of failure.

Definition at line 3014 of file debug.c.

int dbg_debugfs_init_fs ( struct ubifs_info c)

dbg_debugfs_init_fs - initialize debugfs for UBIFS instance. : UBIFS file-system description object

This function creates all debugfs files for this instance of UBIFS. Returns zero in case of success and a negative error code in case of failure.

Note, the only reason we have not merged this function with the 'ubifs_debugging_init()' function is because it is better to initialize debugfs interfaces at the very end of the mount process, and remove them at the very beginning of the mount process.

Definition at line 2825 of file debug.c.

const char* dbg_jhead ( int  jhead)

Definition at line 206 of file debug.c.

int dbg_leb_change ( struct ubifs_info c,
int  lnum,
const void buf,
int  len 
)

Definition at line 2604 of file debug.c.

int dbg_leb_map ( struct ubifs_info c,
int  lnum 
)

Definition at line 2637 of file debug.c.

int dbg_leb_unmap ( struct ubifs_info c,
int  lnum 
)

Definition at line 2621 of file debug.c.

int dbg_leb_write ( struct ubifs_info c,
int  lnum,
const void buf,
int  offs,
int  len 
)

Definition at line 2583 of file debug.c.

const char* dbg_ntype ( int  type)

Definition at line 140 of file debug.c.

void dbg_save_space_info ( struct ubifs_info c)

dbg_save_space_info - save information about flash space. : UBIFS file-system description object

This function saves information about UBIFS free space, dirty space, etc, in order to check it later.

Definition at line 968 of file debug.c.

const char* dbg_snprintf_key ( const struct ubifs_info c,
const union ubifs_key key,
char buffer,
int  len 
)

Definition at line 101 of file debug.c.

int dbg_walk_index ( struct ubifs_info c,
dbg_leaf_callback  leaf_cb,
dbg_znode_callback  znode_cb,
void priv 
)

dbg_walk_index - walk the on-flash index. : UBIFS file-system description object : called for each leaf node : called for each indexing node : private data which is passed to callbacks

This function walks the UBIFS index and calls the for each leaf node and for each indexing node. Returns zero in case of success and a negative error code in case of failure.

It would be better if this function removed every znode it pulled to into the TNC, so that the behavior more closely matched the non-debugging behavior.

Definition at line 1561 of file debug.c.

void ubifs_debugging_exit ( struct ubifs_info c)

ubifs_debugging_exit - free debugging data. : UBIFS file-system description object

Definition at line 3112 of file debug.c.

int ubifs_debugging_init ( struct ubifs_info c)

ubifs_debugging_init - initialize UBIFS debugging. : UBIFS file-system description object

This function initializes debugging-related data for the file system. Returns zero in case of success and a negative error code in case of failure.

Definition at line 3099 of file debug.c.

void ubifs_dump_budg ( struct ubifs_info c,
const struct ubifs_budg_info bi 
)

Definition at line 577 of file debug.c.

void ubifs_dump_budget_req ( const struct ubifs_budget_req req)

Definition at line 548 of file debug.c.

void ubifs_dump_heap ( struct ubifs_info c,
struct ubifs_lpt_heap heap,
int  cat 
)

Definition at line 887 of file debug.c.

void ubifs_dump_index ( struct ubifs_info c)

ubifs_dump_index - dump the on-flash index. : UBIFS file-system description object

This function dumps whole UBIFS indexing B-tree, unlike 'ubifs_dump_tnc()' which dumps only in-memory znodes and does not read znodes which from flash.

Definition at line 956 of file debug.c.

void ubifs_dump_inode ( struct ubifs_info c,
const struct inode inode 
)

Definition at line 233 of file debug.c.

void ubifs_dump_leb ( const struct ubifs_info c,
int  lnum 
)

Definition at line 810 of file debug.c.

void ubifs_dump_lprop ( const struct ubifs_info c,
const struct ubifs_lprops lp 
)

Definition at line 645 of file debug.c.

void ubifs_dump_lprops ( struct ubifs_info c)

Definition at line 736 of file debug.c.

void ubifs_dump_lpt_info ( struct ubifs_info c)

Definition at line 756 of file debug.c.

void ubifs_dump_lstats ( const struct ubifs_lp_stats lst)

Definition at line 565 of file debug.c.

void ubifs_dump_node ( const struct ubifs_info c,
const void node 
)

Definition at line 301 of file debug.c.

void ubifs_dump_pnode ( struct ubifs_info c,
struct ubifs_pnode pnode,
struct ubifs_nnode parent,
int  iip 
)

Definition at line 903 of file debug.c.

void ubifs_dump_sleb ( const struct ubifs_info c,
const struct ubifs_scan_leb sleb,
int  offs 
)

Definition at line 794 of file debug.c.

void ubifs_dump_tnc ( struct ubifs_info c)

Definition at line 921 of file debug.c.

void ubifs_dump_znode ( const struct ubifs_info c,
const struct ubifs_znode znode 
)

Definition at line 848 of file debug.c.

Variable Documentation

Definition at line 2938 of file debug.c.