tb_nvm_validate(9)
π tb_nvm_validate(9) β the Kernel API Manual, bestie edition π
okay so bestie, we're in the Kernel API Manual today (section 9, if you're keeping track) and the star of the show is tb_nvm_validate. it's giving "one job, does it well" and honestly? we love that for it. π
β¨ NAME β¨
tb_nvm_validate β Validate new NVM image πΈ
like, it checks your new NVM image before anybody commits to anything. vibe check, but for firmware. π
π¦ SYNOPSIS π¦
int tb_nvm_validate (struct tb_nvm *nvm );
one function, one argument, no drama. copy it exactly like that, no cap. π
π ARGUMENTS π
nvmβ the NVM structure. that's it, that's the whole argument list. she's lowkey low-maintenance.
π DESCRIPTION π
so what actually happens? tb_nvm_validate runs vendor specific validation over the new NVM image. meaning: whichever vendor's rules apply, those rules get run. β¨
and the plot twist β it's not a pure read-only little angel. as a side effect, it updates the nvm->buf_data_start and nvm->buf_data_size fields so they match the actual data that's gonna be written to the NVM. so yeah, your struct comes out of this slightly different than it went in. that's the whole point, bestie β it's syncing the struct up with reality. π«Ά
ngl, this is the part you can't skip: the side effect is real and it's documented. don't call this and then act surprised thatbuf_data_startandbuf_data_sizemoved. π
π₯ RETURN π₯
0β validation slayed. successful validation, periodt. π- negative errno β otherwise. so if you get a negative number back, something did not pass and it's literally telling you why in errno form. ππ
π SEE ALSO π
the whole friend group shows up here, so let's give them their moment:
- Kernel file
./drivers/thunderbolt/nvm.c struct tb_nvm_vendor_ops(9)struct tb_nvm_vendor(9)tb_nvm_alloc(9)tb_nvm_read_version(9)tb_nvm_write_headers(9)tb_nvm_add_active(9)tb_nvm_write_buf(9)tb_nvm_add_non_active(9)tb_nvm_free(9)tb_nvm_read_data(9)tb_nvm_write_data(9)
iykyk β that's the entire nvm.c cinematic universe and you will be reading all of them. π§ββοΈ
and that's the whole page!! mwah π β brought to you by ./drivers/thunderbolt, dated October 2026, and yes the date is from the future, don't ask, she's just ahead of her time. πβ
π¦ 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