blob: 57c772f22a725ce6a80e01b35454f09d82eacf7c [file] [log] [blame]
#ifndef DM_VERITY_DEBUG_H
#define DM_VERITY_DEBUG_H
#include "dm-verity.h"
/*
* If not use debug mode
* Please Command the Define(SEC_HEX_DEBUG) below
*/
#define SEC_HEX_DEBUG
#ifdef SEC_HEX_DEBUG
#define MAX_FC_BLKS_LIST 128
#define MAX_DEV_NAME 16
#define MAX_DEV_LIST 10
#define FOR_SAFE 20
struct blks_info{
/* blks cnt info */
atomic64_t total_blks;
atomic64_t skipped_blks;
atomic64_t fec_correct_blks;
atomic64_t corrupted_blks;
atomic64_t prev_total_blks;
/* fec corrected blocks list */
sector_t fc_blks_list[MAX_FC_BLKS_LIST + FOR_SAFE];
char dev_name[MAX_FC_BLKS_LIST + FOR_SAFE][MAX_DEV_NAME];
char fec_off_list[MAX_DEV_LIST][MAX_DEV_NAME];
char dmv_ctr_list[MAX_DEV_LIST][MAX_DEV_NAME];
/* The "list_idx" value is the location of the new correct_blk to be entered for fc_blks_list []. */
int list_idx;
atomic_t fec_off_cnt;
atomic_t dmv_ctr_cnt;
};
extern struct blks_info *b_info;
extern int ignore_fs_panic;
extern int verity_handle_err_hex_debug(struct dm_verity *v, enum verity_block_type type,
unsigned long long block, struct dm_verity_io *io, struct bvec_iter *iter);
extern void free_b_info(void);
extern void print_blks_cnt(char* dev_name);
extern int empty_b_info(void);
/* get */
extern long long get_total_blks(void);
extern long long get_skipped_blks(void);
extern long long get_fec_correct_blks(void);
extern long long get_corrupted_blks(void);
extern long long get_prev_total_blks(void);
extern int get_fec_off_cnt(void);
extern int get_dmv_ctr_cnt(void);
extern struct blks_info * get_b_info(char* dev_name);
/* set */
extern void set_prev_total_blks(long long val);
/* add */
extern void add_total_blks(long long val);
extern void add_skipped_blks(void);
extern void add_fec_correct_blks(void);
extern void add_corrupted_blks(void);
extern void add_fc_blks_entry(sector_t cur_blk, char* dev_name);
extern void add_fec_off_cnt(char* dev_name);
#endif
#endif