#define UBI_SCAN_UNKNOWN_EC (-1)
/**
- * struct ubi_scan_leb - scanning 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)
* @pnum: physical eraseblock number
* @lnum: logical eraseblock number
* @copy_flag: this LEB is a copy (@copy_flag is set in VID header of this LEB)
* @sqnum: sequence number
* @u: unions RB-tree or @list links
- * @u.rb: link in the per-volume RB-tree of &struct ubi_scan_leb objects
+ * @u.rb: link in the per-volume RB-tree of &struct ubi_ainf_peb objects
* @u.list: link in one of the eraseblock lists
*
- * One object of this type is allocated for each physical eraseblock during
- * scanning.
+ * One object of this type is allocated for each physical eraseblock when
+ * attaching an MTD device.
*/
-struct ubi_scan_leb {
+struct ubi_ainf_peb {
int ec;
int pnum;
int lnum;
};
/**
- * struct ubi_scan_volume - scanning information about a volume.
+ * struct ubi_ainf_volume - attaching information about a volume.
* @vol_id: volume ID
* @highest_lnum: highest logical eraseblock number in this volume
* @leb_count: number of logical eraseblocks in this volume
* @compat: compatibility flags of this volume
* @rb: link in the volume RB-tree
* @root: root of the RB-tree containing all the eraseblock belonging to this
- * volume (&struct ubi_scan_leb objects)
+ * volume (&struct ubi_ainf_peb objects)
*
- * One object of this type is allocated for each volume during scanning.
+ * One object of this type is allocated for each volume when attaching an MTD
+ * device.
*/
-struct ubi_scan_volume {
+struct ubi_ainf_volume {
int vol_id;
int highest_lnum;
int leb_count;
};
/**
- * struct ubi_scan_info - UBI scanning information.
+ * struct ubi_attach_info - MTD device attaching information.
* @volumes: root of the volume RB-tree
* @corr: list of corrupted physical eraseblocks
* @free: list of free physical eraseblocks
* @bad_peb_count: count of bad physical eraseblocks
* @maybe_bad_peb_count: count of bad physical eraseblocks which are not marked
* as bad yet, but which look like bad
- * @vols_found: number of volumes found during scanning
+ * @vols_found: number of volumes found
* @highest_vol_id: highest volume ID
* @is_empty: flag indicating whether the MTD device is empty or not
* @min_ec: lowest erase counter value
* @mean_ec: mean erase counter value
* @ec_sum: a temporary variable used when calculating @mean_ec
* @ec_count: a temporary variable used when calculating @mean_ec
- * @scan_leb_slab: slab cache for &struct ubi_scan_leb objects
+ * @scan_leb_slab: slab cache for &struct ubi_ainf_peb objects
*
- * This data structure contains the result of scanning and may be used by other
- * UBI sub-systems to build final UBI data structures, further error-recovery
- * and so on.
+ * This data structure contains the result of attaching an MTD device and may
+ * be used by other UBI sub-systems to build final UBI data structures, further
+ * error-recovery and so on.
*/
-struct ubi_scan_info {
+struct ubi_attach_info {
struct rb_root volumes;
struct list_head corr;
struct list_head free;
/*
* ubi_scan_move_to_list - move a PEB from the volume tree to a list.
*
- * @sv: volume scanning information
- * @seb: scanning eraseblock information
+ * @av: volume attaching information
+ * @aeb: scanning eraseblock information
* @list: the list to move to
*/
-static inline void ubi_scan_move_to_list(struct ubi_scan_volume *sv,
- struct ubi_scan_leb *seb,
+static inline void ubi_scan_move_to_list(struct ubi_ainf_volume *av,
+ struct ubi_ainf_peb *aeb,
struct list_head *list)
{
- rb_erase(&seb->u.rb, &sv->root);
- list_add_tail(&seb->u.list, list);
+ rb_erase(&aeb->u.rb, &av->root);
+ list_add_tail(&aeb->u.list, list);
}
-int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_scan_info *si,
+int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_attach_info *ai,
int pnum, int ec, const struct ubi_vid_hdr *vid_hdr,
int bitflips);
-struct ubi_scan_volume *ubi_scan_find_sv(const struct ubi_scan_info *si,
+struct ubi_ainf_volume *ubi_scan_find_av(const struct ubi_attach_info *ai,
int vol_id);
-struct ubi_scan_leb *ubi_scan_find_seb(const struct ubi_scan_volume *sv,
- int lnum);
-void ubi_scan_rm_volume(struct ubi_scan_info *si, struct ubi_scan_volume *sv);
-struct ubi_scan_leb *ubi_scan_get_free_peb(struct ubi_device *ubi,
- struct ubi_scan_info *si);
-int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_scan_info *si,
- int pnum, int ec);
-struct ubi_scan_info *ubi_scan(struct ubi_device *ubi);
-void ubi_scan_destroy_si(struct ubi_scan_info *si);
+void ubi_scan_rm_volume(struct ubi_attach_info *ai, struct ubi_ainf_volume *av);
+struct ubi_ainf_peb *ubi_scan_get_free_peb(struct ubi_device *ubi,
+ struct ubi_attach_info *ai);
+struct ubi_attach_info *ubi_scan(struct ubi_device *ubi);
+void ubi_scan_destroy_ai(struct ubi_attach_info *ai);
#endif /* !__UBI_SCAN_H__ */