|
175 | 175 | #define UBI_IOCRPEB _IOW(UBI_IOC_MAGIC, 4, __s32)
|
176 | 176 | /* Force scrubbing on the specified PEB */
|
177 | 177 | #define UBI_IOCSPEB _IOW(UBI_IOC_MAGIC, 5, __s32)
|
| 178 | +/* Read detailed device erase counter information */ |
| 179 | +#define UBI_IOCECNFO _IOWR(UBI_IOC_MAGIC, 6, struct ubi_ecinfo_req) |
178 | 180 |
|
179 | 181 | /* ioctl commands of the UBI control character device */
|
180 | 182 |
|
@@ -412,6 +414,37 @@ struct ubi_rnvol_req {
|
412 | 414 | } ents[UBI_MAX_RNVOL];
|
413 | 415 | } __packed;
|
414 | 416 |
|
| 417 | +/** |
| 418 | + * struct ubi_ecinfo_req - a data structure used for requesting and receiving |
| 419 | + * erase block counter information from a UBI device. |
| 420 | + * |
| 421 | + * @start: index of first physical erase block to read (in) |
| 422 | + * @length: number of erase counters to read (in) |
| 423 | + * @read_length: number of erase counters that was actually read (out) |
| 424 | + * @padding: reserved for future, not used, has to be zeroed |
| 425 | + * @erase_counters: array of erase counter values (out) |
| 426 | + * |
| 427 | + * This structure is used to retrieve erase counter information for a specified |
| 428 | + * range of PEBs on a UBI device. |
| 429 | + * Erase counters are read from @start and attempts to read @length number of |
| 430 | + * erase counters. |
| 431 | + * The retrieved values are stored in the @erase_counters array. It is the |
| 432 | + * responsibility of the caller to allocate enough memory for storing @length |
| 433 | + * elements in the @erase_counters array. |
| 434 | + * If a block is bad or if the erase counter is unknown the corresponding value |
| 435 | + * in the array will be set to -1. |
| 436 | + * The @read_length field will indicate the number of erase counters actually |
| 437 | + * read. Typically @read_length will be limited due to memory or the number of |
| 438 | + * PEBs on the UBI device. |
| 439 | + */ |
| 440 | +struct ubi_ecinfo_req { |
| 441 | + __s32 start; |
| 442 | + __s32 length; |
| 443 | + __s32 read_length; |
| 444 | + __s8 padding[16]; |
| 445 | + __s32 erase_counters[]; |
| 446 | +} __packed; |
| 447 | + |
415 | 448 | /**
|
416 | 449 | * struct ubi_leb_change_req - a data structure used in atomic LEB change
|
417 | 450 | * requests.
|
|
0 commit comments