From: juha.riihimaki@nokia.com
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v2 2/2] hw/onenand: reject read-only drives
Date: Thu, 20 Oct 2011 15:53:35 +0300	[thread overview]
Message-ID: <1319115215-21224-3-git-send-email-juha.riihimaki@nokia.com> (raw)
In-Reply-To: <1319115215-21224-1-git-send-email-juha.riihimaki@nokia.com>
From: Juha Riihimäki <juha.riihimaki@nokia.com>
Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
---
 hw/onenand.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/hw/onenand.c b/hw/onenand.c
index 6f68f70..7898da9 100644
--- a/hw/onenand.c
+++ b/hw/onenand.c
@@ -26,6 +26,7 @@
 #include "memory.h"
 #include "exec-memory.h"
 #include "sysbus.h"
+#include "qemu-error.h"
 
 /* 11 for 2kB-page OneNAND ("2nd generation") and 10 for 1kB-page chips */
 #define PAGE_SHIFT	11
@@ -772,6 +773,10 @@ static int onenand_initfn(SysBusDevice *dev)
         s->image = memset(g_malloc(size + (size >> 5)),
                           0xff, size + (size >> 5));
     } else {
+        if (bdrv_is_read_only(s->bdrv)) {
+            error_report("Can't use a read-only drive");
+            return -1;
+        }
         s->bdrv_cur = s->bdrv;
     }
     s->otp = memset(g_malloc((64 + 2) << PAGE_SHIFT),
-- 
1.7.5.4
next prev parent reply	other threads:[~2011-10-20 12:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-20 12:53 [Qemu-devel] [PATCH v2 0/2] nand/onenand: reject read-only drives juha.riihimaki
2011-10-20 12:53 ` [Qemu-devel] [PATCH v2 1/2] hw/nand: " juha.riihimaki
2011-10-20 12:53 ` juha.riihimaki [this message]
2011-11-08  9:17 ` [Qemu-devel] [PATCH v2 0/2] nand/onenand: " Markus Armbruster
2011-11-14  3:02 ` andrzej zaborowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox
  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):
  git send-email \
    --in-reply-to=1319115215-21224-3-git-send-email-juha.riihimaki@nokia.com \
    --to=juha.riihimaki@nokia.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY
  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
  Be sure your reply has a Subject: header at the top and a blank line
  before the message body.
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).