24 #include <linux/module.h>
46 ubi_err(
"error %d while reading %d bytes from PEB %d:%d, read %zd bytes",
47 err, len, pnum, offset, read);
51 ubi_msg(
"dumping %d bytes of data from PEB %d, offset %d",
65 pr_err(
"Erase counter header dump:\n");
73 pr_err(
"erase counter header hexdump:\n");
84 pr_err(
"Volume identifier header dump:\n");
98 pr_err(
"Volume identifier header hexdump:\n");
109 pr_err(
"Volume information dump:\n");
127 pr_err(
"\t1st 5 characters of name: %c%c%c%c%c\n",
142 pr_err(
"Volume table record %d dump:\n", idx);
148 pr_err(
"\tname_len %d\n", name_len);
150 if (r->
name[0] ==
'\0') {
159 pr_err(
"\t1st 5 characters of name: %c%c%c%c%c\n",
172 pr_err(
"Volume attaching information dump:\n");
190 pr_err(
"eraseblock attaching information dump:\n");
208 pr_err(
"Volume creation request dump:\n");
217 pr_err(
"\t1st 16 characters of name: %s\n", nm);
250 static struct dentry *dfs_rootdir;
264 if (IS_ERR_OR_NULL(dfs_rootdir)) {
265 int err = dfs_rootdir ? -
ENODEV : PTR_ERR(dfs_rootdir);
267 ubi_err(
"cannot create \"ubi\" debugfs directory, error %d\n",
286 size_t count, loff_t *ppos)
300 if (dent ==
d->dfs_chk_gen)
302 else if (dent ==
d->dfs_chk_io)
304 else if (dent ==
d->dfs_disable_bgt)
305 val =
d->disable_bgt;
306 else if (dent ==
d->dfs_emulate_bitflips)
307 val =
d->emulate_bitflips;
308 else if (dent ==
d->dfs_emulate_io_failures)
309 val =
d->emulate_io_failures;
330 static ssize_t dfs_file_write(
struct file *file,
const char __user *user_buf,
331 size_t count, loff_t *ppos)
354 else if (
buf[0] ==
'0')
361 if (dent ==
d->dfs_chk_gen)
363 else if (dent ==
d->dfs_chk_io)
365 else if (dent ==
d->dfs_disable_bgt)
366 d->disable_bgt =
val;
367 else if (dent ==
d->dfs_emulate_bitflips)
368 d->emulate_bitflips =
val;
369 else if (dent ==
d->dfs_emulate_io_failures)
370 d->emulate_io_failures =
val;
381 .read = dfs_file_read,
382 .write = dfs_file_write,
398 unsigned long ubi_num = ubi->
ubi_num;
417 if (IS_ERR_OR_NULL(dent))
424 if (IS_ERR_OR_NULL(dent))
431 if (IS_ERR_OR_NULL(dent))
435 fname =
"tst_disable_bgt";
438 if (IS_ERR_OR_NULL(dent))
442 fname =
"tst_emulate_bitflips";
445 if (IS_ERR_OR_NULL(dent))
449 fname =
"tst_emulate_io_failures";
452 if (IS_ERR_OR_NULL(dent))
461 err = dent ? PTR_ERR(dent) : -
ENODEV;
462 ubi_err(
"cannot create \"%s\" debugfs file or directory, error %d\n",