/* SPDX-License-Identifier: GPL-2.0-only */ /* * This file is part of UBIFS. * * Copyright (C) 2006-2008 Nokia Corporation. * * Authors: Artem Bityutskiy (Битюцкий Артём) * Adrian Hunter
*/
/* * The UBIFS debugfs directory name pattern and maximum name length (3 for "ubi" * + 1 for "_" and 2 for UBI device numbers and 3 for volume number and 1 for * the trailing zero byte.
*/ #define UBIFS_DFS_DIR_NAME "ubi%d_%d" #define UBIFS_DFS_DIR_LEN (3 + 1 + 2 + 3 + 1)
/** * ubifs_debug_info - per-FS debugging information. * @old_zroot: old index root - used by 'dbg_check_old_index()' * @old_zroot_level: old index root level - used by 'dbg_check_old_index()' * @old_zroot_sqnum: old index root sqnum - used by 'dbg_check_old_index()' * * @pc_happened: non-zero if an emulated power cut happened * @pc_delay: 0=>don't delay, 1=>delay a time, 2=>delay a number of calls * @pc_timeout: time in jiffies when delay of failure mode expires * @pc_cnt: current number of calls to failure mode I/O functions * @pc_cnt_max: number of calls by which to delay failure mode * * @chk_lpt_sz: used by LPT tree size checker * @chk_lpt_sz2: used by LPT tree size checker * @chk_lpt_wastage: used by LPT tree size checker * @chk_lpt_lebs: used by LPT tree size checker * @new_nhead_offs: used by LPT tree size checker * @new_ihead_lnum: used by debugging to check @c->ihead_lnum * @new_ihead_offs: used by debugging to check @c->ihead_offs * * @saved_lst: saved lprops statistics (used by 'dbg_save_space_info()') * @saved_bi: saved budgeting information * @saved_free: saved amount of free space * @saved_idx_gc_cnt: saved value of @c->idx_gc_cnt * * @chk_gen: if general extra checks are enabled * @chk_index: if index xtra checks are enabled * @chk_orph: if orphans extra checks are enabled * @chk_lprops: if lprops extra checks are enabled * @chk_fs: if UBIFS contents extra checks are enabled * @tst_rcvry: if UBIFS recovery testing mode enabled * * @dfs_dir_name: name of debugfs directory containing this file-system's files * @dfs_dir: direntry object of the file-system debugfs directory * @dfs_dump_lprops: "dump lprops" debugfs knob * @dfs_dump_budg: "dump budgeting information" debugfs knob * @dfs_dump_tnc: "dump TNC" debugfs knob * @dfs_chk_gen: debugfs knob to enable UBIFS general extra checks * @dfs_chk_index: debugfs knob to enable UBIFS index extra checks * @dfs_chk_orph: debugfs knob to enable UBIFS orphans extra checks * @dfs_chk_lprops: debugfs knob to enable UBIFS LEP properties extra checks * @dfs_chk_fs: debugfs knob to enable UBIFS contents extra checks * @dfs_tst_rcvry: debugfs knob to enable UBIFS recovery testing * @dfs_ro_error: debugfs knob to switch UBIFS to R/O mode (different to * re-mounting to R/O mode because it does not flush any buffers * and UBIFS just starts returning -EROFS on all write * operations)
*/ struct ubifs_debug_info { struct ubifs_zbranch old_zroot; int old_zroot_level; unsignedlonglong old_zroot_sqnum;
int pc_happened; int pc_delay; unsignedlong pc_timeout; unsignedint pc_cnt; unsignedint pc_cnt_max;
longlong chk_lpt_sz; longlong chk_lpt_sz2; longlong chk_lpt_wastage; int chk_lpt_lebs; int new_nhead_offs; int new_ihead_lnum; int new_ihead_offs;
struct ubifs_lp_stats saved_lst; struct ubifs_budg_info saved_bi; longlong saved_free; int saved_idx_gc_cnt;
/** * ubifs_global_debug_info - global (not per-FS) UBIFS debugging information. * * @chk_gen: if general extra checks are enabled * @chk_index: if index xtra checks are enabled * @chk_orph: if orphans extra checks are enabled * @chk_lprops: if lprops extra checks are enabled * @chk_fs: if UBIFS contents extra checks are enabled * @tst_rcvry: if UBIFS recovery testing mode enabled
*/ struct ubifs_global_debug_info { unsignedint chk_gen:1; unsignedint chk_index:1; unsignedint chk_orph:1; unsignedint chk_lprops:1; unsignedint chk_fs:1; unsignedint tst_rcvry:1;
};
void ubifs_assert_failed(struct ubifs_info *c, constchar *expr, constchar *file, int line);
#define ubifs_assert(c, expr) do { \ if (unlikely(!(expr))) { \
ubifs_assert_failed((struct ubifs_info *)c, #expr, __FILE__, \
__LINE__); \
} \
} while (0)
#define ubifs_assert_cmt_locked(c) do { \ if (unlikely(down_write_trylock(&(c)->commit_sem))) { \
up_write(&(c)->commit_sem); \
ubifs_err(c, "commit lock is not locked!\n"); \
ubifs_assert(c, 0); \
} \
} while (0)
int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb,
dbg_znode_callback znode_cb, void *priv);
/* Checking functions */ void dbg_save_space_info(struct ubifs_info *c); int dbg_check_space_info(struct ubifs_info *c); int dbg_check_lprops(struct ubifs_info *c); int dbg_old_index_check_init(struct ubifs_info *c, struct ubifs_zbranch *zroot); int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot); int dbg_check_cats(struct ubifs_info *c); int dbg_check_ltab(struct ubifs_info *c); int dbg_chk_lpt_free_spc(struct ubifs_info *c); int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len); int dbg_check_synced_i_size(conststruct ubifs_info *c, struct inode *inode); int dbg_check_dir(struct ubifs_info *c, conststruct inode *dir); int dbg_check_tnc(struct ubifs_info *c, int extra); int dbg_check_idx_size(struct ubifs_info *c, longlong idx_size); int dbg_check_filesystem(struct ubifs_info *c); void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat, int add_pos); int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode, int row, int col); int dbg_check_inode_size(struct ubifs_info *c, conststruct inode *inode,
loff_t size); 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, constvoid *buf, int offs, int len); int dbg_leb_change(struct ubifs_info *c, int lnum, constvoid *buf, int len); int dbg_leb_unmap(struct ubifs_info *c, int lnum); int dbg_leb_map(struct ubifs_info *c, int lnum);
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.15Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.