#include "ubi.h"
#include <linux/debugfs.h>
#include <linux/uaccess.h>
#include <linux/module.h>
#include <linux/seq_file.h>
#include <linux/fault-inject.h>
#ifdef CONFIG_MTD_UBI_FAULT_INJECTION
static DECLARE_FAULT_ATTR(fault_eccerr_attr);
static DECLARE_FAULT_ATTR(fault_bitflips_attr);
static DECLARE_FAULT_ATTR(fault_read_failure_attr);
static DECLARE_FAULT_ATTR(fault_write_failure_attr);
static DECLARE_FAULT_ATTR(fault_erase_failure_attr);
static DECLARE_FAULT_ATTR(fault_power_cut_attr);
static DECLARE_FAULT_ATTR(fault_io_ff_attr);
static DECLARE_FAULT_ATTR(fault_io_ff_bitflips_attr);
static DECLARE_FAULT_ATTR(fault_bad_hdr_attr);
static DECLARE_FAULT_ATTR(fault_bad_hdr_ebadmsg_attr);
#define FAIL_ACTION(name, fault_attr) …
FAIL_ACTION(eccerr, fault_eccerr_attr)
FAIL_ACTION(bitflips, fault_bitflips_attr)
FAIL_ACTION(read_failure, fault_read_failure_attr)
FAIL_ACTION(write_failure, fault_write_failure_attr)
FAIL_ACTION(erase_failure, fault_erase_failure_attr)
FAIL_ACTION(power_cut, fault_power_cut_attr)
FAIL_ACTION(io_ff, fault_io_ff_attr)
FAIL_ACTION(io_ff_bitflips, fault_io_ff_bitflips_attr)
FAIL_ACTION(bad_hdr, fault_bad_hdr_attr)
FAIL_ACTION(bad_hdr_ebadmsg, fault_bad_hdr_ebadmsg_attr)
#endif
void ubi_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len)
{ … }
void ubi_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr)
{ … }
void ubi_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr)
{ … }
void ubi_dump_vol_info(const struct ubi_volume *vol)
{ … }
void ubi_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx)
{ … }
void ubi_dump_av(const struct ubi_ainf_volume *av)
{ … }
void ubi_dump_aeb(const struct ubi_ainf_peb *aeb, int type)
{ … }
void ubi_dump_mkvol_req(const struct ubi_mkvol_req *req)
{ … }
static struct dentry *dfs_rootdir;
#ifdef CONFIG_MTD_UBI_FAULT_INJECTION
static void dfs_create_fault_entry(struct dentry *parent)
{ … }
#endif
int ubi_debugfs_init(void)
{ … }
void ubi_debugfs_exit(void)
{ … }
static ssize_t dfs_file_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t dfs_file_write(struct file *file, const char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static const struct file_operations dfs_fops = …;
static void *eraseblk_count_seq_start(struct seq_file *s, loff_t *pos)
{ … }
static void *eraseblk_count_seq_next(struct seq_file *s, void *v, loff_t *pos)
{ … }
static void eraseblk_count_seq_stop(struct seq_file *s, void *v)
{ … }
static int eraseblk_count_seq_show(struct seq_file *s, void *iter)
{ … }
static const struct seq_operations eraseblk_count_seq_ops = …;
static int eraseblk_count_open(struct inode *inode, struct file *f)
{ … }
static int eraseblk_count_release(struct inode *inode, struct file *f)
{ … }
static const struct file_operations eraseblk_count_fops = …;
int ubi_debugfs_init_dev(struct ubi_device *ubi)
{ … }
void ubi_debugfs_exit_dev(struct ubi_device *ubi)
{ … }
int ubi_dbg_power_cut(struct ubi_device *ubi, int caller)
{ … }