[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 2/6] block: m25p80: Support read only bdrvs.
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 2/6] block: m25p80: Support read only bdrvs. |
Date: |
Mon, 23 Jun 2014 17:31:15 +0800 |
From: Peter Crosthwaite <address@hidden>
By just never doing write-backs. This is completely invisible to the
guest, as the entire storage area is implemented as device state (at
realize time the entire drive is read in).
Signed-off-by: Peter Crosthwaite <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
hw/block/m25p80.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index e4ef733..5893773 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -291,7 +291,7 @@ static void flash_sync_page(Flash *s, int page)
int bdrv_sector, nb_sectors;
QEMUIOVector iov;
- if (!s->bdrv) {
+ if (!s->bdrv || bdrv_is_read_only(s->bdrv)) {
return;
}
@@ -309,7 +309,7 @@ static inline void flash_sync_area(Flash *s, int64_t off,
int64_t len)
int64_t start, end, nb_sectors;
QEMUIOVector iov;
- if (!s->bdrv) {
+ if (!s->bdrv || bdrv_is_read_only(s->bdrv)) {
return;
}
@@ -627,10 +627,6 @@ static int m25p80_init(SSISlave *ss)
if (dinfo && dinfo->bdrv) {
DB_PRINT_L(0, "Binding to IF_MTD drive\n");
s->bdrv = dinfo->bdrv;
- if (bdrv_is_read_only(s->bdrv)) {
- fprintf(stderr, "Can't use a read-only drive");
- return 1;
- }
/* FIXME: Move to late init */
if (bdrv_read(s->bdrv, 0, s->storage, DIV_ROUND_UP(s->size,
--
1.9.3
- [Qemu-devel] [PULL 0/6] Block patches, Stefan Hajnoczi, 2014/06/23
- [Qemu-devel] [PULL 1/6] block: m25p80: sync_page(): Deindent function body., Stefan Hajnoczi, 2014/06/23
- [Qemu-devel] [PULL 2/6] block: m25p80: Support read only bdrvs.,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 3/6] QemuOpts: check NULL opts in qemu_opt_get functions, Stefan Hajnoczi, 2014/06/23
- [Qemu-devel] [PULL 4/6] sheepdog: fix NULL dereference in sd_create, Stefan Hajnoczi, 2014/06/23
- [Qemu-devel] [PULL 5/6] vl: allow other threads to do qemu_system_vmstop_request, Stefan Hajnoczi, 2014/06/23
- [Qemu-devel] [PULL 6/6] block: asynchronously stop the VM on I/O errors, Stefan Hajnoczi, 2014/06/23
- Re: [Qemu-devel] [PULL 0/6] Block patches, Peter Maydell, 2014/06/23