ubi_eba_read_leb(9)
π ubi_eba_read_leb(9) π
okay so bestie, welcome to the Kernel API Manual entry for ubi_eba_read_leb β yes that's the whole title, yes it's a mouthful, no we're not renaming it, it's iconic as is π
β¨ NAME β¨
ubi_eba_read_leb β the function that reads data. that's it. that's the vibe. π
πΈ SYNOPSIS πΈ
int ubi_eba_read_leb (struct ubi_device *ubi , struct ubi_volume *vol ,
int lnum , void *buf , int offset , int len , int check );
like, look at all those arguments. seven of them. she's high maintenance and we love her for it π
π¦ ARGUMENTS π¦
ubiβ the UBI device description object, aka the main character of the whole device situation πvolβ the volume description object, the little world we're reading from πͺlnumβ the logical eraseblock number, i.e. which block we're eyeing up πbufβ the buffer where the read data gets to live rent-free πoffsetβ where in the block we start reading from, the starting line if you will π¬lenβ how many bytes we're reading. the length. the amount. the whole point πcheckβ the data CRC check flag, our little security guard π‘οΈ
π₯ DESCRIPTION π₯
so here's the tea β β if the logical eraseblock lnum is unmapped, then buf gets filled with 0xFF bytes. no cap, that's just what happens. it's giving "empty but make it 0xFF" π
the check flag only makes sense for static volumes β it forces eraseblock data CRC checking. for dynamic volumes it's just kinda... there. vibing. not doing much π«Ά
now the return values, bestie, pay attention:
- if everything goes great, this function returns zero. slay β¨
- in the case of a static volume, if the data CRC mismatches, you get
-EBADMSGback. rude, but fair π -EBADMSGmay also be returned for any volume type if an ECC error was detected by the MTD device driver. so don't assume it's always the static-volume thing, iykyk π- other negative error codes may be returned in case of other errors. yes, "cored" is what the original says, we're keeping it, it's camp π
ngl bestie, always check your return value. zero is the dream, negatives are the reality check π
β SEE ALSO β
okay this list is LONG and we're listing every single one of them because I would never do you dirty like that π
- the kernel file
./drivers/mtd/ubi/eba.c struct ubi_eba_entry(9)struct ubi_eba_table(9)ubi_next_sqnum(9)ubi_get_compat(9)ubi_eba_get_ldesc(9)ubi_eba_create_table(9)ubi_eba_destroy_table(9)ubi_eba_copy_table(9)ubi_eba_replace_table(9)ltree_lookup(9)ltree_add_entry(9)leb_read_lock(9)leb_read_unlock(9)leb_write_lock(9)leb_write_trylock(9)leb_write_unlock(9)ubi_eba_is_mapped(9)ubi_eba_unmap_leb(9)check_mapping(9)ubi_eba_read_leb_sg(9)try_recover_peb(9)recover_peb(9)try_write_vid_and_data(9)ubi_eba_write_leb(9)ubi_eba_write_leb_st(9)is_error_sane(9)ubi_eba_copy_leb(9)print_rsvd_warning(9)self_check_eba(9)ubi_eba_init(9)
like, that's the whole squad. go read them too, they're all part of the same friend group π§
and that's the page, bestie! π this lil masterpiece lives in ./drivers/mtd/ubi and it's dated October 2026 β so like, future vibes fr fr. mwah, go read some eraseblocks responsibly πβ¨π«Ά
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms