Lines Matching full:ubi

8 #include "ubi.h"
47 * @ubi: UBI device description object in FAIL_ACTION()
52 void ubi_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len) in FAIL_ACTION()
57 loff_t addr = (loff_t)pnum * ubi->peb_size + offset; in FAIL_ACTION()
62 err = mtd_read(ubi->mtd, addr, len, &read, buf); in FAIL_ACTION()
64 ubi_err(ubi, "err %d while reading %d bytes from PEB %d:%d, read %zd bytes", in FAIL_ACTION()
69 ubi_msg(ubi, "dumping %d bytes of data from PEB %d, offset %d", in FAIL_ACTION()
123 * @vol: UBI volume description object
240 * Root directory for UBI stuff in debugfs. Contains sub-directories which
241 * contain the stuff specific to particular UBI devices.
254 pr_warn("UBI error: cannot create \"fault_inject\" debugfs directory, error %d\n", in dfs_create_fault_entry()
292 * ubi_debugfs_init - create UBI debugfs directory.
294 * Create UBI debugfs directory. Returns zero in case of success and a negative
302 dfs_rootdir = debugfs_create_dir("ubi", NULL); in ubi_debugfs_init()
306 pr_err("UBI error: cannot create \"ubi\" debugfs directory, error %d\n", in ubi_debugfs_init()
319 * ubi_debugfs_exit - remove UBI debugfs directory.
327 /* Read an UBI debugfs file */
333 struct ubi_device *ubi; in dfs_file_read() local
338 ubi = ubi_get_device(ubi_num); in dfs_file_read()
339 if (!ubi) in dfs_file_read()
341 d = &ubi->dbg; in dfs_file_read()
390 ubi_put_device(ubi); in dfs_file_read()
394 /* Write an UBI debugfs file */
400 struct ubi_device *ubi; in dfs_file_write() local
406 ubi = ubi_get_device(ubi_num); in dfs_file_write()
407 if (!ubi) in dfs_file_write()
409 d = &ubi->dbg; in dfs_file_write()
462 ubi_put_device(ubi); in dfs_file_write()
466 /* File operations for all UBI debugfs files except
481 struct ubi_device *ubi = s->private; in eraseblk_count_seq_start() local
483 if (*pos < ubi->peb_count) in eraseblk_count_seq_start()
494 struct ubi_device *ubi = s->private; in eraseblk_count_seq_next() local
498 if (*pos < ubi->peb_count) in eraseblk_count_seq_next()
510 struct ubi_device *ubi = s->private; in eraseblk_count_seq_show() local
520 err = ubi_io_is_bad(ubi, *block_number); in eraseblk_count_seq_show()
524 spin_lock(&ubi->wl_lock); in eraseblk_count_seq_show()
526 wl = ubi->lookuptbl[*block_number]; in eraseblk_count_seq_show()
530 spin_unlock(&ubi->wl_lock); in eraseblk_count_seq_show()
568 struct ubi_device *ubi = s->private; in eraseblk_count_release() local
570 ubi_put_device(ubi); in eraseblk_count_release()
584 * ubi_debugfs_init_dev - initialize debugfs for an UBI device.
585 * @ubi: UBI device description object
587 * This function creates all debugfs files for UBI device @ubi. Returns zero in
590 int ubi_debugfs_init_dev(struct ubi_device *ubi) in ubi_debugfs_init_dev() argument
592 unsigned long ubi_num = ubi->ubi_num; in ubi_debugfs_init_dev()
593 struct ubi_debug_info *d = &ubi->dbg; in ubi_debugfs_init_dev()
601 ubi->ubi_num); in ubi_debugfs_init_dev()
659 * ubi_debugfs_exit_dev - free all debugfs files corresponding to device @ubi
660 * @ubi: UBI device description object
662 void ubi_debugfs_exit_dev(struct ubi_device *ubi) in ubi_debugfs_exit_dev() argument
665 debugfs_remove_recursive(ubi->dbg.dfs_dir); in ubi_debugfs_exit_dev()
670 * @ubi: UBI device description object
675 int ubi_dbg_power_cut(struct ubi_device *ubi, int caller) in ubi_dbg_power_cut() argument
679 if ((ubi->dbg.emulate_power_cut & caller) == 0) in ubi_dbg_power_cut()
682 if (ubi->dbg.power_cut_counter == 0) { in ubi_dbg_power_cut()
683 ubi->dbg.power_cut_counter = ubi->dbg.power_cut_min; in ubi_dbg_power_cut()
685 if (ubi->dbg.power_cut_max > ubi->dbg.power_cut_min) { in ubi_dbg_power_cut()
686 range = ubi->dbg.power_cut_max - ubi->dbg.power_cut_min; in ubi_dbg_power_cut()
687 ubi->dbg.power_cut_counter += get_random_u32_below(range); in ubi_dbg_power_cut()
692 ubi->dbg.power_cut_counter--; in ubi_dbg_power_cut()
693 if (ubi->dbg.power_cut_counter) in ubi_dbg_power_cut()