提交 afc15a81 编写于 作者: A Artem Bityutskiy 提交者: Artem Bityutskiy

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: NArtem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
上级 cb28a932
......@@ -583,7 +583,7 @@ static void free_internal_volumes(struct ubi_device *ubi)
static int attach_by_scanning(struct ubi_device *ubi)
{
int err;
struct ubi_scan_info *si;
struct ubi_attach_info *si;
si = ubi_scan(ubi);
if (IS_ERR(si))
......
......@@ -1182,7 +1182,7 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
* reported by real users.
*/
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
......@@ -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
* 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;
struct ubi_ainf_volume *sv;
......
......@@ -24,7 +24,7 @@
* This sub-system is responsible for scanning the flash media, checking UBI
* 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
* objects which are kept in volume RB-tree with root at the @volumes field.
* The RB-tree is indexed by the volume ID.
......@@ -88,7 +88,7 @@
#include <linux/random.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 */
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
* failure.
*/
static int add_to_list(struct ubi_scan_info *si, int pnum, int ec, int to_head,
struct list_head *list)
static int add_to_list(struct ubi_attach_info *si, int pnum, int ec,
int to_head, struct list_head *list)
{
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
* 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;
......@@ -244,8 +244,8 @@ static int validate_vid_hdr(const struct ubi_vid_hdr *vid_hdr,
* to the scanning volume object in case of success and a negative error code
* in case of failure.
*/
static struct ubi_ainf_volume *add_volume(struct ubi_scan_info *si, int vol_id,
int pnum,
static struct ubi_ainf_volume *add_volume(struct ubi_attach_info *si,
int vol_id, int pnum,
const struct ubi_vid_hdr *vid_hdr)
{
struct ubi_ainf_volume *sv;
......@@ -440,7 +440,7 @@ static int compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *seb,
* 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.
*/
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 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
* 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)
{
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
* @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 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
* 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 err;
......@@ -726,7 +726,7 @@ int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_scan_info *si,
* success and an error code in case of failure.
*/
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;
struct ubi_ainf_peb *seb, *tmp_seb;
......@@ -831,7 +831,7 @@ static int check_corruption(struct ubi_device *ubi, struct ubi_vid_hdr *vid_hdr,
* This function returns a zero if the physical eraseblock was successfully
* 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)
{
long long uninitialized_var(ec);
......@@ -1073,7 +1073,8 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
* MTD device. Returns zero if we should proceed with attaching the MTD device,
* 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;
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
* 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;
struct rb_node *rb1, *rb2;
struct ubi_ainf_volume *sv;
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)
return ERR_PTR(-ENOMEM);
......@@ -1244,7 +1245,7 @@ struct ubi_scan_info *ubi_scan(struct ubi_device *ubi)
* This function destroys the volume RB-tree (@sv->root) and the scanning
* 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 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.
* @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_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
* 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;
struct rb_node *rb1, *rb2;
......
......@@ -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
* @corr: list of corrupted 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
* and so on.
*/
struct ubi_scan_info {
struct ubi_attach_info {
struct rb_root volumes;
struct list_head corr;
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);
}
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 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);
struct ubi_ainf_peb *ubi_scan_find_seb(const struct ubi_ainf_volume *sv,
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_scan_info *si);
int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_scan_info *si,
struct ubi_attach_info *si);
int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_attach_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);
struct ubi_attach_info *ubi_scan(struct ubi_device *ubi);
void ubi_scan_destroy_si(struct ubi_attach_info *si);
#endif /* !__UBI_SCAN_H__ */
......@@ -489,7 +489,7 @@ int ubi_change_vtbl_record(struct ubi_device *ubi, int idx,
struct ubi_vtbl_record *vtbl_rec);
int ubi_vtbl_rename_volumes(struct ubi_device *ubi,
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 */
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 ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
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 */
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_flush(struct ubi_device *ubi);
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);
int ubi_thread(void *u);
......
......@@ -298,7 +298,7 @@ static int vtbl_check(const struct ubi_device *ubi,
* This function returns zero in case of success and a negative error code in
* case of failure.
*/
static int create_vtbl(struct ubi_device *ubi, struct ubi_scan_info *si,
static int create_vtbl(struct ubi_device *ubi, struct ubi_attach_info *si,
int copy, void *vtbl)
{
int err, tries = 0;
......@@ -373,7 +373,7 @@ static int create_vtbl(struct ubi_device *ubi, struct ubi_scan_info *si,
* table in case of success and a negative error code in case of failure.
*/
static struct ubi_vtbl_record *process_lvol(struct ubi_device *ubi,
struct ubi_scan_info *si,
struct ubi_attach_info *si,
struct ubi_ainf_volume *sv)
{
int err;
......@@ -496,7 +496,7 @@ static struct ubi_vtbl_record *process_lvol(struct ubi_device *ubi,
* negative error code in case of failure.
*/
static struct ubi_vtbl_record *create_empty_lvol(struct ubi_device *ubi,
struct ubi_scan_info *si)
struct ubi_attach_info *si)
{
int i;
struct ubi_vtbl_record *vtbl;
......@@ -531,7 +531,8 @@ static struct ubi_vtbl_record *create_empty_lvol(struct ubi_device *ubi,
* Returns zero in case of success and a negative error code in case of
* failure.
*/
static int init_volumes(struct ubi_device *ubi, const struct ubi_scan_info *si,
static int init_volumes(struct ubi_device *ubi,
const struct ubi_attach_info *si,
const struct ubi_vtbl_record *vtbl)
{
int i, reserved_pebs = 0;
......@@ -712,7 +713,7 @@ static int check_sv(const struct ubi_volume *vol,
* information is OK and %-EINVAL if it is not.
*/
static int check_scanning_info(const struct ubi_device *ubi,
struct ubi_scan_info *si)
struct ubi_attach_info *si)
{
int err, i;
struct ubi_ainf_volume *sv;
......@@ -776,7 +777,7 @@ static int check_scanning_info(const struct ubi_device *ubi,
* or creates it if needed. Returns zero in case of success and a negative
* error code in case of failure.
*/
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)
{
int i, err;
struct ubi_ainf_volume *sv;
......
......@@ -1380,7 +1380,7 @@ static void cancel_pending(struct ubi_device *ubi)
* This function returns zero in case of success, and a negative error code in
* case of failure.
*/
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)
{
int err, i;
struct rb_node *rb1, *rb2;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册