ubi_leb_map(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ 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 🫢
  • -EBADF if the volume is damaged because of an interrupted update πŸ’€ (yeah, that one hurts)
  • -EBADMSG if 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