Commit 9c47fb2f authored by Artem Bityutskiy's avatar Artem Bityutskiy

UBI: rename UBI_SCAN_UNKNOWN_EC

Rename the constant to UBI_UNKNOWN, for the same reason that we are going
to add nother attaching method and re-use the same data structures, so the
"SCAN" in the name becomes incorrect. I've also removed the "_EC" part because
Joel is going to use this constant for other fields in the attaching info data
structures.
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
parent 47e1ec70
...@@ -644,7 +644,7 @@ void ubi_remove_av(struct ubi_attach_info *ai, struct ubi_ainf_volume *av) ...@@ -644,7 +644,7 @@ void ubi_remove_av(struct ubi_attach_info *ai, struct ubi_ainf_volume *av)
* @ubi: UBI device description object * @ubi: UBI device description object
* @ai: attaching information * @ai: attaching information
* @pnum: physical eraseblock number to erase; * @pnum: physical eraseblock number to erase;
* @ec: erase counter value to write (%UBI_SCAN_UNKNOWN_EC if it is unknown) * @ec: erase counter value to write (%UBI_UNKNOWN if it is unknown)
* *
* This function erases physical eraseblock 'pnum', and writes the erase * This function erases physical eraseblock 'pnum', and writes the erase
* counter header to it. This function should only be used on UBI device * counter header to it. This function should only be used on UBI device
...@@ -718,7 +718,7 @@ struct ubi_ainf_peb *ubi_early_get_peb(struct ubi_device *ubi, ...@@ -718,7 +718,7 @@ struct ubi_ainf_peb *ubi_early_get_peb(struct ubi_device *ubi,
* they'll be handled later. * they'll be handled later.
*/ */
list_for_each_entry_safe(aeb, tmp_aeb, &ai->erase, u.list) { list_for_each_entry_safe(aeb, tmp_aeb, &ai->erase, u.list) {
if (aeb->ec == UBI_SCAN_UNKNOWN_EC) if (aeb->ec == UBI_UNKNOWN)
aeb->ec = ai->mean_ec; aeb->ec = ai->mean_ec;
err = early_erase_peb(ubi, ai, aeb->pnum, aeb->ec+1); err = early_erase_peb(ubi, ai, aeb->pnum, aeb->ec+1);
...@@ -834,11 +834,11 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai, ...@@ -834,11 +834,11 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai,
break; break;
case UBI_IO_FF: case UBI_IO_FF:
ai->empty_peb_count += 1; ai->empty_peb_count += 1;
return add_to_list(ai, pnum, UBI_SCAN_UNKNOWN_EC, 0, return add_to_list(ai, pnum, UBI_UNKNOWN, 0,
&ai->erase); &ai->erase);
case UBI_IO_FF_BITFLIPS: case UBI_IO_FF_BITFLIPS:
ai->empty_peb_count += 1; ai->empty_peb_count += 1;
return add_to_list(ai, pnum, UBI_SCAN_UNKNOWN_EC, 1, return add_to_list(ai, pnum, UBI_UNKNOWN, 1,
&ai->erase); &ai->erase);
case UBI_IO_BAD_HDR_EBADMSG: case UBI_IO_BAD_HDR_EBADMSG:
case UBI_IO_BAD_HDR: case UBI_IO_BAD_HDR:
...@@ -848,7 +848,7 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai, ...@@ -848,7 +848,7 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai,
* moved and EC be re-created. * moved and EC be re-created.
*/ */
ec_err = err; ec_err = err;
ec = UBI_SCAN_UNKNOWN_EC; ec = UBI_UNKNOWN;
bitflips = 1; bitflips = 1;
break; break;
default: default:
...@@ -1172,21 +1172,21 @@ static struct ubi_attach_info *scan_all(struct ubi_device *ubi) ...@@ -1172,21 +1172,21 @@ static struct ubi_attach_info *scan_all(struct ubi_device *ubi)
*/ */
ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb) { ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb) {
ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb)
if (aeb->ec == UBI_SCAN_UNKNOWN_EC) if (aeb->ec == UBI_UNKNOWN)
aeb->ec = ai->mean_ec; aeb->ec = ai->mean_ec;
} }
list_for_each_entry(aeb, &ai->free, u.list) { list_for_each_entry(aeb, &ai->free, u.list) {
if (aeb->ec == UBI_SCAN_UNKNOWN_EC) if (aeb->ec == UBI_UNKNOWN)
aeb->ec = ai->mean_ec; aeb->ec = ai->mean_ec;
} }
list_for_each_entry(aeb, &ai->corr, u.list) list_for_each_entry(aeb, &ai->corr, u.list)
if (aeb->ec == UBI_SCAN_UNKNOWN_EC) if (aeb->ec == UBI_UNKNOWN)
aeb->ec = ai->mean_ec; aeb->ec = ai->mean_ec;
list_for_each_entry(aeb, &ai->erase, u.list) list_for_each_entry(aeb, &ai->erase, u.list)
if (aeb->ec == UBI_SCAN_UNKNOWN_EC) if (aeb->ec == UBI_UNKNOWN)
aeb->ec = ai->mean_ec; aeb->ec = ai->mean_ec;
err = self_check_ai(ubi, ai); err = self_check_ai(ubi, ai);
......
...@@ -21,12 +21,15 @@ ...@@ -21,12 +21,15 @@
#ifndef __UBI_SCAN_H__ #ifndef __UBI_SCAN_H__
#define __UBI_SCAN_H__ #define __UBI_SCAN_H__
/* The erase counter value for this physical eraseblock is unknown */ /*
#define UBI_SCAN_UNKNOWN_EC (-1) * When a field of the attaching information has this value - its real value is
* unknown.
*/
#define UBI_UNKNOWN (-1)
/** /**
* struct ubi_ainf_peb - attach information about a physical eraseblock. * struct ubi_ainf_peb - attach information about a physical eraseblock.
* @ec: erase counter (%UBI_SCAN_UNKNOWN_EC if it is unknown) * @ec: erase counter (%UBI_UNKNOWN if it is unknown)
* @pnum: physical eraseblock number * @pnum: physical eraseblock number
* @lnum: logical eraseblock number * @lnum: logical eraseblock number
* @scrub: if this physical eraseblock needs scrubbing * @scrub: if this physical eraseblock needs scrubbing
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment