Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]

Diff markup

Differences between /linux/drivers/mtd/ubi/scan.h (Version 2.6.25) and /linux/drivers/mtd/ubi/scan.h (Version 2.6.31.13)


  1 /*                                                  1 /*
  2  * Copyright (c) International Business Machin      2  * Copyright (c) International Business Machines Corp., 2006
  3  *                                                  3  *
  4  * This program is free software; you can redi      4  * This program is free software; you can redistribute it and/or modify
  5  * it under the terms of the GNU General Publi      5  * it under the terms of the GNU General Public License as published by
  6  * the Free Software Foundation; either versio      6  * the Free Software Foundation; either version 2 of the License, or
  7  * (at your option) any later version.              7  * (at your option) any later version.
  8  *                                                  8  *
  9  * This program is distributed in the hope tha      9  * This program is distributed in the hope that it will be useful,
 10  * but WITHOUT ANY WARRANTY; without even the      10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR     11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
 12  * the GNU General Public License for more det     12  * the GNU General Public License for more details.
 13  *                                                 13  *
 14  * You should have received a copy of the GNU      14  * You should have received a copy of the GNU General Public License
 15  * along with this program; if not, write to t     15  * along with this program; if not, write to the Free Software
 16  * Foundation, Inc., 59 Temple Place, Suite 33     16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 17  *                                                 17  *
 18  * Author: Artem Bityutskiy (Битюцкий      18  * Author: Artem Bityutskiy (Битюцкий Артём)
 19  */                                                19  */
 20                                                    20 
 21 #ifndef __UBI_SCAN_H__                             21 #ifndef __UBI_SCAN_H__
 22 #define __UBI_SCAN_H__                             22 #define __UBI_SCAN_H__
 23                                                    23 
 24 /* The erase counter value for this physical e     24 /* The erase counter value for this physical eraseblock is unknown */
 25 #define UBI_SCAN_UNKNOWN_EC (-1)                   25 #define UBI_SCAN_UNKNOWN_EC (-1)
 26                                                    26 
 27 /**                                                27 /**
 28  * struct ubi_scan_leb - scanning information      28  * struct ubi_scan_leb - scanning information about a physical eraseblock.
 29  * @ec: erase counter (%UBI_SCAN_UNKNOWN_EC if     29  * @ec: erase counter (%UBI_SCAN_UNKNOWN_EC if it is unknown)
 30  * @pnum: physical eraseblock number               30  * @pnum: physical eraseblock number
 31  * @lnum: logical eraseblock number                31  * @lnum: logical eraseblock number
 32  * @scrub: if this physical eraseblock needs s     32  * @scrub: if this physical eraseblock needs scrubbing
 33  * @sqnum: sequence number                         33  * @sqnum: sequence number
 34  * @u: unions RB-tree or @list links               34  * @u: unions RB-tree or @list links
 35  * @u.rb: link in the per-volume RB-tree of &s     35  * @u.rb: link in the per-volume RB-tree of &struct ubi_scan_leb objects
 36  * @u.list: link in one of the eraseblock list     36  * @u.list: link in one of the eraseblock lists
 37  * @leb_ver: logical eraseblock version (obsol << 
 38  *                                                 37  *
 39  * One object of this type is allocated for ea     38  * One object of this type is allocated for each physical eraseblock during
 40  * scanning.                                       39  * scanning.
 41  */                                                40  */
 42 struct ubi_scan_leb {                              41 struct ubi_scan_leb {
 43         int ec;                                    42         int ec;
 44         int pnum;                                  43         int pnum;
 45         int lnum;                                  44         int lnum;
 46         int scrub;                                 45         int scrub;
 47         unsigned long long sqnum;                  46         unsigned long long sqnum;
 48         union {                                    47         union {
 49                 struct rb_node rb;                 48                 struct rb_node rb;
 50                 struct list_head list;             49                 struct list_head list;
 51         } u;                                       50         } u;
 52         uint32_t leb_ver;                      << 
 53 };                                                 51 };
 54                                                    52 
 55 /**                                                53 /**
 56  * struct ubi_scan_volume - scanning informati     54  * struct ubi_scan_volume - scanning information about a volume.
 57  * @vol_id: volume ID                              55  * @vol_id: volume ID
 58  * @highest_lnum: highest logical eraseblock n     56  * @highest_lnum: highest logical eraseblock number in this volume
 59  * @leb_count: number of logical eraseblocks i     57  * @leb_count: number of logical eraseblocks in this volume
 60  * @vol_type: volume type                          58  * @vol_type: volume type
 61  * @used_ebs: number of used logical erasebloc     59  * @used_ebs: number of used logical eraseblocks in this volume (only for
 62  * static volumes)                             !!  60  *            static volumes)
 63  * @last_data_size: amount of data in the last     61  * @last_data_size: amount of data in the last logical eraseblock of this
 64  * volume (always equivalent to the usable log !!  62  *                  volume (always equivalent to the usable logical eraseblock
 65  * dynamic volumes)                            !!  63  *                  size in case of dynamic volumes)
 66  * @data_pad: how many bytes at the end of log     64  * @data_pad: how many bytes at the end of logical eraseblocks of this volume
 67  * are not used (due to volume alignment)      !!  65  *            are not used (due to volume alignment)
 68  * @compat: compatibility flags of this volume     66  * @compat: compatibility flags of this volume
 69  * @rb: link in the volume RB-tree                 67  * @rb: link in the volume RB-tree
 70  * @root: root of the RB-tree containing all t     68  * @root: root of the RB-tree containing all the eraseblock belonging to this
 71  * volume (&struct ubi_scan_leb objects)       !!  69  *        volume (&struct ubi_scan_leb objects)
 72  *                                                 70  *
 73  * One object of this type is allocated for ea     71  * One object of this type is allocated for each volume during scanning.
 74  */                                                72  */
 75 struct ubi_scan_volume {                           73 struct ubi_scan_volume {
 76         int vol_id;                                74         int vol_id;
 77         int highest_lnum;                          75         int highest_lnum;
 78         int leb_count;                             76         int leb_count;
 79         int vol_type;                              77         int vol_type;
 80         int used_ebs;                              78         int used_ebs;
 81         int last_data_size;                        79         int last_data_size;
 82         int data_pad;                              80         int data_pad;
 83         int compat;                                81         int compat;
 84         struct rb_node rb;                         82         struct rb_node rb;
 85         struct rb_root root;                       83         struct rb_root root;
 86 };                                                 84 };
 87                                                    85 
 88 /**                                                86 /**
 89  * struct ubi_scan_info - UBI scanning informa     87  * struct ubi_scan_info - UBI scanning information.
 90  * @volumes: root of the volume RB-tree            88  * @volumes: root of the volume RB-tree
 91  * @corr: list of corrupted physical erasebloc     89  * @corr: list of corrupted physical eraseblocks
 92  * @free: list of free physical eraseblocks        90  * @free: list of free physical eraseblocks
 93  * @erase: list of physical eraseblocks which      91  * @erase: list of physical eraseblocks which have to be erased
 94  * @alien: list of physical eraseblocks which      92  * @alien: list of physical eraseblocks which should not be used by UBI (e.g.,
                                                   >>  93  *         those belonging to "preserve"-compatible internal volumes)
 95  * @bad_peb_count: count of bad physical erase     94  * @bad_peb_count: count of bad physical eraseblocks
 96  * those belonging to "preserve"-compatible in << 
 97  * @vols_found: number of volumes found during     95  * @vols_found: number of volumes found during scanning
 98  * @highest_vol_id: highest volume ID              96  * @highest_vol_id: highest volume ID
 99  * @alien_peb_count: count of physical erasebl     97  * @alien_peb_count: count of physical eraseblocks in the @alien list
100  * @is_empty: flag indicating whether the MTD      98  * @is_empty: flag indicating whether the MTD device is empty or not
101  * @min_ec: lowest erase counter value             99  * @min_ec: lowest erase counter value
102  * @max_ec: highest erase counter value           100  * @max_ec: highest erase counter value
103  * @max_sqnum: highest sequence number value      101  * @max_sqnum: highest sequence number value
104  * @mean_ec: mean erase counter value             102  * @mean_ec: mean erase counter value
105  * @ec_sum: a temporary variable used when cal    103  * @ec_sum: a temporary variable used when calculating @mean_ec
106  * @ec_count: a temporary variable used when c    104  * @ec_count: a temporary variable used when calculating @mean_ec
                                                   >> 105  * @image_seq_set: indicates @ubi->image_seq is known
107  *                                                106  *
108  * This data structure contains the result of     107  * This data structure contains the result of scanning and may be used by other
109  * UBI units to build final UBI data structure !! 108  * UBI sub-systems to build final UBI data structures, further error-recovery
110  * on.                                         !! 109  * and so on.
111  */                                               110  */
112 struct ubi_scan_info {                            111 struct ubi_scan_info {
113         struct rb_root volumes;                   112         struct rb_root volumes;
114         struct list_head corr;                    113         struct list_head corr;
115         struct list_head free;                    114         struct list_head free;
116         struct list_head erase;                   115         struct list_head erase;
117         struct list_head alien;                   116         struct list_head alien;
118         int bad_peb_count;                        117         int bad_peb_count;
119         int vols_found;                           118         int vols_found;
120         int highest_vol_id;                       119         int highest_vol_id;
121         int alien_peb_count;                      120         int alien_peb_count;
122         int is_empty;                             121         int is_empty;
123         int min_ec;                               122         int min_ec;
124         int max_ec;                               123         int max_ec;
125         unsigned long long max_sqnum;             124         unsigned long long max_sqnum;
126         int mean_ec;                              125         int mean_ec;
127         int ec_sum;                            !! 126         uint64_t ec_sum;
128         int ec_count;                             127         int ec_count;
                                                   >> 128         int image_seq_set;
129 };                                                129 };
130                                                   130 
131 struct ubi_device;                                131 struct ubi_device;
132 struct ubi_vid_hdr;                               132 struct ubi_vid_hdr;
133                                                   133 
134 /*                                                134 /*
135  * ubi_scan_move_to_list - move a physical era !! 135  * ubi_scan_move_to_list - move a PEB from the volume tree to a list.
136  * list.                                       << 
137  *                                                136  *
138  * @sv: volume scanning information               137  * @sv: volume scanning information
139  * @seb: scanning eraseblock infprmation          138  * @seb: scanning eraseblock infprmation
140  * @list: the list to move to                     139  * @list: the list to move to
141  */                                               140  */
142 static inline void ubi_scan_move_to_list(struc    141 static inline void ubi_scan_move_to_list(struct ubi_scan_volume *sv,
143                                          struc    142                                          struct ubi_scan_leb *seb,
144                                          struc    143                                          struct list_head *list)
145 {                                                 144 {
146                 rb_erase(&seb->u.rb, &sv->root    145                 rb_erase(&seb->u.rb, &sv->root);
147                 list_add_tail(&seb->u.list, li    146                 list_add_tail(&seb->u.list, list);
148 }                                                 147 }
149                                                   148 
150 int ubi_scan_add_used(struct ubi_device *ubi,     149 int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_scan_info *si,
151                       int pnum, int ec, const     150                       int pnum, int ec, const struct ubi_vid_hdr *vid_hdr,
152                       int bitflips);              151                       int bitflips);
153 struct ubi_scan_volume *ubi_scan_find_sv(const    152 struct ubi_scan_volume *ubi_scan_find_sv(const struct ubi_scan_info *si,
154                                          int v    153                                          int vol_id);
155 struct ubi_scan_leb *ubi_scan_find_seb(const s    154 struct ubi_scan_leb *ubi_scan_find_seb(const struct ubi_scan_volume *sv,
156                                        int lnu    155                                        int lnum);
157 void ubi_scan_rm_volume(struct ubi_scan_info *    156 void ubi_scan_rm_volume(struct ubi_scan_info *si, struct ubi_scan_volume *sv);
158 struct ubi_scan_leb *ubi_scan_get_free_peb(str    157 struct ubi_scan_leb *ubi_scan_get_free_peb(struct ubi_device *ubi,
159                                            str    158                                            struct ubi_scan_info *si);
160 int ubi_scan_erase_peb(struct ubi_device *ubi,    159 int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_scan_info *si,
161                        int pnum, int ec);         160                        int pnum, int ec);
162 struct ubi_scan_info *ubi_scan(struct ubi_devi    161 struct ubi_scan_info *ubi_scan(struct ubi_device *ubi);
163 void ubi_scan_destroy_si(struct ubi_scan_info     162 void ubi_scan_destroy_si(struct ubi_scan_info *si);
164                                                   163 
165 #endif /* !__UBI_SCAN_H__ */                      164 #endif /* !__UBI_SCAN_H__ */
166                                                   165 
  This page was automatically generated by the LXR engine.