Skip to contentSkip to conversation

read-only: minor cleanup

PATCH Superseded Naphtali Sprei 2 participants 3 messages Mar 11, 2010 – Mar 12, 2010

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 read-only: minor cleanup

Really use read-only flags for opening the file when asked for read-only

---
 qemu-nbd.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
qemu-nbd.c +1 -0
index eac0c21..d803bfd 100644
@@ -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
#1 lore raw

PATCH 2/2 read-only: Another minor cleanup

Don't rely on CDROM hint for read_only attribute

---
 hw/scsi-disk.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
hw/scsi-disk.c +1 -2
index 8f7ffc1..5cd6ae6 100644
@@ -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