diff options
author | shengyong <shengyong1@huawei.com> | 2015-05-26 06:07:07 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2015-06-02 05:44:20 -0400 |
commit | f6e951af34c515ffc69f4a557cf62533420c8ce4 (patch) | |
tree | e5804002f38976aff60ad1813cec1257ae30eb79 | |
parent | a18fd672675f50c1a05f8c6c03b9a34ef4f07cae (diff) |
UBI: Fastmap: Rename variables to make them meaningful
s/fmpl1/fmpl
s/fmpl2/fmpl_wl
Add "WL" to the error message when wrong WL pool magic number is detected.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r-- | drivers/mtd/ubi/fastmap.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index 696a4f96e06b..e3d829409fa6 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c | |||
@@ -601,7 +601,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi, | |||
601 | struct ubi_ainf_peb *aeb, *tmp_aeb, *_tmp_aeb; | 601 | struct ubi_ainf_peb *aeb, *tmp_aeb, *_tmp_aeb; |
602 | struct ubi_fm_sb *fmsb; | 602 | struct ubi_fm_sb *fmsb; |
603 | struct ubi_fm_hdr *fmhdr; | 603 | struct ubi_fm_hdr *fmhdr; |
604 | struct ubi_fm_scan_pool *fmpl1, *fmpl2; | 604 | struct ubi_fm_scan_pool *fmpl, *fmpl_wl; |
605 | struct ubi_fm_ec *fmec; | 605 | struct ubi_fm_ec *fmec; |
606 | struct ubi_fm_volhdr *fmvhdr; | 606 | struct ubi_fm_volhdr *fmvhdr; |
607 | struct ubi_fm_eba *fm_eba; | 607 | struct ubi_fm_eba *fm_eba; |
@@ -631,30 +631,30 @@ static int ubi_attach_fastmap(struct ubi_device *ubi, | |||
631 | goto fail_bad; | 631 | goto fail_bad; |
632 | } | 632 | } |
633 | 633 | ||
634 | fmpl1 = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos); | 634 | fmpl = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos); |
635 | fm_pos += sizeof(*fmpl1); | 635 | fm_pos += sizeof(*fmpl); |
636 | if (fm_pos >= fm_size) | 636 | if (fm_pos >= fm_size) |
637 | goto fail_bad; | 637 | goto fail_bad; |
638 | if (be32_to_cpu(fmpl1->magic) != UBI_FM_POOL_MAGIC) { | 638 | if (be32_to_cpu(fmpl->magic) != UBI_FM_POOL_MAGIC) { |
639 | ubi_err(ubi, "bad fastmap pool magic: 0x%x, expected: 0x%x", | 639 | ubi_err(ubi, "bad fastmap pool magic: 0x%x, expected: 0x%x", |
640 | be32_to_cpu(fmpl1->magic), UBI_FM_POOL_MAGIC); | 640 | be32_to_cpu(fmpl->magic), UBI_FM_POOL_MAGIC); |
641 | goto fail_bad; | 641 | goto fail_bad; |
642 | } | 642 | } |
643 | 643 | ||
644 | fmpl2 = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos); | 644 | fmpl_wl = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos); |
645 | fm_pos += sizeof(*fmpl2); | 645 | fm_pos += sizeof(*fmpl_wl); |
646 | if (fm_pos >= fm_size) | 646 | if (fm_pos >= fm_size) |
647 | goto fail_bad; | 647 | goto fail_bad; |
648 | if (be32_to_cpu(fmpl2->magic) != UBI_FM_POOL_MAGIC) { | 648 | if (be32_to_cpu(fmpl_wl->magic) != UBI_FM_POOL_MAGIC) { |
649 | ubi_err(ubi, "bad fastmap pool magic: 0x%x, expected: 0x%x", | 649 | ubi_err(ubi, "bad fastmap WL pool magic: 0x%x, expected: 0x%x", |
650 | be32_to_cpu(fmpl2->magic), UBI_FM_POOL_MAGIC); | 650 | be32_to_cpu(fmpl_wl->magic), UBI_FM_POOL_MAGIC); |
651 | goto fail_bad; | 651 | goto fail_bad; |
652 | } | 652 | } |
653 | 653 | ||
654 | pool_size = be16_to_cpu(fmpl1->size); | 654 | pool_size = be16_to_cpu(fmpl->size); |
655 | wl_pool_size = be16_to_cpu(fmpl2->size); | 655 | wl_pool_size = be16_to_cpu(fmpl_wl->size); |
656 | fm->max_pool_size = be16_to_cpu(fmpl1->max_size); | 656 | fm->max_pool_size = be16_to_cpu(fmpl->max_size); |
657 | fm->max_wl_pool_size = be16_to_cpu(fmpl2->max_size); | 657 | fm->max_wl_pool_size = be16_to_cpu(fmpl_wl->max_size); |
658 | 658 | ||
659 | if (pool_size > UBI_FM_MAX_POOL_SIZE || pool_size < 0) { | 659 | if (pool_size > UBI_FM_MAX_POOL_SIZE || pool_size < 0) { |
660 | ubi_err(ubi, "bad pool size: %i", pool_size); | 660 | ubi_err(ubi, "bad pool size: %i", pool_size); |
@@ -796,11 +796,11 @@ static int ubi_attach_fastmap(struct ubi_device *ubi, | |||
796 | } | 796 | } |
797 | } | 797 | } |
798 | 798 | ||
799 | ret = scan_pool(ubi, ai, fmpl1->pebs, pool_size, &max_sqnum, &free); | 799 | ret = scan_pool(ubi, ai, fmpl->pebs, pool_size, &max_sqnum, &free); |
800 | if (ret) | 800 | if (ret) |
801 | goto fail; | 801 | goto fail; |
802 | 802 | ||
803 | ret = scan_pool(ubi, ai, fmpl2->pebs, wl_pool_size, &max_sqnum, &free); | 803 | ret = scan_pool(ubi, ai, fmpl_wl->pebs, wl_pool_size, &max_sqnum, &free); |
804 | if (ret) | 804 | if (ret) |
805 | goto fail; | 805 | goto fail; |
806 | 806 | ||
@@ -1083,7 +1083,7 @@ static int ubi_write_fastmap(struct ubi_device *ubi, | |||
1083 | void *fm_raw; | 1083 | void *fm_raw; |
1084 | struct ubi_fm_sb *fmsb; | 1084 | struct ubi_fm_sb *fmsb; |
1085 | struct ubi_fm_hdr *fmh; | 1085 | struct ubi_fm_hdr *fmh; |
1086 | struct ubi_fm_scan_pool *fmpl1, *fmpl2; | 1086 | struct ubi_fm_scan_pool *fmpl, *fmpl_wl; |
1087 | struct ubi_fm_ec *fec; | 1087 | struct ubi_fm_ec *fec; |
1088 | struct ubi_fm_volhdr *fvh; | 1088 | struct ubi_fm_volhdr *fvh; |
1089 | struct ubi_fm_eba *feba; | 1089 | struct ubi_fm_eba *feba; |
@@ -1141,25 +1141,25 @@ static int ubi_write_fastmap(struct ubi_device *ubi, | |||
1141 | erase_peb_count = 0; | 1141 | erase_peb_count = 0; |
1142 | vol_count = 0; | 1142 | vol_count = 0; |
1143 | 1143 | ||
1144 | fmpl1 = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos); | 1144 | fmpl = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos); |
1145 | fm_pos += sizeof(*fmpl1); | 1145 | fm_pos += sizeof(*fmpl); |
1146 | fmpl1->magic = cpu_to_be32(UBI_FM_POOL_MAGIC); | 1146 | fmpl->magic = cpu_to_be32(UBI_FM_POOL_MAGIC); |
1147 | fmpl1->size = cpu_to_be16(ubi->fm_pool.size); | 1147 | fmpl->size = cpu_to_be16(ubi->fm_pool.size); |
1148 | fmpl1->max_size = cpu_to_be16(ubi->fm_pool.max_size); | 1148 | fmpl->max_size = cpu_to_be16(ubi->fm_pool.max_size); |
1149 | 1149 | ||
1150 | for (i = 0; i < ubi->fm_pool.size; i++) { | 1150 | for (i = 0; i < ubi->fm_pool.size; i++) { |
1151 | fmpl1->pebs[i] = cpu_to_be32(ubi->fm_pool.pebs[i]); | 1151 | fmpl->pebs[i] = cpu_to_be32(ubi->fm_pool.pebs[i]); |
1152 | set_seen(ubi, ubi->fm_pool.pebs[i], seen_pebs); | 1152 | set_seen(ubi, ubi->fm_pool.pebs[i], seen_pebs); |
1153 | } | 1153 | } |
1154 | 1154 | ||
1155 | fmpl2 = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos); | 1155 | fmpl_wl = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos); |
1156 | fm_pos += sizeof(*fmpl2); | 1156 | fm_pos += sizeof(*fmpl_wl); |
1157 | fmpl2->magic = cpu_to_be32(UBI_FM_POOL_MAGIC); | 1157 | fmpl_wl->magic = cpu_to_be32(UBI_FM_POOL_MAGIC); |
1158 | fmpl2->size = cpu_to_be16(ubi->fm_wl_pool.size); | 1158 | fmpl_wl->size = cpu_to_be16(ubi->fm_wl_pool.size); |
1159 | fmpl2->max_size = cpu_to_be16(ubi->fm_wl_pool.max_size); | 1159 | fmpl_wl->max_size = cpu_to_be16(ubi->fm_wl_pool.max_size); |
1160 | 1160 | ||
1161 | for (i = 0; i < ubi->fm_wl_pool.size; i++) { | 1161 | for (i = 0; i < ubi->fm_wl_pool.size; i++) { |
1162 | fmpl2->pebs[i] = cpu_to_be32(ubi->fm_wl_pool.pebs[i]); | 1162 | fmpl_wl->pebs[i] = cpu_to_be32(ubi->fm_wl_pool.pebs[i]); |
1163 | set_seen(ubi, ubi->fm_wl_pool.pebs[i], seen_pebs); | 1163 | set_seen(ubi, ubi->fm_wl_pool.pebs[i], seen_pebs); |
1164 | } | 1164 | } |
1165 | 1165 | ||