read-only: minor cleanup
PATCH 1/2 read-only: minor cleanup
Really use read-only flags for opening the file when asked for read-only
Signed-off-by Naphtali Sprei <[email protected]>
--- qemu-nbd.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
qemu-nbd.c +1 -0
@@ -258,6 +258,7 @@ int main(int argc, char **argv)break ;case 'r' : readonly = true; + flags &=BDRV_O_RDWR ;break ;case 'P' : partition =strtol (optarg, &end,0 );
Signature · 1 line
1.6.3.3
PATCH 2/2 read-only: Another minor cleanup
Don't rely on CDROM hint for read_only attribute
Signed-off-by Naphtali Sprei <[email protected]>
--- hw/scsi-disk.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
hw/scsi-disk.c +1 -2
@@ -612,8 +612,7 @@ static int scsi_disk_emulate_mode_sense(SCSIRequest *req, uint8_t *outbuf) p[1 ] =0 ;/* Default media type. */ p[3 ] =0 ;/* Block descriptor length. */ -if (bdrv_get_type_hint (s->bs) ==BDRV_TYPE_CDROM || -bdrv_is_read_only (s->bs)) { +if (bdrv_is_read_only (s->bs)) { p[2 ] =0x80 ;/* Readonly. */ } p +=4 ;
Signature · 1 line
1.6.3.3
Quoted 3 lines · Naphtali Sprei
case 'r': readonly = true;+ flags &=
BDRV_O_RDWR;
I'm pretty sure a ~ is missing there. :-)
Paolo