mtd_wunit_to_pairing_info(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… mtd_wunit_to_pairing_info(9) β€” like, the kernel API manual, bestie ✨

okay so real talk, this one lives in the Kernel API Manual and it's called mtd_wunit_to_pairing_info(9). It's giving "niche but iconic" πŸ’– Let's go.


🌸 NAME 🌸

mtd_wunit_to_pairing_info β€” get the pairing info of a wunit. that's it, that's the whole vibe πŸŽ€


✨ SYNOPSIS ✨

int mtd_wunit_to_pairing_info (struct mtd_info *mtd , int wunit , struct
mtd_pairing_info *info );

no cap, that's the exact signature, keep it exactly like that πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • mtd β€” pointer to the new MTD device info structure. it's the main character here, lowkey 🫢
  • wunit β€” the write unit we're interested in. yes, this specific one πŸ‘€
  • info β€” the returned pairing information. it gets filled in for you, slay 🌈

πŸ’€ DESCRIPTION πŸ’€

So you call this to retrieve the pairing information associated with the wunit. It's mainly useful when you're dealing with MLC/TLC NANDs, where pages can be paired together 😭 and where programming a page may influence the page it's paired with. messy, I know.

The notion of page gets replaced by the term wunit (write-unit) so everything stays consistent with the ->writesize field. consistency is the blueprint, periodt ✨

The wunit argument can be extracted from an absolute offset using mtd_offset_to_wunit. And info gets filled with the pairing information attached to wunit. easy πŸ“

From that pairing info, the MTD user can find all the wunits paired with wunit using this loop:

for (i = 0; i < mtd_pairing_groups(mtd); i++) { info.pair = i;
mtd_pairing_info_to_wunit(mtd, info); ...  }
literally copy that loop verbatim, it's not decorative, bestie πŸ’œ

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./drivers/mtd/mtdcore.c β€” plus the whole friend group, and honestly they all ate:

mtd_pairing_info_to_wunit(9), mtd_pairing_groups(9), add_mtd_device(9), del_mtd_device(9), mtd_device_parse_register(9), mtd_device_unregister(9), register_mtd_user(9), unregister_mtd_user(9), get_mtd_device(9), of_get_mtd_device_by_node(9), get_mtd_device_nm(9), mtd_ooblayout_ecc(9), mtd_ooblayout_free(9), mtd_ooblayout_find_region(9), mtd_ooblayout_find_eccregion(9), mtd_ooblayout_get_bytes(9), mtd_ooblayout_set_bytes(9), mtd_ooblayout_count_bytes(9), mtd_ooblayout_get_eccbytes(9), mtd_ooblayout_set_eccbytes(9), mtd_ooblayout_get_databytes(9), mtd_ooblayout_set_databytes(9), mtd_ooblayout_count_freebytes(9), mtd_ooblayout_count_eccbytes(9), mtd_kmalloc_up_to(9)


and that's the whole page, bestie 🧚 it comes from ./drivers/mtd, dated October 2026, and it's filed under mtd_wunit_to_pairing_info(9) β€” iykyk πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from