qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] read-only: minor cleanup
@ 2010-03-11 14:44 Naphtali Sprei
  2010-03-11 14:44 ` [Qemu-devel] [PATCH 2/2] read-only: Another " Naphtali Sprei
  2010-03-12 12:03 ` [Qemu-devel] Re: [PATCH 1/2] read-only: " Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Naphtali Sprei @ 2010-03-11 14:44 UTC (permalink / raw)
  To: qemu-devel

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

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
---
 qemu-nbd.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/qemu-nbd.c b/qemu-nbd.c
index eac0c21..d803bfd 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -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);
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH 2/2] read-only: Another minor cleanup
  2010-03-11 14:44 [Qemu-devel] [PATCH 1/2] read-only: minor cleanup Naphtali Sprei
@ 2010-03-11 14:44 ` Naphtali Sprei
  2010-03-12 12:03 ` [Qemu-devel] Re: [PATCH 1/2] read-only: " Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Naphtali Sprei @ 2010-03-11 14:44 UTC (permalink / raw)
  To: qemu-devel

Don't rely on CDROM hint for read_only attribute

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
---
 hw/scsi-disk.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 8f7ffc1..5cd6ae6 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -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;
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] Re: [PATCH 1/2] read-only: minor cleanup
  2010-03-11 14:44 [Qemu-devel] [PATCH 1/2] read-only: minor cleanup Naphtali Sprei
  2010-03-11 14:44 ` [Qemu-devel] [PATCH 2/2] read-only: Another " Naphtali Sprei
@ 2010-03-12 12:03 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2010-03-12 12:03 UTC (permalink / raw)
  To: Naphtali Sprei; +Cc: qemu-devel

On 03/11/2010 03:44 PM, Naphtali Sprei wrote:
>           case 'r':
>               readonly = true;
> +            flags &= BDRV_O_RDWR;

I'm pretty sure a ~ is missing there. :-)

Paolo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-12 12:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-11 14:44 [Qemu-devel] [PATCH 1/2] read-only: minor cleanup Naphtali Sprei
2010-03-11 14:44 ` [Qemu-devel] [PATCH 2/2] read-only: Another " Naphtali Sprei
2010-03-12 12:03 ` [Qemu-devel] Re: [PATCH 1/2] read-only: " Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).