fix blockdev --getro for sr, sd, ide-floppy devs
PATCH 1/1 fix blockdev --getro for sr, sd, ide-floppy devs
This 2.6.1 patch works by setting gendisk->policy to the correct value during initialization as the various drivers decide whether or not the disk is writeable. This patch persuades "blockdev --getro ..." to correctly report the read-only state of a newly inserted disk. This patch applies to sr.c, sd.c and ide-floppy.c. ide-cd.c already has this functionality built into it.
Using an Iomega Zip drive as the test case...
Without the patch, I always see:
$ sudo blockdev --getro /dev/sda 0 $
That's only correct for writeable disks though. Only when the patch is applied do I see a write-protected disk described correctly:
$ sudo blockdev --getro /dev/sda 1 $
--John McKell