set_disk_ro(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ set_disk_ro β€” kernel API manual ✨

okay so bestie, welcome to the set_disk_ro(9) page πŸ’… this is the one that flips a gendisk between "read-only, don't touch" and "read/write, go off" β€” iconic behavior tbh πŸŽ€


🌸 NAME 🌸

set_disk_ro β€” set a gendisk read-only

πŸ¦‹ SYNOPSIS πŸ¦‹

void set_disk_ro (struct gendisk *disk , bool read_only );

πŸ’– ARGUMENTS πŸ’–

  • disk β€” the gendisk you're operating on 🫢 like, this is the disk we're doing stuff to.
  • read_only β€” true means set the disk read-only, false means set the disk read/write. two settings, one bool, no cap ✨

🧚 DESCRIPTION 🧚

so what does this actually do? set_disk_ro is the function you use to indicate whether a given disk device should have its read-only flag set. that's the whole vibe check right there πŸ’«

typically, device drivers use set_disk_ro to indicate whether the underlying physical device is write-protected β€” like, "hey, this thing won't let you write to it," and now the disk knows that too πŸ”₯

πŸ‘‘ SEE ALSO πŸ‘‘

kernel file ./block/genhd.c plus the whole friend group:


and that's the page, bestie πŸ’œ this one lives in ./block and it's dated October 2026 β€” so yeah, mark your calendar, the future is calling and it's giving read-only flag energy 🌈⭐ periodt.

πŸ“¦ where this page comes from