STRUCT UBI_DEVICE_INFO(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐Ÿ’… struct ubi_device_info(9) ๐Ÿ’…

okay so this is a page from the Kernel API Manual and it's all about struct ubi_device_info โ€” literally the little data structure that describes a UBI device ๐Ÿฆ‹


โœจ NAME โœจ

struct ubi_device_info โ€” the UBI device description data structure, bestie. that's it, that's the vibe ๐ŸŽ€


๐ŸŒธ SYNOPSIS ๐ŸŒธ

struct ubi_device_info {
    int ubi_num;
    int leb_size;
    int leb_start;
    int min_io_size;
    int max_write_size;
    int ro_mode;
    dev_t cdev;
 };

look at her. seven fields. main character energy ๐Ÿ‘‘


๐Ÿซถ Members ๐Ÿซถ

  • ubi_num โ€” the ubi device number, like her little ID card ๐Ÿชช
  • leb_size โ€” logical eraseblock size on this UBI device, so valid
  • leb_start โ€” where the logical eraseblocks kick off inside the physical eraseblocks (the starting offset, periodt)
  • min_io_size โ€” minimal I/O unit size. tiny but mighty โœจ
  • max_write_size โ€” the max amount of bytes the underlying flash can write at one time (that's the MTD write buffer size, iykyk)
  • ro_mode โ€” flags whether this device is stuck in read-only mode ๐Ÿ™ˆ
  • cdev โ€” the UBI character device major and minor numbers ๐Ÿ’–

๐Ÿ’œ Description ๐Ÿ’œ

heads up: leb_size is the logical eraseblock size that the UBI device itself offers. but volumes of this UBI device may have a smaller logical eraseblock size if their alignment isn't equivalent to 1. so yeah, don't assume, ok? ๐Ÿ’…


so the max_write_size field is describing the flash write maximum write unit. example time: NOR flash lets you change individual bytes, so min_io_size is 1. but no cap, that does not mean NOR flash has to write data byte-by-byte ๐Ÿ˜ญ instead, CFI NOR flashes have a write-buffer of, like, e.g., 64 bytes, and when they're writing large chunks of data they write 64-bytes at a time. obviously that improves write throughput โ€” slay, efficiency ๐Ÿ”ฅ

alsoooo, the MTD device may have N interleaved (striped) flash chips underneath it ๐Ÿ‘€ in that case min_io_size can be the physical min. I/O size of a single flash chip, while max_write_size can be N * min_io_size. math queen ๐Ÿงฎ

and the max_write_size field is always greater or equivalent to min_io_size. e.g., some NOR flashes may have (min_io_size = 1, max_write_size = 64). in contrast, NAND flashes usually have min_io_size = max_write_size = NAND page size. iconic, consistent, no notes โญ


๐ŸŽ€ SEE ALSO ๐ŸŽ€

  • Kernel file ./include/linux/mtd/ubi.h
  • struct ubi_volume_info(9)
  • struct ubi_sgl(9)
  • ubi_sgl_init(9)

ok that's the whole page bestie, go read the kernel file if you want more lore ๐Ÿฆ‹

sign-off time ๐Ÿ’ซ this lil masterpiece lives in ./include/linux/mtd, it's dated October 2026, and it's filed under struct ubi_device_info(9) โ€” mwah, bye ๐Ÿ’‹๐Ÿ‘‘

๐Ÿ“ฆ where this page comes from