Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit afc15a81 authored by Artem Bityutskiy's avatar Artem Bityutskiy Committed by Artem Bityutskiy
Browse files

UBI: rename struct ubi_scan_info



Rename 'struct ubi_scan_info' to 'struct ubi_attach_info'. This is part
of the code re-structuring I am trying to do in order to add fastmap
in a more logical way. Fastmap can share a lot with scanning, including
the attach-time data structures, which all now have "scan" word in the
name. Let's get rid of this word.

Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
parent cb28a932
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -583,7 +583,7 @@ static void free_internal_volumes(struct ubi_device *ubi)
static int attach_by_scanning(struct ubi_device *ubi)
static int attach_by_scanning(struct ubi_device *ubi)
{
{
	int err;
	int err;
	struct ubi_scan_info *si;
	struct ubi_attach_info *si;


	si = ubi_scan(ubi);
	si = ubi_scan(ubi);
	if (IS_ERR(si))
	if (IS_ERR(si))
+2 −2
Original line number Original line Diff line number Diff line
@@ -1182,7 +1182,7 @@ out_unlock_leb:
 * reported by real users.
 * reported by real users.
 */
 */
static void print_rsvd_warning(struct ubi_device *ubi,
static void print_rsvd_warning(struct ubi_device *ubi,
			       struct ubi_scan_info *si)
			       struct ubi_attach_info *si)
{
{
	/*
	/*
	 * The 1 << 18 (256KiB) number is picked randomly, just a reasonably
	 * The 1 << 18 (256KiB) number is picked randomly, just a reasonably
@@ -1212,7 +1212,7 @@ static void print_rsvd_warning(struct ubi_device *ubi,
 * This function returns zero in case of success and a negative error code in
 * This function returns zero in case of success and a negative error code in
 * case of failure.
 * case of failure.
 */
 */
int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_scan_info *si)
int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si)
{
{
	int i, j, err, num_volumes;
	int i, j, err, num_volumes;
	struct ubi_ainf_volume *sv;
	struct ubi_ainf_volume *sv;
+21 −20
Original line number Original line Diff line number Diff line
@@ -24,7 +24,7 @@
 * This sub-system is responsible for scanning the flash media, checking UBI
 * This sub-system is responsible for scanning the flash media, checking UBI
 * headers and providing complete information about the UBI flash image.
 * headers and providing complete information about the UBI flash image.
 *
 *
 * The scanning information is represented by a &struct ubi_scan_info' object.
 * The scanning information is represented by a &struct ubi_attach_info' object.
 * Information about found volumes is represented by &struct ubi_ainf_volume
 * Information about found volumes is represented by &struct ubi_ainf_volume
 * objects which are kept in volume RB-tree with root at the @volumes field.
 * objects which are kept in volume RB-tree with root at the @volumes field.
 * The RB-tree is indexed by the volume ID.
 * The RB-tree is indexed by the volume ID.
@@ -88,7 +88,7 @@
#include <linux/random.h>
#include <linux/random.h>
#include "ubi.h"
#include "ubi.h"


static int self_check_si(struct ubi_device *ubi, struct ubi_scan_info *si);
static int self_check_si(struct ubi_device *ubi, struct ubi_attach_info *si);


/* Temporary variables used during scanning */
/* Temporary variables used during scanning */
static struct ubi_ec_hdr *ech;
static struct ubi_ec_hdr *ech;
@@ -110,8 +110,8 @@ static struct ubi_vid_hdr *vidh;
 * returns zero in case of success and a negative error code in case of
 * returns zero in case of success and a negative error code in case of
 * failure.
 * failure.
 */
 */
static int add_to_list(struct ubi_scan_info *si, int pnum, int ec, int to_head,
static int add_to_list(struct ubi_attach_info *si, int pnum, int ec,
		       struct list_head *list)
		       int to_head, struct list_head *list)
{
{
	struct ubi_ainf_peb *seb;
	struct ubi_ainf_peb *seb;


@@ -148,7 +148,7 @@ static int add_to_list(struct ubi_scan_info *si, int pnum, int ec, int to_head,
 * The corruption was presumably not caused by a power cut. Returns zero in
 * The corruption was presumably not caused by a power cut. Returns zero in
 * case of success and a negative error code in case of failure.
 * case of success and a negative error code in case of failure.
 */
 */
static int add_corrupted(struct ubi_scan_info *si, int pnum, int ec)
static int add_corrupted(struct ubi_attach_info *si, int pnum, int ec)
{
{
	struct ubi_ainf_peb *seb;
	struct ubi_ainf_peb *seb;


@@ -244,8 +244,8 @@ bad:
 * to the scanning volume object in case of success and a negative error code
 * to the scanning volume object in case of success and a negative error code
 * in case of failure.
 * in case of failure.
 */
 */
static struct ubi_ainf_volume *add_volume(struct ubi_scan_info *si, int vol_id,
static struct ubi_ainf_volume *add_volume(struct ubi_attach_info *si,
					  int pnum,
					  int vol_id, int pnum,
					  const struct ubi_vid_hdr *vid_hdr)
					  const struct ubi_vid_hdr *vid_hdr)
{
{
	struct ubi_ainf_volume *sv;
	struct ubi_ainf_volume *sv;
@@ -440,7 +440,7 @@ out_free_vidh:
 * to be picked, while the older one has to be dropped. This function returns
 * to be picked, while the older one has to be dropped. This function returns
 * zero in case of success and a negative error code in case of failure.
 * zero in case of success and a negative error code in case of failure.
 */
 */
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 *si,
		      int pnum, int ec, const struct ubi_vid_hdr *vid_hdr,
		      int pnum, int ec, const struct ubi_vid_hdr *vid_hdr,
		      int bitflips)
		      int bitflips)
{
{
@@ -593,7 +593,7 @@ int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_scan_info *si,
 * This function returns a pointer to the volume description or %NULL if there
 * This function returns a pointer to the volume description or %NULL if there
 * are no data about this volume in the scanning information.
 * are no data about this volume in the scanning information.
 */
 */
struct ubi_ainf_volume *ubi_scan_find_sv(const struct ubi_scan_info *si,
struct ubi_ainf_volume *ubi_scan_find_sv(const struct ubi_attach_info *si,
					 int vol_id)
					 int vol_id)
{
{
	struct ubi_ainf_volume *sv;
	struct ubi_ainf_volume *sv;
@@ -648,7 +648,7 @@ struct ubi_ainf_peb *ubi_scan_find_seb(const struct ubi_ainf_volume *sv,
 * @si: scanning information
 * @si: scanning information
 * @sv: the volume scanning information to delete
 * @sv: the volume scanning information to delete
 */
 */
void ubi_scan_rm_volume(struct ubi_scan_info *si, struct ubi_ainf_volume *sv)
void ubi_scan_rm_volume(struct ubi_attach_info *si, struct ubi_ainf_volume *sv)
{
{
	struct rb_node *rb;
	struct rb_node *rb;
	struct ubi_ainf_peb *seb;
	struct ubi_ainf_peb *seb;
@@ -679,7 +679,7 @@ void ubi_scan_rm_volume(struct ubi_scan_info *si, struct ubi_ainf_volume *sv)
 * This function returns zero in case of success and a negative error code in
 * This function returns zero in case of success and a negative error code in
 * case of failure.
 * case of failure.
 */
 */
int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_scan_info *si,
int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_attach_info *si,
		       int pnum, int ec)
		       int pnum, int ec)
{
{
	int err;
	int err;
@@ -726,7 +726,7 @@ out_free:
 * success and an error code in case of failure.
 * success and an error code in case of failure.
 */
 */
struct ubi_ainf_peb *ubi_scan_get_free_peb(struct ubi_device *ubi,
struct ubi_ainf_peb *ubi_scan_get_free_peb(struct ubi_device *ubi,
					   struct ubi_scan_info *si)
					   struct ubi_attach_info *si)
{
{
	int err = 0;
	int err = 0;
	struct ubi_ainf_peb *seb, *tmp_seb;
	struct ubi_ainf_peb *seb, *tmp_seb;
@@ -831,7 +831,7 @@ out_unlock:
 * This function returns a zero if the physical eraseblock was successfully
 * This function returns a zero if the physical eraseblock was successfully
 * handled and a negative error code in case of failure.
 * handled and a negative error code in case of failure.
 */
 */
static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
static int process_eb(struct ubi_device *ubi, struct ubi_attach_info *si,
		      int pnum)
		      int pnum)
{
{
	long long uninitialized_var(ec);
	long long uninitialized_var(ec);
@@ -1073,7 +1073,8 @@ adjust_mean_ec:
 * MTD device. Returns zero if we should proceed with attaching the MTD device,
 * MTD device. Returns zero if we should proceed with attaching the MTD device,
 * and %-EINVAL if we should not.
 * and %-EINVAL if we should not.
 */
 */
static int check_what_we_have(struct ubi_device *ubi, struct ubi_scan_info *si)
static int check_what_we_have(struct ubi_device *ubi,
			      struct ubi_attach_info *si)
{
{
	struct ubi_ainf_peb *seb;
	struct ubi_ainf_peb *seb;
	int max_corr, peb_count;
	int max_corr, peb_count;
@@ -1143,15 +1144,15 @@ static int check_what_we_have(struct ubi_device *ubi, struct ubi_scan_info *si)
 * This function does full scanning of an MTD device and returns complete
 * This function does full scanning of an MTD device and returns complete
 * information about it. In case of failure, an error code is returned.
 * information about it. In case of failure, an error code is returned.
 */
 */
struct ubi_scan_info *ubi_scan(struct ubi_device *ubi)
struct ubi_attach_info *ubi_scan(struct ubi_device *ubi)
{
{
	int err, pnum;
	int err, pnum;
	struct rb_node *rb1, *rb2;
	struct rb_node *rb1, *rb2;
	struct ubi_ainf_volume *sv;
	struct ubi_ainf_volume *sv;
	struct ubi_ainf_peb *seb;
	struct ubi_ainf_peb *seb;
	struct ubi_scan_info *si;
	struct ubi_attach_info *si;


	si = kzalloc(sizeof(struct ubi_scan_info), GFP_KERNEL);
	si = kzalloc(sizeof(struct ubi_attach_info), GFP_KERNEL);
	if (!si)
	if (!si)
		return ERR_PTR(-ENOMEM);
		return ERR_PTR(-ENOMEM);


@@ -1244,7 +1245,7 @@ out_si:
 * This function destroys the volume RB-tree (@sv->root) and the scanning
 * This function destroys the volume RB-tree (@sv->root) and the scanning
 * volume information.
 * volume information.
 */
 */
static void destroy_sv(struct ubi_scan_info *si, struct ubi_ainf_volume *sv)
static void destroy_sv(struct ubi_attach_info *si, struct ubi_ainf_volume *sv)
{
{
	struct ubi_ainf_peb *seb;
	struct ubi_ainf_peb *seb;
	struct rb_node *this = sv->root.rb_node;
	struct rb_node *this = sv->root.rb_node;
@@ -1274,7 +1275,7 @@ static void destroy_sv(struct ubi_scan_info *si, struct ubi_ainf_volume *sv)
 * ubi_scan_destroy_si - destroy scanning information.
 * ubi_scan_destroy_si - destroy scanning information.
 * @si: scanning information
 * @si: scanning information
 */
 */
void ubi_scan_destroy_si(struct ubi_scan_info *si)
void ubi_scan_destroy_si(struct ubi_attach_info *si)
{
{
	struct ubi_ainf_peb *seb, *seb_tmp;
	struct ubi_ainf_peb *seb, *seb_tmp;
	struct ubi_ainf_volume *sv;
	struct ubi_ainf_volume *sv;
@@ -1333,7 +1334,7 @@ void ubi_scan_destroy_si(struct ubi_scan_info *si)
 * This function returns zero if the scanning information is all right, and a
 * This function returns zero if the scanning information is all right, and a
 * negative error code if not or if an error occurred.
 * negative error code if not or if an error occurred.
 */
 */
static int self_check_si(struct ubi_device *ubi, struct ubi_scan_info *si)
static int self_check_si(struct ubi_device *ubi, struct ubi_attach_info *si)
{
{
	int pnum, err, vols_found = 0;
	int pnum, err, vols_found = 0;
	struct rb_node *rb1, *rb2;
	struct rb_node *rb1, *rb2;
+9 −9
Original line number Original line Diff line number Diff line
@@ -86,7 +86,7 @@ struct ubi_ainf_volume {
};
};


/**
/**
 * struct ubi_scan_info - UBI scanning information.
 * struct ubi_attach_info - UBI scanning information.
 * @volumes: root of the volume RB-tree
 * @volumes: root of the volume RB-tree
 * @corr: list of corrupted physical eraseblocks
 * @corr: list of corrupted physical eraseblocks
 * @free: list of free physical eraseblocks
 * @free: list of free physical eraseblocks
@@ -115,7 +115,7 @@ struct ubi_ainf_volume {
 * UBI sub-systems to build final UBI data structures, further error-recovery
 * UBI sub-systems to build final UBI data structures, further error-recovery
 * and so on.
 * and so on.
 */
 */
struct ubi_scan_info {
struct ubi_attach_info {
	struct rb_root volumes;
	struct rb_root volumes;
	struct list_head corr;
	struct list_head corr;
	struct list_head free;
	struct list_head free;
@@ -156,19 +156,19 @@ static inline void ubi_scan_move_to_list(struct ubi_ainf_volume *sv,
		list_add_tail(&seb->u.list, list);
		list_add_tail(&seb->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 *si,
		      int pnum, int ec, const struct ubi_vid_hdr *vid_hdr,
		      int pnum, int ec, const struct ubi_vid_hdr *vid_hdr,
		      int bitflips);
		      int bitflips);
struct ubi_ainf_volume *ubi_scan_find_sv(const struct ubi_scan_info *si,
struct ubi_ainf_volume *ubi_scan_find_sv(const struct ubi_attach_info *si,
					 int vol_id);
					 int vol_id);
struct ubi_ainf_peb *ubi_scan_find_seb(const struct ubi_ainf_volume *sv,
struct ubi_ainf_peb *ubi_scan_find_seb(const struct ubi_ainf_volume *sv,
				       int lnum);
				       int lnum);
void ubi_scan_rm_volume(struct ubi_scan_info *si, struct ubi_ainf_volume *sv);
void ubi_scan_rm_volume(struct ubi_attach_info *si, struct ubi_ainf_volume *sv);
struct ubi_ainf_peb *ubi_scan_get_free_peb(struct ubi_device *ubi,
struct ubi_ainf_peb *ubi_scan_get_free_peb(struct ubi_device *ubi,
					   struct ubi_scan_info *si);
					   struct ubi_attach_info *si);
int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_scan_info *si,
int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_attach_info *si,
		       int pnum, int ec);
		       int pnum, int ec);
struct ubi_scan_info *ubi_scan(struct ubi_device *ubi);
struct ubi_attach_info *ubi_scan(struct ubi_device *ubi);
void ubi_scan_destroy_si(struct ubi_scan_info *si);
void ubi_scan_destroy_si(struct ubi_attach_info *si);


#endif /* !__UBI_SCAN_H__ */
#endif /* !__UBI_SCAN_H__ */
+3 −3
Original line number Original line Diff line number Diff line
@@ -489,7 +489,7 @@ int ubi_change_vtbl_record(struct ubi_device *ubi, int idx,
			   struct ubi_vtbl_record *vtbl_rec);
			   struct ubi_vtbl_record *vtbl_rec);
int ubi_vtbl_rename_volumes(struct ubi_device *ubi,
int ubi_vtbl_rename_volumes(struct ubi_device *ubi,
			    struct list_head *rename_list);
			    struct list_head *rename_list);
int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_scan_info *si);
int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_attach_info *si);


/* vmt.c */
/* vmt.c */
int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req);
int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req);
@@ -529,14 +529,14 @@ int ubi_eba_atomic_leb_change(struct ubi_device *ubi, struct ubi_volume *vol,
			      int lnum, const void *buf, int len);
			      int lnum, const void *buf, int len);
int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
		     struct ubi_vid_hdr *vid_hdr);
		     struct ubi_vid_hdr *vid_hdr);
int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_scan_info *si);
int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si);


/* wl.c */
/* wl.c */
int ubi_wl_get_peb(struct ubi_device *ubi);
int ubi_wl_get_peb(struct ubi_device *ubi);
int ubi_wl_put_peb(struct ubi_device *ubi, int pnum, int torture);
int ubi_wl_put_peb(struct ubi_device *ubi, int pnum, int torture);
int ubi_wl_flush(struct ubi_device *ubi);
int ubi_wl_flush(struct ubi_device *ubi);
int ubi_wl_scrub_peb(struct ubi_device *ubi, int pnum);
int ubi_wl_scrub_peb(struct ubi_device *ubi, int pnum);
int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_scan_info *si);
int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si);
void ubi_wl_close(struct ubi_device *ubi);
void ubi_wl_close(struct ubi_device *ubi);
int ubi_thread(void *u);
int ubi_thread(void *u);


Loading