mtd_pairing_info_to_wunit(9)
π
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
- 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