aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/ubi-media.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ubi/ubi-media.h')
-rw-r--r--drivers/mtd/ubi/ubi-media.h38
1 files changed, 17 insertions, 21 deletions
diff --git a/drivers/mtd/ubi/ubi-media.h b/drivers/mtd/ubi/ubi-media.h
index c3185d9fd048..2ad940409053 100644
--- a/drivers/mtd/ubi/ubi-media.h
+++ b/drivers/mtd/ubi/ubi-media.h
@@ -98,10 +98,11 @@ enum {
98 * Compatibility constants used by internal volumes. 98 * Compatibility constants used by internal volumes.
99 * 99 *
100 * @UBI_COMPAT_DELETE: delete this internal volume before anything is written 100 * @UBI_COMPAT_DELETE: delete this internal volume before anything is written
101 * to the flash 101 * to the flash
102 * @UBI_COMPAT_RO: attach this device in read-only mode 102 * @UBI_COMPAT_RO: attach this device in read-only mode
103 * @UBI_COMPAT_PRESERVE: preserve this internal volume - do not touch its 103 * @UBI_COMPAT_PRESERVE: preserve this internal volume - do not touch its
104 * physical eraseblocks, don't allow the wear-leveling unit to move them 104 * physical eraseblocks, don't allow the wear-leveling
105 * sub-system to move them
105 * @UBI_COMPAT_REJECT: reject this UBI image 106 * @UBI_COMPAT_REJECT: reject this UBI image
106 */ 107 */
107enum { 108enum {
@@ -123,7 +124,7 @@ enum {
123 * struct ubi_ec_hdr - UBI erase counter header. 124 * struct ubi_ec_hdr - UBI erase counter header.
124 * @magic: erase counter header magic number (%UBI_EC_HDR_MAGIC) 125 * @magic: erase counter header magic number (%UBI_EC_HDR_MAGIC)
125 * @version: version of UBI implementation which is supposed to accept this 126 * @version: version of UBI implementation which is supposed to accept this
126 * UBI image 127 * UBI image
127 * @padding1: reserved for future, zeroes 128 * @padding1: reserved for future, zeroes
128 * @ec: the erase counter 129 * @ec: the erase counter
129 * @vid_hdr_offset: where the VID header starts 130 * @vid_hdr_offset: where the VID header starts
@@ -159,24 +160,23 @@ struct ubi_ec_hdr {
159 * struct ubi_vid_hdr - on-flash UBI volume identifier header. 160 * struct ubi_vid_hdr - on-flash UBI volume identifier header.
160 * @magic: volume identifier header magic number (%UBI_VID_HDR_MAGIC) 161 * @magic: volume identifier header magic number (%UBI_VID_HDR_MAGIC)
161 * @version: UBI implementation version which is supposed to accept this UBI 162 * @version: UBI implementation version which is supposed to accept this UBI
162 * image (%UBI_VERSION) 163 * image (%UBI_VERSION)
163 * @vol_type: volume type (%UBI_VID_DYNAMIC or %UBI_VID_STATIC) 164 * @vol_type: volume type (%UBI_VID_DYNAMIC or %UBI_VID_STATIC)
164 * @copy_flag: if this logical eraseblock was copied from another physical 165 * @copy_flag: if this logical eraseblock was copied from another physical
165 * eraseblock (for wear-leveling reasons) 166 * eraseblock (for wear-leveling reasons)
166 * @compat: compatibility of this volume (%0, %UBI_COMPAT_DELETE, 167 * @compat: compatibility of this volume (%0, %UBI_COMPAT_DELETE,
167 * %UBI_COMPAT_IGNORE, %UBI_COMPAT_PRESERVE, or %UBI_COMPAT_REJECT) 168 * %UBI_COMPAT_IGNORE, %UBI_COMPAT_PRESERVE, or %UBI_COMPAT_REJECT)
168 * @vol_id: ID of this volume 169 * @vol_id: ID of this volume
169 * @lnum: logical eraseblock number 170 * @lnum: logical eraseblock number
170 * @leb_ver: version of this logical eraseblock (IMPORTANT: obsolete, to be 171 * @padding1: reserved for future, zeroes
171 * removed, kept only for not breaking older UBI users)
172 * @data_size: how many bytes of data this logical eraseblock contains 172 * @data_size: how many bytes of data this logical eraseblock contains
173 * @used_ebs: total number of used logical eraseblocks in this volume 173 * @used_ebs: total number of used logical eraseblocks in this volume
174 * @data_pad: how many bytes at the end of this physical eraseblock are not 174 * @data_pad: how many bytes at the end of this physical eraseblock are not
175 * used 175 * used
176 * @data_crc: CRC checksum of the data stored in this logical eraseblock 176 * @data_crc: CRC checksum of the data stored in this logical eraseblock
177 * @padding1: reserved for future, zeroes
178 * @sqnum: sequence number
179 * @padding2: reserved for future, zeroes 177 * @padding2: reserved for future, zeroes
178 * @sqnum: sequence number
179 * @padding3: reserved for future, zeroes
180 * @hdr_crc: volume identifier header CRC checksum 180 * @hdr_crc: volume identifier header CRC checksum
181 * 181 *
182 * The @sqnum is the value of the global sequence counter at the time when this 182 * The @sqnum is the value of the global sequence counter at the time when this
@@ -224,10 +224,6 @@ struct ubi_ec_hdr {
224 * checksum is correct, this physical eraseblock is selected (P1). Otherwise 224 * checksum is correct, this physical eraseblock is selected (P1). Otherwise
225 * the older one (P) is selected. 225 * the older one (P) is selected.
226 * 226 *
227 * Note, there is an obsolete @leb_ver field which was used instead of @sqnum
228 * in the past. But it is not used anymore and we keep it in order to be able
229 * to deal with old UBI images. It will be removed at some point.
230 *
231 * There are 2 sorts of volumes in UBI: user volumes and internal volumes. 227 * There are 2 sorts of volumes in UBI: user volumes and internal volumes.
232 * Internal volumes are not seen from outside and are used for various internal 228 * Internal volumes are not seen from outside and are used for various internal
233 * UBI purposes. In this implementation there is only one internal volume - the 229 * UBI purposes. In this implementation there is only one internal volume - the
@@ -248,9 +244,9 @@ struct ubi_ec_hdr {
248 * The @data_crc field contains the CRC checksum of the contents of the logical 244 * The @data_crc field contains the CRC checksum of the contents of the logical
249 * eraseblock if this is a static volume. In case of dynamic volumes, it does 245 * eraseblock if this is a static volume. In case of dynamic volumes, it does
250 * not contain the CRC checksum as a rule. The only exception is when the 246 * not contain the CRC checksum as a rule. The only exception is when the
251 * data of the physical eraseblock was moved by the wear-leveling unit, then 247 * data of the physical eraseblock was moved by the wear-leveling sub-system,
252 * the wear-leveling unit calculates the data CRC and stores it in the 248 * then the wear-leveling sub-system calculates the data CRC and stores it in
253 * @data_crc field. And of course, the @copy_flag is %in this case. 249 * the @data_crc field. And of course, the @copy_flag is %in this case.
254 * 250 *
255 * The @data_size field is used only for static volumes because UBI has to know 251 * The @data_size field is used only for static volumes because UBI has to know
256 * how many bytes of data are stored in this eraseblock. For dynamic volumes, 252 * how many bytes of data are stored in this eraseblock. For dynamic volumes,
@@ -277,14 +273,14 @@ struct ubi_vid_hdr {
277 __u8 compat; 273 __u8 compat;
278 __be32 vol_id; 274 __be32 vol_id;
279 __be32 lnum; 275 __be32 lnum;
280 __be32 leb_ver; /* obsolete, to be removed, don't use */ 276 __u8 padding1[4];
281 __be32 data_size; 277 __be32 data_size;
282 __be32 used_ebs; 278 __be32 used_ebs;
283 __be32 data_pad; 279 __be32 data_pad;
284 __be32 data_crc; 280 __be32 data_crc;
285 __u8 padding1[4]; 281 __u8 padding2[4];
286 __be64 sqnum; 282 __be64 sqnum;
287 __u8 padding2[12]; 283 __u8 padding3[12];
288 __be32 hdr_crc; 284 __be32 hdr_crc;
289} __attribute__ ((packed)); 285} __attribute__ ((packed));
290 286