mtd_pairing_info_to_wunit(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… mtd_pairing_info_to_wunit(9) β€” from the Kernel API Manual, bestie ✨

okay so picture this: it's the Kernel API Manual, and today's main character is mtd_pairing_info_to_wunit. she's giving reverse-lookup royalty, and honestly? iconic. let's get into it πŸŽ€

✨ NAME ✨

mtd_pairing_info_to_wunit β€” get wunit from pairing information πŸ¦‹

✨ SYNOPSIS ✨

int mtd_pairing_info_to_wunit (struct mtd_info *mtd , const struct
mtd_pairing_info *info );

✨ ARGUMENTS ✨

  • mtd β€” pointer to the new MTD device info structure, bestie πŸ’–
  • info β€” the pairing information struct, aka the little vibe check packet you're feeding in 🌸

✨ DESCRIPTION ✨

so this function returns a positive number that represents the wunit associated to the info struct β€” or, if things go sideways, a negative error code 😭 that's the whole deal, no cap.

think of it as the reverse of mtd_wunit_to_pairing_info πŸ” which is lowkey so useful when you wanna iterate over all the wunits of a given pair (peep the mtd_wunit_to_pairing_info doc for the deets, iykyk).

she can also be used to only program the first page of each pair β€” like, the page attached to group 0 β€” and that is literally how you use an MLC NAND in software-emulated SLC mode πŸ‘‘βœ¨:

info.group = 0; npairs = mtd_wunit_per_eb(mtd) /
mtd_pairing_groups(mtd); for (info.pair = 0; info.pair < npairs;
info.pair++) { wunit = mtd_pairing_info_to_wunit(mtd, info);
mtd_write(mtd, mtd_wunit_to_offset(mtd, blkoffs, wunit), mtd->writesize,
retlen, buf + (i * mtd->writesize)); }

she ate that fr fr πŸ”₯

✨ SEE ALSO ✨

kernel file ./drivers/mtd/mtdcore.c πŸ‘€ plus the whole friend group, all of them, no one left behind 🫢:

mtd_wunit_to_pairing_info(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. sourced from ./drivers/mtd, dated October 2026, Kernel API Manual edition β€” mwah, go touch some registers πŸ’…βœ¨

πŸ“¦ where this page comes from