summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorWolfram Sang <w.sang@pengutronix.de>2012-12-17 16:48:26 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-12-19 10:30:56 +0100
commit52e60618d6977eefef24b5c8b530dcf3b88ffa0d (patch)
tree95f18dc3dc208f4cf41145e1a530ad579a47d545 /include
parent4f03bc5d9fd06f0c3f58e674356b75e2830414b7 (diff)
downloadbarebox-52e60618d6977eefef24b5c8b530dcf3b88ffa0d.tar.gz
barebox-52e60618d6977eefef24b5c8b530dcf3b88ffa0d.tar.xz
ubi: consolidate ubi-media.h
We have two versions in the tree. Use the newer one, and put it into the mtd directory while we are at it. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/mtd/ubi-media.h (renamed from include/ubi-media.h)47
1 files changed, 23 insertions, 24 deletions
diff --git a/include/ubi-media.h b/include/mtd/ubi-media.h
index 4edbbb20e0..cd1bd8e517 100644
--- a/include/ubi-media.h
+++ b/include/mtd/ubi-media.h
@@ -27,8 +27,6 @@
#ifndef __UBI_MEDIA_H__
#define __UBI_MEDIA_H__
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-
#include <asm/byteorder.h>
/* The version of UBI images supported by this implementation */
@@ -97,11 +95,10 @@ enum {
* Compatibility constants used by internal volumes.
*
* @UBI_COMPAT_DELETE: delete this internal volume before anything is written
- * to the flash
+ * to the flash
* @UBI_COMPAT_RO: attach this device in read-only mode
* @UBI_COMPAT_PRESERVE: preserve this internal volume - do not touch its
- * physical eraseblocks, don't allow the wear-leveling
- * sub-system to move them
+ * physical eraseblocks, don't allow the wear-leveling unit to move them
* @UBI_COMPAT_REJECT: reject this UBI image
*/
enum {
@@ -123,7 +120,7 @@ enum {
* struct ubi_ec_hdr - UBI erase counter header.
* @magic: erase counter header magic number (%UBI_EC_HDR_MAGIC)
* @version: version of UBI implementation which is supposed to accept this
- * UBI image
+ * UBI image
* @padding1: reserved for future, zeroes
* @ec: the erase counter
* @vid_hdr_offset: where the VID header starts
@@ -134,7 +131,7 @@ enum {
* The erase counter header takes 64 bytes and has a plenty of unused space for
* future usage. The unused fields are zeroed. The @version field is used to
* indicate the version of UBI implementation which is supposed to be able to
- * work with this UBI image. If @version is greater than the current UBI
+ * work with this UBI image. If @version is greater then the current UBI
* version, the image is rejected. This may be useful in future if something
* is changed radically. This field is duplicated in the volume identifier
* header.
@@ -159,23 +156,24 @@ struct ubi_ec_hdr {
* struct ubi_vid_hdr - on-flash UBI volume identifier header.
* @magic: volume identifier header magic number (%UBI_VID_HDR_MAGIC)
* @version: UBI implementation version which is supposed to accept this UBI
- * image (%UBI_VERSION)
+ * image (%UBI_VERSION)
* @vol_type: volume type (%UBI_VID_DYNAMIC or %UBI_VID_STATIC)
* @copy_flag: if this logical eraseblock was copied from another physical
- * eraseblock (for wear-leveling reasons)
+ * eraseblock (for wear-leveling reasons)
* @compat: compatibility of this volume (%0, %UBI_COMPAT_DELETE,
- * %UBI_COMPAT_IGNORE, %UBI_COMPAT_PRESERVE, or %UBI_COMPAT_REJECT)
+ * %UBI_COMPAT_IGNORE, %UBI_COMPAT_PRESERVE, or %UBI_COMPAT_REJECT)
* @vol_id: ID of this volume
* @lnum: logical eraseblock number
- * @padding1: reserved for future, zeroes
+ * @leb_ver: version of this logical eraseblock (IMPORTANT: obsolete, to be
+ * removed, kept only for not breaking older UBI users)
* @data_size: how many bytes of data this logical eraseblock contains
* @used_ebs: total number of used logical eraseblocks in this volume
* @data_pad: how many bytes at the end of this physical eraseblock are not
- * used
+ * used
* @data_crc: CRC checksum of the data stored in this logical eraseblock
- * @padding2: reserved for future, zeroes
+ * @padding1: reserved for future, zeroes
* @sqnum: sequence number
- * @padding3: reserved for future, zeroes
+ * @padding2: reserved for future, zeroes
* @hdr_crc: volume identifier header CRC checksum
*
* The @sqnum is the value of the global sequence counter at the time when this
@@ -186,7 +184,7 @@ struct ubi_ec_hdr {
* (sequence number) is used to distinguish between older and newer versions of
* logical eraseblocks.
*
- * There are 2 situations when there may be more than one physical eraseblock
+ * There are 2 situations when there may be more then one physical eraseblock
* corresponding to the same logical eraseblock, i.e., having the same @vol_id
* and @lnum values in the volume identifier header. Suppose we have a logical
* eraseblock L and it is mapped to the physical eraseblock P.
@@ -223,6 +221,10 @@ struct ubi_ec_hdr {
* checksum is correct, this physical eraseblock is selected (P1). Otherwise
* the older one (P) is selected.
*
+ * Note, there is an obsolete @leb_ver field which was used instead of @sqnum
+ * in the past. But it is not used anymore and we keep it in order to be able
+ * to deal with old UBI images. It will be removed at some point.
+ *
* There are 2 sorts of volumes in UBI: user volumes and internal volumes.
* Internal volumes are not seen from outside and are used for various internal
* UBI purposes. In this implementation there is only one internal volume - the
@@ -243,9 +245,9 @@ struct ubi_ec_hdr {
* The @data_crc field contains the CRC checksum of the contents of the logical
* eraseblock if this is a static volume. In case of dynamic volumes, it does
* not contain the CRC checksum as a rule. The only exception is when the
- * data of the physical eraseblock was moved by the wear-leveling sub-system,
- * then the wear-leveling sub-system calculates the data CRC and stores it in
- * the @data_crc field. And of course, the @copy_flag is %in this case.
+ * data of the physical eraseblock was moved by the wear-leveling unit, then
+ * the wear-leveling unit calculates the data CRC and stores it in the
+ * @data_crc field. And of course, the @copy_flag is %in this case.
*
* The @data_size field is used only for static volumes because UBI has to know
* how many bytes of data are stored in this eraseblock. For dynamic volumes,
@@ -272,14 +274,14 @@ struct ubi_vid_hdr {
__u8 compat;
__be32 vol_id;
__be32 lnum;
- __be32 leb_ver;
+ __be32 leb_ver; /* obsolete, to be removed, don't use */
__be32 data_size;
__be32 used_ebs;
__be32 data_pad;
__be32 data_crc;
- __u8 padding2[4];
+ __u8 padding1[4];
__be64 sqnum;
- __u8 padding3[12];
+ __u8 padding2[12];
__be32 hdr_crc;
} __attribute__ ((packed));
@@ -364,7 +366,4 @@ struct ubi_vtbl_record {
__be32 crc;
} __attribute__ ((packed));
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
#endif /* !__UBI_MEDIA_H__ */
-