]> Git Repo - qemu.git/commitdiff
block: m25p80: Support read only bdrvs.
authorPeter Crosthwaite <[email protected]>
Thu, 19 Jun 2014 01:36:37 +0000 (18:36 -0700)
committerStefan Hajnoczi <[email protected]>
Sat, 21 Jun 2014 08:40:14 +0000 (16:40 +0800)
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 <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
hw/block/m25p80.c

index e4ef733cc1279464bec9a84b009c267c52ad221e..5893773f0c866e491cf2ab3b60eafff0026e85cd 100644 (file)
@@ -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,
This page took 0.02967 seconds and 4 git commands to generate.