ubi_leb_map(9)
π ubi_leb_map(9) β from the Kernel API Manual
ok so picture this: you're deep in the UBI lore (that's Unsorted Block Images, iykyk) and you've got an un-mapped logical eraseblock just sitting there with no physical home. bestie, this function is literally the matchmaker β¨
πΈ NAME πΈ
ubi_leb_map β maps a logical eraseblock to a physical eraseblock. it's giving "i know a guy." π
π SYNOPSIS π
int ubi_leb_map (struct ubi_volume_desc *desc , int lnum );
π¦ ARGUMENTS π¦
descβ the volume descriptor, aka your VIP pass to the volume ποΈlnumβ the logical eraseblock number, aka which block we're talking about
β DESCRIPTION β
okay so here's the tea π: this function maps an un-mapped logical eraseblock lnum to a physical eraseblock. and after a successful invocation, the logical eraseblock lnum will be empty (containing only 0xFF bytes) and mapped to a physical eraseblock β even if an unclean reboot happens ππ₯ which honestly? iconic durability. no cap.
now the return values, because we love a receipts moment:
- returns zero in case of success π«Ά
-EBADFif the volume is damaged because of an interrupted update π (yeah, that one hurts)-EBADMSGif the logical eraseblock is already mapped π (someone got there first!)- other negative error codes in case of other failures β so basically, negative = not your day, zero = slay π
π SEE ALSO π
Kernel file ./drivers/mtd/ubi/kapi.c plus the whole friend group:
ubi_do_get_device_info(9), ubi_get_device_info(9), ubi_do_get_volume_info(9), ubi_get_volume_info(9), ubi_open_volume(9), ubi_open_volume_nm(9), ubi_get_num_by_path(9), ubi_open_volume_path(9), ubi_close_volume(9), leb_read_sanity_check(9), ubi_leb_read(9), ubi_leb_read_sg(9), ubi_leb_write(9), ubi_leb_erase(9), ubi_leb_unmap(9), ubi_is_mapped(9), ubi_sync(9), ubi_register_volume_notifier(9), ubi_unregister_volume_notifier(9)
π«Ά and that's the whole page! brought to you by ./drivers/mtd/ubi, dated October 2026 β stay mapped, stay empty, stay 0xFF πβ¨π
π¦ 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