.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) International Business Machines Corp., 2006 |
---|
3 | | - * |
---|
4 | | - * This program is free software; you can redistribute it and/or modify |
---|
5 | | - * it under the terms of the GNU General Public License as published by |
---|
6 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
7 | | - * (at your option) any later version. |
---|
8 | | - * |
---|
9 | | - * This program is distributed in the hope that it will be useful, |
---|
10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
---|
12 | | - * the GNU General Public License for more details. |
---|
13 | | - * |
---|
14 | | - * You should have received a copy of the GNU General Public License |
---|
15 | | - * along with this program; if not, write to the Free Software |
---|
16 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
17 | 4 | * |
---|
18 | 5 | * Author: Artem Bityutskiy (Битюцкий Артём) |
---|
19 | 6 | */ |
---|
.. | .. |
---|
120 | 107 | pr_err("\tlast_eb_bytes %d\n", vol->last_eb_bytes); |
---|
121 | 108 | pr_err("\tcorrupted %d\n", vol->corrupted); |
---|
122 | 109 | pr_err("\tupd_marker %d\n", vol->upd_marker); |
---|
| 110 | + pr_err("\tskip_check %d\n", vol->skip_check); |
---|
123 | 111 | |
---|
124 | 112 | if (vol->name_len <= UBI_VOL_NAME_MAX && |
---|
125 | 113 | strnlen(vol->name, vol->name_len + 1) == vol->name_len) { |
---|
.. | .. |
---|
514 | 502 | */ |
---|
515 | 503 | int ubi_debugfs_init_dev(struct ubi_device *ubi) |
---|
516 | 504 | { |
---|
517 | | - int err, n; |
---|
518 | 505 | unsigned long ubi_num = ubi->ubi_num; |
---|
519 | | - const char *fname; |
---|
520 | | - struct dentry *dent; |
---|
521 | 506 | struct ubi_debug_info *d = &ubi->dbg; |
---|
| 507 | + int n; |
---|
522 | 508 | |
---|
523 | 509 | if (!IS_ENABLED(CONFIG_DEBUG_FS)) |
---|
524 | 510 | return 0; |
---|
.. | .. |
---|
527 | 513 | ubi->ubi_num); |
---|
528 | 514 | if (n == UBI_DFS_DIR_LEN) { |
---|
529 | 515 | /* The array size is too small */ |
---|
530 | | - fname = UBI_DFS_DIR_NAME; |
---|
531 | | - dent = ERR_PTR(-EINVAL); |
---|
532 | | - goto out; |
---|
| 516 | + return -EINVAL; |
---|
533 | 517 | } |
---|
534 | 518 | |
---|
535 | | - fname = d->dfs_dir_name; |
---|
536 | | - dent = debugfs_create_dir(fname, dfs_rootdir); |
---|
537 | | - if (IS_ERR_OR_NULL(dent)) |
---|
538 | | - goto out; |
---|
539 | | - d->dfs_dir = dent; |
---|
| 519 | + d->dfs_dir = debugfs_create_dir(d->dfs_dir_name, dfs_rootdir); |
---|
540 | 520 | |
---|
541 | | - fname = "chk_gen"; |
---|
542 | | - dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num, |
---|
543 | | - &dfs_fops); |
---|
544 | | - if (IS_ERR_OR_NULL(dent)) |
---|
545 | | - goto out_remove; |
---|
546 | | - d->dfs_chk_gen = dent; |
---|
| 521 | + d->dfs_chk_gen = debugfs_create_file("chk_gen", S_IWUSR, d->dfs_dir, |
---|
| 522 | + (void *)ubi_num, &dfs_fops); |
---|
547 | 523 | |
---|
548 | | - fname = "chk_io"; |
---|
549 | | - dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num, |
---|
550 | | - &dfs_fops); |
---|
551 | | - if (IS_ERR_OR_NULL(dent)) |
---|
552 | | - goto out_remove; |
---|
553 | | - d->dfs_chk_io = dent; |
---|
| 524 | + d->dfs_chk_io = debugfs_create_file("chk_io", S_IWUSR, d->dfs_dir, |
---|
| 525 | + (void *)ubi_num, &dfs_fops); |
---|
554 | 526 | |
---|
555 | | - fname = "chk_fastmap"; |
---|
556 | | - dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num, |
---|
557 | | - &dfs_fops); |
---|
558 | | - if (IS_ERR_OR_NULL(dent)) |
---|
559 | | - goto out_remove; |
---|
560 | | - d->dfs_chk_fastmap = dent; |
---|
| 527 | + d->dfs_chk_fastmap = debugfs_create_file("chk_fastmap", S_IWUSR, |
---|
| 528 | + d->dfs_dir, (void *)ubi_num, |
---|
| 529 | + &dfs_fops); |
---|
561 | 530 | |
---|
562 | | - fname = "tst_disable_bgt"; |
---|
563 | | - dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num, |
---|
564 | | - &dfs_fops); |
---|
565 | | - if (IS_ERR_OR_NULL(dent)) |
---|
566 | | - goto out_remove; |
---|
567 | | - d->dfs_disable_bgt = dent; |
---|
| 531 | + d->dfs_disable_bgt = debugfs_create_file("tst_disable_bgt", S_IWUSR, |
---|
| 532 | + d->dfs_dir, (void *)ubi_num, |
---|
| 533 | + &dfs_fops); |
---|
568 | 534 | |
---|
569 | | - fname = "tst_emulate_bitflips"; |
---|
570 | | - dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num, |
---|
571 | | - &dfs_fops); |
---|
572 | | - if (IS_ERR_OR_NULL(dent)) |
---|
573 | | - goto out_remove; |
---|
574 | | - d->dfs_emulate_bitflips = dent; |
---|
| 535 | + d->dfs_emulate_bitflips = debugfs_create_file("tst_emulate_bitflips", |
---|
| 536 | + S_IWUSR, d->dfs_dir, |
---|
| 537 | + (void *)ubi_num, |
---|
| 538 | + &dfs_fops); |
---|
575 | 539 | |
---|
576 | | - fname = "tst_emulate_io_failures"; |
---|
577 | | - dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num, |
---|
578 | | - &dfs_fops); |
---|
579 | | - if (IS_ERR_OR_NULL(dent)) |
---|
580 | | - goto out_remove; |
---|
581 | | - d->dfs_emulate_io_failures = dent; |
---|
| 540 | + d->dfs_emulate_io_failures = debugfs_create_file("tst_emulate_io_failures", |
---|
| 541 | + S_IWUSR, d->dfs_dir, |
---|
| 542 | + (void *)ubi_num, |
---|
| 543 | + &dfs_fops); |
---|
582 | 544 | |
---|
583 | | - fname = "tst_emulate_power_cut"; |
---|
584 | | - dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num, |
---|
585 | | - &dfs_fops); |
---|
586 | | - if (IS_ERR_OR_NULL(dent)) |
---|
587 | | - goto out_remove; |
---|
588 | | - d->dfs_emulate_power_cut = dent; |
---|
| 545 | + d->dfs_emulate_power_cut = debugfs_create_file("tst_emulate_power_cut", |
---|
| 546 | + S_IWUSR, d->dfs_dir, |
---|
| 547 | + (void *)ubi_num, |
---|
| 548 | + &dfs_fops); |
---|
589 | 549 | |
---|
590 | | - fname = "tst_emulate_power_cut_min"; |
---|
591 | | - dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num, |
---|
592 | | - &dfs_fops); |
---|
593 | | - if (IS_ERR_OR_NULL(dent)) |
---|
594 | | - goto out_remove; |
---|
595 | | - d->dfs_power_cut_min = dent; |
---|
| 550 | + d->dfs_power_cut_min = debugfs_create_file("tst_emulate_power_cut_min", |
---|
| 551 | + S_IWUSR, d->dfs_dir, |
---|
| 552 | + (void *)ubi_num, &dfs_fops); |
---|
596 | 553 | |
---|
597 | | - fname = "tst_emulate_power_cut_max"; |
---|
598 | | - dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num, |
---|
599 | | - &dfs_fops); |
---|
600 | | - if (IS_ERR_OR_NULL(dent)) |
---|
601 | | - goto out_remove; |
---|
602 | | - d->dfs_power_cut_max = dent; |
---|
| 554 | + d->dfs_power_cut_max = debugfs_create_file("tst_emulate_power_cut_max", |
---|
| 555 | + S_IWUSR, d->dfs_dir, |
---|
| 556 | + (void *)ubi_num, &dfs_fops); |
---|
603 | 557 | |
---|
604 | | - fname = "detailed_erase_block_info"; |
---|
605 | | - dent = debugfs_create_file(fname, S_IRUSR, d->dfs_dir, (void *)ubi_num, |
---|
606 | | - &eraseblk_count_fops); |
---|
607 | | - if (IS_ERR_OR_NULL(dent)) |
---|
608 | | - goto out_remove; |
---|
| 558 | + debugfs_create_file("detailed_erase_block_info", S_IRUSR, d->dfs_dir, |
---|
| 559 | + (void *)ubi_num, &eraseblk_count_fops); |
---|
609 | 560 | |
---|
610 | 561 | return 0; |
---|
611 | | - |
---|
612 | | -out_remove: |
---|
613 | | - debugfs_remove_recursive(d->dfs_dir); |
---|
614 | | -out: |
---|
615 | | - err = dent ? PTR_ERR(dent) : -ENODEV; |
---|
616 | | - ubi_err(ubi, "cannot create \"%s\" debugfs file or directory, error %d\n", |
---|
617 | | - fname, err); |
---|
618 | | - return err; |
---|
619 | 562 | } |
---|
620 | 563 | |
---|
621 | 564 | /** |
---|