ubi-media.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (c) International Business Machines Corp., 2006
  4. *
  5. * Authors: Artem Bityutskiy (Битюцкий Артём)
  6. * Thomas Gleixner
  7. * Frank Haverkamp
  8. * Oliver Lohmann
  9. * Andreas Arnez
  10. */
  11. /*
  12. * This file defines the layout of UBI headers and all the other UBI on-flash
  13. * data structures.
  14. */
  15. #ifndef __UBI_MEDIA_H__
  16. #define __UBI_MEDIA_H__
  17. #include <asm/byteorder.h>
  18. /* The version of UBI images supported by this implementation */
  19. #define UBI_VERSION 1
  20. /* The highest erase counter value supported by this implementation */
  21. #define UBI_MAX_ERASECOUNTER 0x7FFFFFFF
  22. /* The initial CRC32 value used when calculating CRC checksums */
  23. #define UBI_CRC32_INIT 0xFFFFFFFFU
  24. /* Erase counter header magic number (ASCII "UBI#") */
  25. #define UBI_EC_HDR_MAGIC 0x55424923
  26. /* Volume identifier header magic number (ASCII "UBI!") */
  27. #define UBI_VID_HDR_MAGIC 0x55424921
  28. /*
  29. * Volume type constants used in the volume identifier header.
  30. *
  31. * @UBI_VID_DYNAMIC: dynamic volume
  32. * @UBI_VID_STATIC: static volume
  33. */
  34. enum {
  35. UBI_VID_DYNAMIC = 1,
  36. UBI_VID_STATIC = 2
  37. };
  38. /*
  39. * Volume flags used in the volume table record.
  40. *
  41. * @UBI_VTBL_AUTORESIZE_FLG: auto-resize this volume
  42. * @UBI_VTBL_SKIP_CRC_CHECK_FLG: skip the CRC check done on a static volume at
  43. * open time. Should only be set on volumes that
  44. * are used by upper layers doing this kind of
  45. * check. Main use-case for this flag is
  46. * boot-time reduction
  47. *
  48. * %UBI_VTBL_AUTORESIZE_FLG flag can be set only for one volume in the volume
  49. * table. UBI automatically re-sizes the volume which has this flag and makes
  50. * the volume to be of largest possible size. This means that if after the
  51. * initialization UBI finds out that there are available physical eraseblocks
  52. * present on the device, it automatically appends all of them to the volume
  53. * (the physical eraseblocks reserved for bad eraseblocks handling and other
  54. * reserved physical eraseblocks are not taken). So, if there is a volume with
  55. * the %UBI_VTBL_AUTORESIZE_FLG flag set, the amount of available logical
  56. * eraseblocks will be zero after UBI is loaded, because all of them will be
  57. * reserved for this volume. Note, the %UBI_VTBL_AUTORESIZE_FLG bit is cleared
  58. * after the volume had been initialized.
  59. *
  60. * The auto-resize feature is useful for device production purposes. For
  61. * example, different NAND flash chips may have different amount of initial bad
  62. * eraseblocks, depending of particular chip instance. Manufacturers of NAND
  63. * chips usually guarantee that the amount of initial bad eraseblocks does not
  64. * exceed certain percent, e.g. 2%. When one creates an UBI image which will be
  65. * flashed to the end devices in production, he does not know the exact amount
  66. * of good physical eraseblocks the NAND chip on the device will have, but this
  67. * number is required to calculate the volume sized and put them to the volume
  68. * table of the UBI image. In this case, one of the volumes (e.g., the one
  69. * which will store the root file system) is marked as "auto-resizable", and
  70. * UBI will adjust its size on the first boot if needed.
  71. *
  72. * Note, first UBI reserves some amount of physical eraseblocks for bad
  73. * eraseblock handling, and then re-sizes the volume, not vice-versa. This
  74. * means that the pool of reserved physical eraseblocks will always be present.
  75. */
  76. enum {
  77. UBI_VTBL_AUTORESIZE_FLG = 0x01,
  78. UBI_VTBL_SKIP_CRC_CHECK_FLG = 0x02,
  79. };
  80. /*
  81. * Compatibility constants used by internal volumes.
  82. *
  83. * @UBI_COMPAT_DELETE: delete this internal volume before anything is written
  84. * to the flash
  85. * @UBI_COMPAT_RO: attach this device in read-only mode
  86. * @UBI_COMPAT_PRESERVE: preserve this internal volume - do not touch its
  87. * physical eraseblocks, don't allow the wear-leveling
  88. * sub-system to move them
  89. * @UBI_COMPAT_REJECT: reject this UBI image
  90. */
  91. enum {
  92. UBI_COMPAT_DELETE = 1,
  93. UBI_COMPAT_RO = 2,
  94. UBI_COMPAT_PRESERVE = 4,
  95. UBI_COMPAT_REJECT = 5
  96. };
  97. /* Sizes of UBI headers */
  98. #define UBI_EC_HDR_SIZE sizeof(struct ubi_ec_hdr)
  99. #define UBI_VID_HDR_SIZE sizeof(struct ubi_vid_hdr)
  100. /* Sizes of UBI headers without the ending CRC */
  101. #define UBI_EC_HDR_SIZE_CRC (UBI_EC_HDR_SIZE - sizeof(__be32))
  102. #define UBI_VID_HDR_SIZE_CRC (UBI_VID_HDR_SIZE - sizeof(__be32))
  103. /**
  104. * struct ubi_ec_hdr - UBI erase counter header.
  105. * @magic: erase counter header magic number (%UBI_EC_HDR_MAGIC)
  106. * @version: version of UBI implementation which is supposed to accept this
  107. * UBI image
  108. * @padding1: reserved for future, zeroes
  109. * @ec: the erase counter
  110. * @vid_hdr_offset: where the VID header starts
  111. * @data_offset: where the user data start
  112. * @image_seq: image sequence number
  113. * @padding2: reserved for future, zeroes
  114. * @hdr_crc: erase counter header CRC checksum
  115. *
  116. * The erase counter header takes 64 bytes and has a plenty of unused space for
  117. * future usage. The unused fields are zeroed. The @version field is used to
  118. * indicate the version of UBI implementation which is supposed to be able to
  119. * work with this UBI image. If @version is greater than the current UBI
  120. * version, the image is rejected. This may be useful in future if something
  121. * is changed radically. This field is duplicated in the volume identifier
  122. * header.
  123. *
  124. * The @vid_hdr_offset and @data_offset fields contain the offset of the the
  125. * volume identifier header and user data, relative to the beginning of the
  126. * physical eraseblock. These values have to be the same for all physical
  127. * eraseblocks.
  128. *
  129. * The @image_seq field is used to validate a UBI image that has been prepared
  130. * for a UBI device. The @image_seq value can be any value, but it must be the
  131. * same on all eraseblocks. UBI will ensure that all new erase counter headers
  132. * also contain this value, and will check the value when attaching the flash.
  133. * One way to make use of @image_seq is to increase its value by one every time
  134. * an image is flashed over an existing image, then, if the flashing does not
  135. * complete, UBI will detect the error when attaching the media.
  136. */
  137. struct ubi_ec_hdr {
  138. __be32 magic;
  139. __u8 version;
  140. __u8 padding1[3];
  141. __be64 ec; /* Warning: the current limit is 31-bit anyway! */
  142. __be32 vid_hdr_offset;
  143. __be32 data_offset;
  144. __be32 image_seq;
  145. __u8 padding2[32];
  146. __be32 hdr_crc;
  147. } __packed;
  148. /**
  149. * struct ubi_vid_hdr - on-flash UBI volume identifier header.
  150. * @magic: volume identifier header magic number (%UBI_VID_HDR_MAGIC)
  151. * @version: UBI implementation version which is supposed to accept this UBI
  152. * image (%UBI_VERSION)
  153. * @vol_type: volume type (%UBI_VID_DYNAMIC or %UBI_VID_STATIC)
  154. * @copy_flag: if this logical eraseblock was copied from another physical
  155. * eraseblock (for wear-leveling reasons)
  156. * @compat: compatibility of this volume (%0, %UBI_COMPAT_DELETE,
  157. * %UBI_COMPAT_IGNORE, %UBI_COMPAT_PRESERVE, or %UBI_COMPAT_REJECT)
  158. * @vol_id: ID of this volume
  159. * @lnum: logical eraseblock number
  160. * @padding1: reserved for future, zeroes
  161. * @data_size: how many bytes of data this logical eraseblock contains
  162. * @used_ebs: total number of used logical eraseblocks in this volume
  163. * @data_pad: how many bytes at the end of this physical eraseblock are not
  164. * used
  165. * @data_crc: CRC checksum of the data stored in this logical eraseblock
  166. * @padding2: reserved for future, zeroes
  167. * @sqnum: sequence number
  168. * @padding3: reserved for future, zeroes
  169. * @hdr_crc: volume identifier header CRC checksum
  170. *
  171. * The @sqnum is the value of the global sequence counter at the time when this
  172. * VID header was created. The global sequence counter is incremented each time
  173. * UBI writes a new VID header to the flash, i.e. when it maps a logical
  174. * eraseblock to a new physical eraseblock. The global sequence counter is an
  175. * unsigned 64-bit integer and we assume it never overflows. The @sqnum
  176. * (sequence number) is used to distinguish between older and newer versions of
  177. * logical eraseblocks.
  178. *
  179. * There are 2 situations when there may be more than one physical eraseblock
  180. * corresponding to the same logical eraseblock, i.e., having the same @vol_id
  181. * and @lnum values in the volume identifier header. Suppose we have a logical
  182. * eraseblock L and it is mapped to the physical eraseblock P.
  183. *
  184. * 1. Because UBI may erase physical eraseblocks asynchronously, the following
  185. * situation is possible: L is asynchronously erased, so P is scheduled for
  186. * erasure, then L is written to,i.e. mapped to another physical eraseblock P1,
  187. * so P1 is written to, then an unclean reboot happens. Result - there are 2
  188. * physical eraseblocks P and P1 corresponding to the same logical eraseblock
  189. * L. But P1 has greater sequence number, so UBI picks P1 when it attaches the
  190. * flash.
  191. *
  192. * 2. From time to time UBI moves logical eraseblocks to other physical
  193. * eraseblocks for wear-leveling reasons. If, for example, UBI moves L from P
  194. * to P1, and an unclean reboot happens before P is physically erased, there
  195. * are two physical eraseblocks P and P1 corresponding to L and UBI has to
  196. * select one of them when the flash is attached. The @sqnum field says which
  197. * PEB is the original (obviously P will have lower @sqnum) and the copy. But
  198. * it is not enough to select the physical eraseblock with the higher sequence
  199. * number, because the unclean reboot could have happen in the middle of the
  200. * copying process, so the data in P is corrupted. It is also not enough to
  201. * just select the physical eraseblock with lower sequence number, because the
  202. * data there may be old (consider a case if more data was added to P1 after
  203. * the copying). Moreover, the unclean reboot may happen when the erasure of P
  204. * was just started, so it result in unstable P, which is "mostly" OK, but
  205. * still has unstable bits.
  206. *
  207. * UBI uses the @copy_flag field to indicate that this logical eraseblock is a
  208. * copy. UBI also calculates data CRC when the data is moved and stores it at
  209. * the @data_crc field of the copy (P1). So when UBI needs to pick one physical
  210. * eraseblock of two (P or P1), the @copy_flag of the newer one (P1) is
  211. * examined. If it is cleared, the situation* is simple and the newer one is
  212. * picked. If it is set, the data CRC of the copy (P1) is examined. If the CRC
  213. * checksum is correct, this physical eraseblock is selected (P1). Otherwise
  214. * the older one (P) is selected.
  215. *
  216. * There are 2 sorts of volumes in UBI: user volumes and internal volumes.
  217. * Internal volumes are not seen from outside and are used for various internal
  218. * UBI purposes. In this implementation there is only one internal volume - the
  219. * layout volume. Internal volumes are the main mechanism of UBI extensions.
  220. * For example, in future one may introduce a journal internal volume. Internal
  221. * volumes have their own reserved range of IDs.
  222. *
  223. * The @compat field is only used for internal volumes and contains the "degree
  224. * of their compatibility". It is always zero for user volumes. This field
  225. * provides a mechanism to introduce UBI extensions and to be still compatible
  226. * with older UBI binaries. For example, if someone introduced a journal in
  227. * future, he would probably use %UBI_COMPAT_DELETE compatibility for the
  228. * journal volume. And in this case, older UBI binaries, which know nothing
  229. * about the journal volume, would just delete this volume and work perfectly
  230. * fine. This is similar to what Ext2fs does when it is fed by an Ext3fs image
  231. * - it just ignores the Ext3fs journal.
  232. *
  233. * The @data_crc field contains the CRC checksum of the contents of the logical
  234. * eraseblock if this is a static volume. In case of dynamic volumes, it does
  235. * not contain the CRC checksum as a rule. The only exception is when the
  236. * data of the physical eraseblock was moved by the wear-leveling sub-system,
  237. * then the wear-leveling sub-system calculates the data CRC and stores it in
  238. * the @data_crc field. And of course, the @copy_flag is %in this case.
  239. *
  240. * The @data_size field is used only for static volumes because UBI has to know
  241. * how many bytes of data are stored in this eraseblock. For dynamic volumes,
  242. * this field usually contains zero. The only exception is when the data of the
  243. * physical eraseblock was moved to another physical eraseblock for
  244. * wear-leveling reasons. In this case, UBI calculates CRC checksum of the
  245. * contents and uses both @data_crc and @data_size fields. In this case, the
  246. * @data_size field contains data size.
  247. *
  248. * The @used_ebs field is used only for static volumes and indicates how many
  249. * eraseblocks the data of the volume takes. For dynamic volumes this field is
  250. * not used and always contains zero.
  251. *
  252. * The @data_pad is calculated when volumes are created using the alignment
  253. * parameter. So, effectively, the @data_pad field reduces the size of logical
  254. * eraseblocks of this volume. This is very handy when one uses block-oriented
  255. * software (say, cramfs) on top of the UBI volume.
  256. */
  257. struct ubi_vid_hdr {
  258. __be32 magic;
  259. __u8 version;
  260. __u8 vol_type;
  261. __u8 copy_flag;
  262. __u8 compat;
  263. __be32 vol_id;
  264. __be32 lnum;
  265. __u8 padding1[4];
  266. __be32 data_size;
  267. __be32 used_ebs;
  268. __be32 data_pad;
  269. __be32 data_crc;
  270. __u8 padding2[4];
  271. __be64 sqnum;
  272. __u8 padding3[12];
  273. __be32 hdr_crc;
  274. } __packed;
  275. /* Internal UBI volumes count */
  276. #define UBI_INT_VOL_COUNT 1
  277. /*
  278. * Starting ID of internal volumes: 0x7fffefff.
  279. * There is reserved room for 4096 internal volumes.
  280. */
  281. #define UBI_INTERNAL_VOL_START (0x7FFFFFFF - 4096)
  282. /* The layout volume contains the volume table */
  283. #define UBI_LAYOUT_VOLUME_ID UBI_INTERNAL_VOL_START
  284. #define UBI_LAYOUT_VOLUME_TYPE UBI_VID_DYNAMIC
  285. #define UBI_LAYOUT_VOLUME_ALIGN 1
  286. #define UBI_LAYOUT_VOLUME_EBS 2
  287. #define UBI_LAYOUT_VOLUME_NAME "layout volume"
  288. #define UBI_LAYOUT_VOLUME_COMPAT UBI_COMPAT_REJECT
  289. /* The maximum number of volumes per one UBI device */
  290. #define UBI_MAX_VOLUMES 128
  291. /* The maximum volume name length */
  292. #define UBI_VOL_NAME_MAX 127
  293. /* Size of the volume table record */
  294. #define UBI_VTBL_RECORD_SIZE sizeof(struct ubi_vtbl_record)
  295. /* Size of the volume table record without the ending CRC */
  296. #define UBI_VTBL_RECORD_SIZE_CRC (UBI_VTBL_RECORD_SIZE - sizeof(__be32))
  297. /**
  298. * struct ubi_vtbl_record - a record in the volume table.
  299. * @reserved_pebs: how many physical eraseblocks are reserved for this volume
  300. * @alignment: volume alignment
  301. * @data_pad: how many bytes are unused at the end of the each physical
  302. * eraseblock to satisfy the requested alignment
  303. * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME)
  304. * @upd_marker: if volume update was started but not finished
  305. * @name_len: volume name length
  306. * @name: the volume name
  307. * @flags: volume flags (%UBI_VTBL_AUTORESIZE_FLG)
  308. * @padding: reserved, zeroes
  309. * @crc: a CRC32 checksum of the record
  310. *
  311. * The volume table records are stored in the volume table, which is stored in
  312. * the layout volume. The layout volume consists of 2 logical eraseblock, each
  313. * of which contains a copy of the volume table (i.e., the volume table is
  314. * duplicated). The volume table is an array of &struct ubi_vtbl_record
  315. * objects indexed by the volume ID.
  316. *
  317. * If the size of the logical eraseblock is large enough to fit
  318. * %UBI_MAX_VOLUMES records, the volume table contains %UBI_MAX_VOLUMES
  319. * records. Otherwise, it contains as many records as it can fit (i.e., size of
  320. * logical eraseblock divided by sizeof(struct ubi_vtbl_record)).
  321. *
  322. * The @upd_marker flag is used to implement volume update. It is set to %1
  323. * before update and set to %0 after the update. So if the update operation was
  324. * interrupted, UBI knows that the volume is corrupted.
  325. *
  326. * The @alignment field is specified when the volume is created and cannot be
  327. * later changed. It may be useful, for example, when a block-oriented file
  328. * system works on top of UBI. The @data_pad field is calculated using the
  329. * logical eraseblock size and @alignment. The alignment must be multiple to the
  330. * minimal flash I/O unit. If @alignment is 1, all the available space of
  331. * the physical eraseblocks is used.
  332. *
  333. * Empty records contain all zeroes and the CRC checksum of those zeroes.
  334. */
  335. struct ubi_vtbl_record {
  336. __be32 reserved_pebs;
  337. __be32 alignment;
  338. __be32 data_pad;
  339. __u8 vol_type;
  340. __u8 upd_marker;
  341. __be16 name_len;
  342. #ifndef __UBOOT__
  343. __u8 name[UBI_VOL_NAME_MAX+1];
  344. #else
  345. char name[UBI_VOL_NAME_MAX+1];
  346. #endif
  347. __u8 flags;
  348. __u8 padding[23];
  349. __be32 crc;
  350. } __packed;
  351. /* UBI fastmap on-flash data structures */
  352. #define UBI_FM_SB_VOLUME_ID (UBI_LAYOUT_VOLUME_ID + 1)
  353. #define UBI_FM_DATA_VOLUME_ID (UBI_LAYOUT_VOLUME_ID + 2)
  354. /* fastmap on-flash data structure format version */
  355. #define UBI_FM_FMT_VERSION 1
  356. #define UBI_FM_SB_MAGIC 0x7B11D69F
  357. #define UBI_FM_HDR_MAGIC 0xD4B82EF7
  358. #define UBI_FM_VHDR_MAGIC 0xFA370ED1
  359. #define UBI_FM_POOL_MAGIC 0x67AF4D08
  360. #define UBI_FM_EBA_MAGIC 0xf0c040a8
  361. /* A fastmap supber block can be located between PEB 0 and
  362. * UBI_FM_MAX_START */
  363. #define UBI_FM_MAX_START 64
  364. /* A fastmap can use up to UBI_FM_MAX_BLOCKS PEBs */
  365. #define UBI_FM_MAX_BLOCKS 32
  366. /* 5% of the total number of PEBs have to be scanned while attaching
  367. * from a fastmap.
  368. * But the size of this pool is limited to be between UBI_FM_MIN_POOL_SIZE and
  369. * UBI_FM_MAX_POOL_SIZE */
  370. #define UBI_FM_MIN_POOL_SIZE 8
  371. #define UBI_FM_MAX_POOL_SIZE 256
  372. /**
  373. * struct ubi_fm_sb - UBI fastmap super block
  374. * @magic: fastmap super block magic number (%UBI_FM_SB_MAGIC)
  375. * @version: format version of this fastmap
  376. * @data_crc: CRC over the fastmap data
  377. * @used_blocks: number of PEBs used by this fastmap
  378. * @block_loc: an array containing the location of all PEBs of the fastmap
  379. * @block_ec: the erase counter of each used PEB
  380. * @sqnum: highest sequence number value at the time while taking the fastmap
  381. *
  382. */
  383. struct ubi_fm_sb {
  384. __be32 magic;
  385. __u8 version;
  386. __u8 padding1[3];
  387. __be32 data_crc;
  388. __be32 used_blocks;
  389. __be32 block_loc[UBI_FM_MAX_BLOCKS];
  390. __be32 block_ec[UBI_FM_MAX_BLOCKS];
  391. __be64 sqnum;
  392. __u8 padding2[32];
  393. } __packed;
  394. /**
  395. * struct ubi_fm_hdr - header of the fastmap data set
  396. * @magic: fastmap header magic number (%UBI_FM_HDR_MAGIC)
  397. * @free_peb_count: number of free PEBs known by this fastmap
  398. * @used_peb_count: number of used PEBs known by this fastmap
  399. * @scrub_peb_count: number of to be scrubbed PEBs known by this fastmap
  400. * @bad_peb_count: number of bad PEBs known by this fastmap
  401. * @erase_peb_count: number of bad PEBs which have to be erased
  402. * @vol_count: number of UBI volumes known by this fastmap
  403. */
  404. struct ubi_fm_hdr {
  405. __be32 magic;
  406. __be32 free_peb_count;
  407. __be32 used_peb_count;
  408. __be32 scrub_peb_count;
  409. __be32 bad_peb_count;
  410. __be32 erase_peb_count;
  411. __be32 vol_count;
  412. __u8 padding[4];
  413. } __packed;
  414. /* struct ubi_fm_hdr is followed by two struct ubi_fm_scan_pool */
  415. /**
  416. * struct ubi_fm_scan_pool - Fastmap pool PEBs to be scanned while attaching
  417. * @magic: pool magic numer (%UBI_FM_POOL_MAGIC)
  418. * @size: current pool size
  419. * @max_size: maximal pool size
  420. * @pebs: an array containing the location of all PEBs in this pool
  421. */
  422. struct ubi_fm_scan_pool {
  423. __be32 magic;
  424. __be16 size;
  425. __be16 max_size;
  426. __be32 pebs[UBI_FM_MAX_POOL_SIZE];
  427. __be32 padding[4];
  428. } __packed;
  429. /* ubi_fm_scan_pool is followed by nfree+nused struct ubi_fm_ec records */
  430. /**
  431. * struct ubi_fm_ec - stores the erase counter of a PEB
  432. * @pnum: PEB number
  433. * @ec: ec of this PEB
  434. */
  435. struct ubi_fm_ec {
  436. __be32 pnum;
  437. __be32 ec;
  438. } __packed;
  439. /**
  440. * struct ubi_fm_volhdr - Fastmap volume header
  441. * it identifies the start of an eba table
  442. * @magic: Fastmap volume header magic number (%UBI_FM_VHDR_MAGIC)
  443. * @vol_id: volume id of the fastmapped volume
  444. * @vol_type: type of the fastmapped volume
  445. * @data_pad: data_pad value of the fastmapped volume
  446. * @used_ebs: number of used LEBs within this volume
  447. * @last_eb_bytes: number of bytes used in the last LEB
  448. */
  449. struct ubi_fm_volhdr {
  450. __be32 magic;
  451. __be32 vol_id;
  452. __u8 vol_type;
  453. __u8 padding1[3];
  454. __be32 data_pad;
  455. __be32 used_ebs;
  456. __be32 last_eb_bytes;
  457. __u8 padding2[8];
  458. } __packed;
  459. /* struct ubi_fm_volhdr is followed by one struct ubi_fm_eba records */
  460. /**
  461. * struct ubi_fm_eba - denotes an association beween a PEB and LEB
  462. * @magic: EBA table magic number
  463. * @reserved_pebs: number of table entries
  464. * @pnum: PEB number of LEB (LEB is the index)
  465. */
  466. struct ubi_fm_eba {
  467. __be32 magic;
  468. __be32 reserved_pebs;
  469. __be32 pnum[0];
  470. } __packed;
  471. #endif /* !__UBI_MEDIA_H__ */