disk_check_media_change(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… disk_check_media_change(9) β€” the kernel API manual, bestie edition πŸŽ€

okay so picture this: it's a page out of the Kernel API Manual, and it's all about one tiny lil function that answers the question every removable-media disk has been dying to ask β€” did somebody swap the disc while I wasn't looking?? πŸ‘€βœ¨


✨ NAME ✨

disk_check_media_change β€” check if a removable media has been changed πŸ¦‹

like, literally that's the whole job. vibe check for your media. πŸ”πŸ’–


🌸 SYNOPSIS 🌸

bool disk_check_media_change (struct gendisk *disk );

yes bestie that's a bool β€” we're getting a true or a false, no in-between, no "it depends", no 🎲 chaos. icon behaviour fr fr. πŸ‘‘


πŸŽ€ ARGUMENTS πŸŽ€

  • disk β€” the gendisk you wanna check. that's it. that's the whole argument list. one (1) gendisk, hand it over and let the function cook. πŸ“

πŸ’œ DESCRIPTION πŸ’œ

so here's the tea β˜•: this function looks at your removable media and tells you whether it changed.

  • If the media has been changed β†’ it returns true and marks the disk for a partition rescan. πŸŽ‰πŸ”₯ two-for-one, no cap.
  • If the media did not change β†’ it returns false. that's it. nothing happens. go home. πŸ’€

the whole "marks the disk for a partition rescan" part is lowkey the main character energy of this function β€” you don't just get a yes/no, you get the disk queued up to get looked at again. periodt. πŸ‘‘βœ¨


🌈 SEE ALSO 🌈

the whole squad lives in the kernel file ./block/disk-events.c β€” go say hi:


🫢 friendly reminder: this page is filed under ./block and it's dated October 2026 β€” so yes, the future called, and it's still checking whether you swapped the disc. πŸ’…βœ¨

go off bestie, may all your media changes be detected πŸŒΈπŸŽ€πŸ¦‹

πŸ“¦ where this page comes from